PDA

View Full Version : [AS2] Fishing Game


sh17
07-28-2004, 05:34 PM
ok so i can get the boat to go left and right, moving about 10 pixels or points left or right.

the problem i'm having is, i want when someone presses up to make the fishing rod to go shorter.

I've got a line with 8 keyframes and i can make the first keyframe work by saying

on(keyPress"<Up>"){
with("rod"){
gotoAndPlay("rod.wire8");
}
}

And that works, but i'm stuck from there.
I haven't really got a clue on where to go from there. :confused:

If anyone could point me in the right direction to some tutorials that are relevant, I'd be grateful.

BTW, I'm using Flash MX

I don't want you lot to just do a load of code for me, as I'll still be baffled on how you did it.

I just want the opportunity to learn it myself.

Like those oxfam dudes, give a man a fish and you'll feed him for a day..... give a man the means to catch his own fish and you'll feed him and his family for a lifetime.

That's basically what this thread is all about. :P

If I can learn it myself, I can make some money and feed my family for a lifetime. :D

Cheers,
John

smoothhabitat
08-01-2004, 10:38 PM
it might help if you gave a link to your fla so we know what was actually going on. also... the "with" command is so yesterday man. use the dot operator:

on(keyPress"<Up>"){
rod.gotoAndPlay("rod.wire8");
}

Also, what's with the rod.wire8? do you just mean wire8? what's your frame label?

sh17
08-02-2004, 07:19 PM
FLA: http://www.sh17.co.uk/wip/fishin2.fla

I want the rod wire to go up and down.

exstatic
08-03-2004, 01:24 AM
ok, .. i had a quick look..

firstly.. I changed the code to this;

on(keyPress"<Up>"){
this.rod.gotoAndPlay("wire8");

}


Youve got stop commands on each wire.. it seems to be working ok... wire8 only moves a little bit because you have a stop about 10 frames in... if you removed the stop commands it would go up ok..

might be your best bet to look at other ways of doing it.. try and work out a way of when you hold the up key it goes to the next frame of rod.. and down goes to the previous frame..

maybe something like this

on(keyPress"<Up>"){
this.rod.nextFrame();

}
on(keyPress"<Down>"){
this.rod.prevFrame();

}


Good Luck.

sh17
08-03-2004, 01:24 PM
Thanks for your help exstatic!

I got rid of the 10 little bits cos i thought they might just make the game too easy so now I'm gonna just have an up and a down.

Then I'll use hit target to catch the fish.

Yea, one question though.... is there a way of making it so that if you press down and the shape tween activates if you press down again it won't go back to the start.
Like i don't want them to frantically press down and then it'll keep going back to the start and do nothing.

Do you know what I mean?