PDA

View Full Version : movement and jumping



pjuki
May 3rd, 2005, 12:41 PM
I once had a very good script to make a character walk right, left duck and jump.. But now I can't find it :wasted:

Can someone help me ?.. I need a script that can make the character do a dubbleJump when you press space 2 times fast after each other, and one that can make the character walk right and left and duck... Please help, I really need it..

- Pjuki

ar
May 3rd, 2005, 06:05 PM
Here you go, put this on the character's movie clip if you have made one already.




onClipEvent (enterFrame) {

speed1 = (what you want the speed to be)

//Movement

//Right
if (Key.isDown(Key.RIGHT)) {
this.gotoAndStop (the frame that you have the walking animation)
_x+= speed1
}


//Left
if (Key.isDown(Key.LEFT)) {
this.gotoAndStop (the frame that you have the walking animation)
_x-= speed1
}
}





And I'll get back with the jumping.

Edit: Tell me how you have the character set up and if you have the animations and everything and how you set it up withing the character's movie clip.






!GB! - PEACE -

pjuki
May 4th, 2005, 10:45 AM
Like.. In the movieclip I got different movieclips for each movement.. Like.. When he jump, walk right, walk left.. and the frames got a framelabel like: right, left, jump and stuff... If that could help ??

pjuki
May 4th, 2005, 11:24 AM
well.. It works.. Kinda.. But how am I going to do so it will go back to frame 1 when I stop pressing right or left arrowbutton ??

ar
May 4th, 2005, 03:50 PM
Well, I have an easy, yet complex to explain system to that. What I did, is make movie clip within movie clip within movie clip. What I did is, on the first movie clip, I used that code, from above, and when it went to a certain frame that I wanted it to, I had another movie clip in that frame that had the animation code. I'll explain that later if you want, but here's what you need:




onClipEvent (enterFrame) {

speed1 = (what you want the speed to be)

//Movement

//Right
if (Key.isDown(Key.RIGHT)) {
this.gotoAndStop (the frame that you have the walking animation)
_x+= speed1
} else {
this.gotoAndStop (the frame that you want)
}


//Left
if (Key.isDown(Key.LEFT)) {
this.gotoAndStop (the frame that you have the walking animation)
_x-= speed1
} else {
this.gotoAndStop (the frame that you want)
}
}



My other method is just more organized, and so I know what happens, and where it happens instead of putting everything down on one big code.






!GB! - PEACE -

pjuki
May 5th, 2005, 02:08 PM
okaay.. Now it's just ****ing out totally =D

:P

hmmm... Well, could you try to explain it more, or post a .fla so I can see what you mean?

ar
May 5th, 2005, 03:43 PM
Here's the fla. But I'm asking to learn how to do the movement, and not to just copy and paste all of my coding that I have been working on for a while now to figure out some stuff. So, try typing all of the stuff yourself, and just keep that as reference.

Movement (http://es.voetsjoeba.com/movement.fla) (around 300 kb (will close in two days))






!GB! - PEACE -

pjuki
May 6th, 2005, 03:44 AM
I'm only gonna use it so I can see and understand :kommie:

pjuki
May 6th, 2005, 03:46 AM
****.. Can you save it as a flashMX file ?? I haven't got the newer version... =)

It says unexpected file, or something like that :tie:

ar
May 6th, 2005, 04:06 PM
There, I've changed it. And one thing. Using foul language doesn't show up anyway, and it doesn't make anyone look kool, so, yeah. I think that the fla is what you're looking for.






!GB! - PEACE -

pjuki
May 7th, 2005, 05:14 AM
It was just d a m n
:D

pjuki
May 7th, 2005, 05:16 AM
And thanks...

ar
May 7th, 2005, 08:02 PM
You're Welcome






!GB! - PEACE -

pjuki
June 5th, 2005, 09:15 AM
Could anyone help me with the jump/doublejump ?

ar
June 5th, 2005, 02:22 PM
That part I'm still learning, sorta, more of bored with it, but I'll try to find someone that could help you out with the physics.






!GB! - PEACE -

pjuki
June 6th, 2005, 07:42 AM
kay

psykovsky
June 8th, 2005, 06:02 PM
Optimise your code ( >_<) use

if(){
} else if(){
}else{
};
:p:

ademuk
June 10th, 2005, 01:08 PM
Check it out, did this in 40 lines of code. ive been meaning to start a 'streets of rage' type game for ages. This is just the beginning! neway, im brand new here, only my second post.

Adem

pjuki
June 17th, 2005, 09:23 AM
I found ot tah walkin now, using a book.. But a double jump... I can't seem to find any, anywhere :cantlook: