PDA

View Full Version : AS+game+seesaw effect


csj16
09-13-2005, 03:52 PM
Hi. I am very new to Flash AS but I have been trying to create a game that will have a seesaw effect.
So that when the first character jumps off the top platform onto the seesaw the second character will fly up off the seesaw and onto the top platform. I tried just a simple ' if (Key.isDown(Key.SPACE)) {
_x =' ,with a hitTest, ect....
but that doesn't seem to work very well. That also just moves the character straight down or up and it doesn't appear as though they are actualy jumping.

Is there a specific way of doing this? AM i going about this the right way? or am i completely off base.

I would really appreciate any help. I am desperate. :D :D
Thanks!

Headshotz
09-14-2005, 04:05 AM
Hi and welcome to AS.org!

You may want to try making when the character hits the seesaw it does something like this:




//**********
//Another code with pink by Headshotz
//**********
//Sets properties
onClipEvent (load) {
gravity = 1.5;
velocity = 0;
falling = true;
}
//Puts physics to action
onClipEvent (enterFrame) {
if (falling == true) {
velocity += gravity;
_y += velocity;
}
//Only jump high if on the ground
//(or seesaw in this case)
//This stops character from flying
if (this.hitTest(_root.ground)) {
if (falling == true) {
_y = _root.ground._y;
velocity = 0;
falling = false;
_y += velocity;
}
//If not on the ground/seesaw than he
//has to be falling (or flying)!
} else {
falling = true;
}
//When you press space he bounces UP
if (Key.isDown(Key.SPACE)) {
if (falling == false) {
velocity -= 15;
falling = true;
}
}
}
//End of code

csj16
09-14-2005, 07:00 AM
Thanks a million! I will try that out! :D :D

Headshotz
09-15-2005, 06:51 AM
Thats ok,

If you want the code for the character that jumps on the
seesaw, or to make the seesaw rotate when hit I can post
that too.

csj16
09-15-2005, 08:28 AM
That would be great!! I have now changed some other stuff within my game and the code you previously game me is perfect. It makes the character move more seamlessly.

Thanks! I am having some trouble with getting the second character to move up when the first character jumps down.
I did use a hitTest to check it. But i would really appreciate any help. Thanks :D :D :D

csj16
09-15-2005, 08:36 AM
The only problem is that when I hit space bar the "ball/character" doesn't jump up. I was looking at the code and I assumed that if (Key.isDown(Key.SPACE)) {
would make the character jump up.
Is it because of the version of actionscript or something i have done wrong. Sorry if i am being silly. :D

Headshotz
09-15-2005, 10:22 AM
Ill make a fla file for you, unless you have an existing one
that I can edit. Do you have MX, MX2004 or Flash 8?

csj16
09-15-2005, 11:31 AM
I have Flash MX. You would really do that? That would be amazing!! :D :D

Headshotz
09-16-2005, 12:53 PM
Ok, take a look at the zipped file and tell me if you need help.

csj16
09-17-2005, 02:43 PM
Thanks a million! I really appreciate all your effort. :D :D