Go Back   kirupaForum > Flash > Game/AI Programming

Reply
 
Thread Tools Display Modes
Old 11-20-2009, 11:18 AM   #1
Snowz
Damn Artist
 
Snowz's Avatar
Location Dundee, Scotland

Posts 4
Eagle scrolling game, uni project

Hi guys, I'm an illustration student and as such I desperately need a hand with a flash game I'm making for an exhibition next Friday. I've been wrestling with it for a couple of weeks and reading tutorials but I think cutting to the chase and coming straight to the pros would be the best plot right now... I'm starting to get a little frantic.

This thread will probably be really frustrating for you all but if I have someone sort of... metaphorically hold my hand through learning what to do I think I'll get things done a lot faster.

The background for the project is the release of the sea eagles on the east coast of scotland, we have to raise public awareness. I'm focusing on kids and what gets their attention in school, games of course, and I figured as this is only phase one of the project (if I get picked then I'll be asked to finish the game) then I only need a few stills on the wall and a simple scrolling screen with a couple of interactive things to please the short attention spans of people...

All I need is for the eagle to swoop and catch the rabbit when the rabbit gets clicked and you get say, 10 points. I also need the rabbit to be dropped again so other people can try it out at the exhibition.

I've managed to create this so far:
http://megaswf.com/view/8b38b2985ab0...c68d7efda.html

It's taken me all week! How pathetic is that. The boat button I was hoping could take you to another swf of info about how fishing boats feed sea eagles occasionally... But the only reason it doesn't yet is because I know how to do it and I have all the bits, I've just forgotten how to link it all together blah.

I haven't put on lives and a score calculator and sound on/off yet, I can do the sound on/off thing (even though it doesn't have sound yet), the rest will probably be purely ornamental for the purposes of the exhibition.

anyway so halp! Oh gosh I'm so embarrassed posting such basic rubbish on here, I'm very out of my depth with this outcome!
Snowz is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Old 11-20-2009, 11:46 PM   #2
TOdorus
Hot 'n Funky
 
TOdorus's Avatar
Location Nijmegen, Netherlands

Posts 390
Welcome to the forum Snowz, now relax a bit

The only real problem is that the eagle can be at any given x and y position relative of the rabbit. One possible solution would be for the eagle to always swoop down to a y position. When it reaches the ground, it would stay a that y position until it reaches the rabbit and then pick it up. When the player would be late in pressing the rabbit, it would still swoop down to the y position, but ascend back up after it reached it. If you would like another solution just let us know, and we can help you out with the actionscript part, but now it's just not clear what kind of behavior you're looking for.

About the fishing boat linking: are you using AS2 or AS3? And do you create the fishing boat dynamicly at runtime (with actionscript) or at authortime (in Flash)? If you create it dynamicly: what reference name have you given it?

__________________
Blog: Vipe Games updated 3 dec 2009

Last edited by TOdorus; 11-20-2009 at 11:48 PM..
TOdorus is offline   Reply With Quote
Old 11-21-2009, 12:41 AM   #3
dandylion13
Registered User
Quote:
Originally Posted by Snowz View Post
All I need is for the eagle to swoop and catch the rabbit when the rabbit gets clicked and you get say, 10 points. I also need the rabbit to be dropped again so other people can try it out at the exhibition.
Like TOdorus mentioned, I think we need to know what kind of behaviour you expect for this "swooping" action.

I was bit confused by the UI. The eagle is keyboard controlled, but you want the player's to click the rabbit? It might be confusing for casual players to switch between the arrow keys to the mouse, and also understand that you need to click the rabbit to pick it up.

I would choose either all mouse control, or all keyboard control. If you're going for keyboard control, I think it's fine as it is. Maybe just have the eagle pick the rabbit up when it touches it? The mechanics are 99% there, I don't think you need an extra swooping behaviour.

You'll also need to think about what you want to have happen after the rabbit gets picked up. Is that the end of the game? If so, how will the game actually end and restart?

How about upping the challenge by having the player drop the rabbit into a basket? You could maybe set a time limit and ask the player to catch as many rabbits as possible in one minute. That might work well in a kiosk environment where, as you said, attention spans are short.

Also, it may be very frustrating for players to be taken to another screen if they click that boat while still in the middle of the game. Maybe have that as an option after the first goal of catching the rabbit has been achieved.

The illustrations are lovely! It's been a very good use of a week, I think
dandylion13 is offline   Reply With Quote
Old 11-21-2009, 02:51 PM   #4
Snowz
Damn Artist
 
Snowz's Avatar
Location Dundee, Scotland

Posts 4
Quote:
Originally Posted by TOdorus View Post
Welcome to the forum Snowz, now relax a bit

The only real problem is that the eagle can be at any given x and y position relative of the rabbit. One possible solution would be for the eagle to always swoop down to a y position. When it reaches the ground, it would stay a that y position until it reaches the rabbit and then pick it up. When the player would be late in pressing the rabbit, it would still swoop down to the y position, but ascend back up after it reached it. If you would like another solution just let us know, and we can help you out with the actionscript part, but now it's just not clear what kind of behavior you're looking for.

About the fishing boat linking: are you using AS2 or AS3? And do you create the fishing boat dynamicly at runtime (with actionscript) or at authortime (in Flash)? If you create it dynamicly: what reference name have you given it?
Haha thanks, phew...

That sounds like a great plan, so the eagle can travel to a y position calculated by where the spacebar was pressed and if it's so many pixels away from the rabbit it picks it up.. Yes? (Probably not how the mechanics work, oh I wish I knew how to speak the lingo.) Oh and yes I hadn't thought hard about the UI, pressing the spacebar would be a better idea.

I'm using AS2 and the boat is currently authortime, I think it might stay that way as the sea won't always be in the landscape... However I'd like the rabbits and other prey to be generated and maybe even have a bit of AI like running away. I don't know how to do that yet and next week is apparently for setting up the exhibition so I don't want to have to completely redo everything just to incorporate that - YET. This is just a sort of rough game.

Yeah I know it might be distracting, dandylion, but I want to show that that learning possibility is there. It's supposed to be an educational game of sorts and I need to get the facts in there somehow.. Clicking things you pass was all I could think of!

Hmmmmm not so sure about the basket idea... I think I need to show how the game will scroll and take you through the country. I just wanted the rabbit to be picked up and dropped and every time it's picked up you get points. At the end of the exhibition there might be a gazillion points but it doesn't matter, it gets the basic idea across. I mean the judges probably aren't used to playing games and they're literally going to pass it, poke the keyboard a bit and move on.

If that's really tricky to do then I'll have a wee brainstorm and see if I can come up with something else.

Thank you!
Snowz is offline   Reply With Quote
Old 11-22-2009, 12:09 AM   #5
TOdorus
Hot 'n Funky
 
TOdorus's Avatar
Location Nijmegen, Netherlands

Posts 390
Late at the moment so I'll only take a shot at one.

Quote:
Originally Posted by Snowz View Post
That sounds like a great plan, so the eagle can travel to a y position calculated by where the spacebar was pressed and if it's so many pixels away from the rabbit it picks it up.. Yes? (Probably not how the mechanics work, oh I wish I knew how to speak the lingo.) Oh and yes I hadn't thought hard about the UI, pressing the spacebar would be a better idea.
Your eagle is constantly moving to the right, so speed.x > 0 (the x component of it's velocityvector is positive). Now if it were to dive, it were to dive down so speed.y > 0. Let's just say your game is just a one button game (the spacebar in this case) and the y velocity is constantly 0 unless the spacebar is pressed. Then the eagle y velocity becomes a constant... 3? or something positive until it reaches the height it can grab the rabbit.

PHP Code:
var diving:Boolean false
var diveTimer:int 50 //how long it can hover at ground level
var skyLevel:Number 30
var groundLevel:Number 250
function onSpacePress ():void {
    
diving true
}
function 
moveEagle ():void {
    
eagle.+= 2
    
if(diving){
      
eagle.y+= 3
    
} else {
      
eagle.y-= 1
    
}
    
//=======
    //CHECKS
    //=======
    
if(eagle.groundLevel){ //check if it has reached the ground
        //it's flying in the ground! Correct it.
        
eagle.groundLevel
        diveTimer
--
    } else if(
eagle.skyLevel){//check if has reached the (virtual) ceiling
        //it's flying to high! Correct it.
        
eagle.skyLevel
    
}
    if(
eagle.rabbit.|| diveTimer 0){//check if it has passed the rabbit or has dived to long
        //it has passed the rabbit or dived to long so it can't be diving
        
diving false
        diveTimer 
50
    
}
 

Now this may not look pretty (the eagle just gains and loses velocity in a split second), but this will work for now. See if you can understand and implement that (it's a bit psuedocode). If this is no problem I'll post an example of how to implement acceleration and friction.

__________________
Blog: Vipe Games updated 3 dec 2009

Last edited by TOdorus; 11-22-2009 at 12:11 AM..
TOdorus is offline   Reply With Quote
Old 11-22-2009, 01:14 PM   #6
Snowz
Damn Artist
 
Snowz's Avatar
Location Dundee, Scotland

Posts 4
Okay, I'm pretty sure I have a grasp of what does what in the code, thank you for writing it out

So I have one frame which has a background graphic, the eagle movie clip with the identifier 'eagle' and a rabbit with the identifier 'rabbit'. I put your code in the frame script and got three compiler errors

the class or interface 'int' could not be loaded | var diveTimer:int = 50
A type identifier is expected after the ':'. | function onSpacePress ():void {
A type identifier is expected after the ':'. | function moveEagle ():void {

I'm running Flash CS4 by the way, in case that makes a difference...!
Snowz is offline   Reply With Quote
Old 11-22-2009, 01:42 PM   #7
TOdorus
Hot 'n Funky
 
TOdorus's Avatar
Location Nijmegen, Netherlands

Posts 390
I use AS3 so there may be some syntax errors in that example. Like you noted AS2 doesn't know the :int variabletype (you can use :number instead). I believe :void is :Void (hence the capital V) in AS2, but if that still gives you problems just remove :void altogether.

None of the type declerations are necessary by the way. It's just to make code more readable and make the compiler throw up errors when it gets the wrong inputs (this has it's merit in more complex scripts)

looking at that code again, I don't know how AS2 discriminates between local and nonlocal variables. Local variables only exist in the function they've been created in and then are deleted and get referenced to quite a bit faster. You define a local variable by putting var in front of a name. So you may need to change

PHP Code:
var diving:Boolean false
var diveTimer:int 50 //how long it can hover at ground level
var skyLevel:Number 30
var groundLevel:Number 250 
to

PHP Code:
diving:Boolean false
diveTimer
:int 50 //how long it can hover at ground level
skyLevel:Number 30
groundLevel
:Number 250 
This is because the functions may not have acces to them if they're local to _root. They probably will also be deleted after the first frame too, but I'm not sure about that one.

__________________
Blog: Vipe Games updated 3 dec 2009
TOdorus is offline   Reply With Quote
Old 11-22-2009, 02:42 PM   #8
Snowz
Damn Artist
 
Snowz's Avatar
Location Dundee, Scotland

Posts 4
Okay I tried a few things here - I got rid of the vars and the voids, I put some of the script on the eagle and some on the frame and a tried a couple of other things my friend suggested like adding identifiers to the diving and none of it is working. He suggests I send the .fla to you so you can implement it and send it back to me so I can see what you've done.

I just keep getting a syntax error for the diving boolean.

http://spamtheweb.com/ul/upload/3309..._eaglegame.fla
Snowz is offline   Reply With Quote
Old 11-22-2009, 04:04 PM   #9
TOdorus
Hot 'n Funky
 
TOdorus's Avatar
Location Nijmegen, Netherlands

Posts 390
God that takes me back. Been a long time since I coded in AS2
http://home.planet.nl/~bogaa096/67267_eaglegame.fla

Have you any idea how you want to solve the background problem? You could stick 2 backgroundgraphics behind each other. Each time the screen passes a background the first background is put behind the last.

But better would probably be to move the, eagle, rabbit and ship back to the right positions. This is because if you keep the eagle moving and swapping backgrounds, the eagle gets a very high ._x value. This isn't really a problem most of the time, but when your game needs to run as long as yours, that might mean the number gets too high. There are only so many bytes reserverd for the ._x, and if you go over that maximum number crazy stuff (or a crash) can happen.

__________________
Blog: Vipe Games updated 3 dec 2009
TOdorus is offline   Reply With Quote
Reply

Tags
eagles


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:17 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com