Best viewed in Firefox

Awesty Productions

Platform Jumping

November 11th, 2006 by awesty

In this tutorial you will learn how to make a jumping system that could be used to make a platformer game or any other game involving jumping.

You should have taken my Moving MovieClips with the arrow keys tutorial because I will not be explaining that code.

First of all make you ground/platforms for your character to jump off and onto. If you have 1, give it an instance name of ground0. If you have 2 give them instance names of ground0 and ground1. For 3 give them instance names of ground0, ground1, ground2. If you have more than 3 you should have figured out by now what instance names to give them, if not I suggest you stop taking this tutorial and start learning English ;)

Now make the MC you want to jump and put this code on it: (Please read the comments so you understand what the code does.

onClipEvent(load){
    var jump:Number = 0; //Sets a new variable called jump with a value of 0
    var jumping:Boolean = false; //Sets a new boolean which will be false when it loads
    var falling:Boolean = false; //Read above
    var g:Number = 4; //This variable should be how many grounds you have. (If it goes up to ground2, then to should have 3 grounds. ground0, 1 and
}
onClipEvent(enterFrame){
    if(jumping == true || falling == true){ //If it is jumping or falling (|| means or)
        this._y -= jump; //The _y coordinates increase by the variable jump
    }
    if(jumping == false){ //If jumping is false
        if(!falling){ //If falling is false (! mean not, so !falling means not falling)
            jump = 0; //Jump equals 0
    }
        if(Key.isDown(Key.UP)){ //If the up arrow key is down…
            jump = 15; //Jump equals 15 and…
            jumping = true  //Jumping is true
        }
       
    }
    if(jumping == true){ //If jumping is true…   
        jump -= 1; //Jumping decrease by 1
    }   
    if(jump <= -10){ //If jump is equal to or less than negative 10…
        jump = -10; //Jumping equals -10. Then it will not go any lower than -10
    }   
    for(i=0;i<g;i++){ //This is a for loop. It keeps doing the code in between the curly braces until the condition (i<g) is false. g is the variable that has the number of grounds.
        if(jumping == true && this.hitTest(_root["ground"+i])){
/*If jumping is equal to true (jumping == true), and (&&) if this hits any of the grounds… (_root["ground"+i] will be _root.ground and then whatever i equals, so if i = 2, it would be _root.ground2. Since it is in a loop it will equal all the numbers to match all your grounds, if you get what I mean. That probably didn’t make make much sense.*/
            jumping = false; //Jumping equals false        
        }
    }
    if(Key.isDown(Key.LEFT)){ //You should have taken my moving movieclips with the arrowkeys tutorial so I won’t need to explain this.
        this._x -= 5;
    }else if(Key.isDown(Key.RIGHT)){
        this._x += 5;
    }
    for(i=0;i<g;i++){ //Another loop
        if(!jumping && !this.hitTest(_root["ground"+i]) && !falling){ //If jumping is flase and this isn’t hitting any of the grounds and falling is false…
            falling = true; //Falling is true and…
            this._y -= 1; //This _y decreases by 1 so it doesn’t fall through.
        }
    }
    if(falling == true){ //If falling is true
        for(i=0;i<g;i++){ //Another loop
            if(this.hitTest(_root["ground"+i])){ //if this hits any of the grounds…
                falling = false; //falling is false
            }
        }
        jump -= 1; //jump decreases by one     
    }   
}

Please don’t just copy and paste that code, please read all the comments so you know what it means.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • del.icio.us
  • digg
  • Furl
  • MyShare
  • NewsVine
  • Netscape
  • Reddit
  • Simpy
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

RSS feed | Trackback URI

181 Comments »

Comment by joey
2006-11-11 14:46:42

ive added this to my character and well theres a couple of errors and im not the bast at flash so i cant always figure it out so wat do you think:
**Error** Scene=Scene 1, layer=Layer 1, frame=4:Line 63: ‘)’ expected
if(jump $lt;= -10){ //If jump is equal to or less than negative 10…

**Error** Scene=Scene 1, layer=Layer 1, frame=4:Line 66: ‘;’ expected
for(i=0;i

Total ActionScript Errors: 2 Reported Errors: 2

Comment by ABBA Subscribed to comments via email
2007-07-08 05:32:03

I don’t reply to this comment but i didn’t find the new comment button or such thing.
Can’t you make the comments so shorter? It’s WAY to long! And i can’t read it cause the letters is too small! Fix this please. Anyway your other tutorials are great!

 
 
Comment by joey
2006-11-11 18:36:17

dont worry ive figured it out thanks for the tutorial and may i ask if you could make one on A.I. i would praise you if you did thx

 
Comment by awesty
2006-11-12 09:56:08

Yea, I will make one soon. Maybe today.

Also you must have got the code the same second I posted it because I made a few mistakes and I fixed it pretty much instantly so the code should be right now.

Comment by Izzy Subscribed to comments via email
2007-08-30 11:33:50

awesty you have so much extra code for the ground and all i want to know how to do is jump…help me plz

 
 
Comment by hbradley
2006-11-12 10:34:51

thanks for the tutorials.
they’re great

but on this one when ever I test it my man just appears in the middle and falls below the screen

any ideas?

thanks

Comment by Kurt Subscribed to comments via email
2007-11-06 07:14:03

Well you have to put a platform below it lol.

 
 
Comment by joey
2006-11-12 17:32:16

yea i did awesty it works pretty good now thx im looking forward for the AI one

hbradley i had the same problem with the falling through but it turned out that i forgot to name the ground movieclip ground0 that maybe the problem but im no expert.

 
Comment by hbradley
2006-11-13 02:31:19

thanks joey
I’ll check and see

 
Comment by awesty
2006-11-13 16:06:06

Okay, I am going to try and write two new tutorials tonight. The AI one will be the second so that might not get finished.

 
Comment by Webber
2006-11-16 14:05:53

can someone put what im suppose to put without explaining parts, ive read its just its getting annoying taking it out :p

 
Comment by someone
2006-11-16 15:06:37

webber are you a complete idiot take it out yourself dont be a lazy bitch

 
Comment by someone
2006-11-16 15:07:43

y are you so lazy do it your self

 
Comment by Webber
2006-11-17 06:36:19

bcz i did and it didnt work so i screwed something up and i dont understand the error box

 
Comment by awesty
2006-11-17 09:35:07

I did that purposely so people like you couldn’t just copy and paste it in. If you can really understand the code (which you should once you read all the comments) it should be simple to fix it. ;)

 
Comment by Webber
2006-11-17 11:01:30

i did but i didnt understand :(

 
Comment by awesty
2006-11-18 09:44:38

Okay, comments are marked with a //. That way flash knows it’s a comment and not code, so anything after a // that doesn’t look like code you can remove. Multi-line comments a marked with a /* and closed with a */ so anything between them you can delete to ;)

 
Comment by Webber
2006-11-19 08:02:04

and ofcourse the platforms should be MC?

 
Comment by bobby
2006-11-19 08:33:40

awesty ure tutorials are quite hard to follow, the health system thing neva worked for me, and now neither is this :( none of ure comments start with /* so its quite hard to tell if theyre multiline or not

 
Comment by awesty
2006-11-19 09:19:18

MC = Movieclip

Anything that follows // and doesn’t look like code get rid of. I can’t make it any clearer.

 
Comment by pushasha
2006-11-20 13:16:00

I understand all the comments because I do a lot of programming with other languages, but I’m not so experienced with Actionscript. I keep getting the following error and have tried to fix it multiple times, but I hasn’t been working. It might be because I’m using Flash MX 2004…

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 36: Operator ‘&&’ must be followed by an operand
if(jumping == true && this.hitTest(_root[”ground” i]==true)){

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 47: Operator ‘!’ must be followed by an operand
if(!jumping && !this.hitTest(_root[”ground” i]) && !falling){

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 53: Syntax error.
if(this.hitTest(_root[”ground” i])){

Total ActionScript Errors: 3 Reported Errors: 3

 
Comment by pushasha
2006-11-20 13:18:40

Actually, on the third line of the error I just posted, I should have entered it this way:

if(jumping == true && this.hitTest(_root[”ground” i])){

I added the “==true” when I was trying to fix it…

 
Comment by awesty
2006-11-20 17:23:31

That is weird, the code works fine for me. It should work fine with flash MX 2004. Are you are it is 2004, if not that would explain the problem.

 
Comment by Mark
2006-11-23 15:50:06

Awesty — thank you much for your tutorials. I’ve started going through them all tonight and have a super basic interactive sort-of game created already. I like your short-and-sweet approach (I’m a developer so it’s just the pace I need), but I hate the way it’s all formatted.

Your indentations are lost in HTML making the code kinda hard to read unless I view source, but then I have to trim out all the ’s and replace all the & with &.

Maybe you can use tags around your code samples?

 
Comment by Mark
2006-11-23 15:51:20

Er my comment got botched. The last line should’ve ready “Maybe you can use <pre> tags around your code samples :P

 
Comment by awesty
2006-11-23 15:53:23

Yea, i did but then the comments ran to long and off the page :P

 
Comment by Joe
2006-11-25 07:55:01

Is this for flash 8?
i doesnt work for me. i just got flash and i dont know a thing. HELP PLEEZE!

 
Comment by unknown
2006-11-26 00:59:09

wow… i never thought there could be a tutorial so great! thanx! gave me good stuff in my “maze” game!

 
Comment by moo moo
2006-11-26 14:46:20

what comes after ground4?

 
Comment by awesty
2006-11-27 16:07:58

@Joe: Yes, it is for flash 8. I cant really help you if I don’t know exactly whats wrong.

@Unknown: No problem. ;)
@Moo moo: ground7

 
Comment by sam
2006-11-28 08:52:56

how do u make a menu and a button that will activate the flash game?

 
 
Comment by Bryce K :P
2006-12-01 11:33:04

okay to put it simple this does not work at all there are to many errors and frankly my guy doesnt move AND YES I DID PUT THE MOVEMENT ON HIM FROM UR LAST TOT

 
Comment by awesty
2006-12-01 16:24:41

Well that doesn’t really help me to help you.

Just calm down and send the .fla to admin[@]awestyproductions[.]com.

 
Comment by Bryce K :P
2006-12-02 10:48:19

lol sry i was kidding i just couldnt ghet it 2 work but its ok i was just kidding :P

 
Comment by Bryce K :P
2006-12-02 10:50:05

but just incase u wanted to no there is a Jumping thing on Flashkit.com and it has less action script errors and it usually works except for 1 thing maybe you could hunt it down and modify it. (it will let u download the .fla file :))

 
Comment by RedV
2006-12-02 13:52:44

my guy just keeps falling through the blocks
but there aren’t any error messages
please help!

 
Comment by Bryce K :P
2006-12-03 11:51:59

Umm Awesty i didn’t copy and paste this, i have 9 errors ._. plz help
**Error** Line 1: Clip events are permitted only for movie clip instances
onClipEvent(load){

**Error** Line 6: Clip events are permitted only for movie clip instances
onClipEvent(enterFrame){

**Error** Line 26: This type of quotation mark is not allowed in ActionScript. Please change it to a standard (straight) double quote.
if(jumping == true && this.hitTest(_root[”ground” i])){

**Error** Line 36: This type of quotation mark is not allowed in ActionScript. Please change it to a standard (straight) double quote.
if(!jumping && !this.hitTest(_root[”ground” i]) && !falling){

**Error** Line 42: This type of quotation mark is not allowed in ActionScript. Please change it to a standard (straight) double quote.
if(this.hitTest(_root[”ground” i])){

**Error** Line 6: Statement block must be terminated by ‘}’
onClipEvent(enterFrame){

**Error** Line 50: Syntax error.

**Error** Line 1: Statement block must be terminated by ‘}’
onClipEvent(load){

**Error** Line 50: Syntax error.

 
Comment by awesty
2006-12-03 17:37:05

@RedV: Did you get all the instance names on the right movieclips?

@Bryce K: It looks like you have out the script on a frame instead of a movieclip.

 
Comment by Adman
2006-12-04 02:28:32

My character sinks in to the gournd slightly when he hits it. How can i stop thi=s from happening?
Also can u make a tutorial for scrolling backround please!!!

 
Comment by Bryce K :P
2006-12-04 03:02:01

awsety i made the changes but i still have 2 errors

**Error** Scene=Scene 1, layer=Layer 1, frame=15:Line 26: Statement block must be terminated by ‘}’
onClipEvent(load){

**Error** Scene=Scene 1, layer=Layer 1, frame=15:Line 71: Syntax error.
}

 
Comment by Bryce K :P
2006-12-04 03:04:17

dangit i cant go any farther lol (sry i took up so much space ill e-mail my script to you)

 
Comment by awesty
2006-12-04 12:41:22

@Adman: Try changing it to this:
onClipEvent(load){
var jump:Number = 0; //Sets a new variable called jump with a value of 0
var jumping:Boolean = false; //Sets a new boolean which will be false when it loads
var falling:Boolean = false; //Read above
var g:Number = 4; //This variable should be how many grounds you have. (If it goes up to ground2, then to should have 3 grounds. ground0, 1 and
}
onClipEvent(enterFrame){
//if(jumping == true || falling == true){ //If it is jumping or falling (|| means or)
this._y -= jump; //The _y coordinates increase by the variable jump
//}
if(jumping == false){ //If jumping is false
if(!falling){ //If falling is false (! mean not, so !falling means not falling)
jump = 0; //Jump equals 0
}
if(Key.isDown(Key.UP)){ //If the up arrow key is down…
jump = 15; //Jump equals 15 and…
jumping = true //Jumping is true
}

}
if(jumping == true){ //If jumping is true…
jump -= 1; //Jumping decrease by 1
}
if(jump <= -10){ //If jump is equal to or less than negative 10…
jump = -10; //Jumping equals -10. Then it will not go any lower than -10
}
for(i=0;i if(jumping == true && this.hitTest(_root[”ground” i])){
/*If jumping is equal to true (jumping == true), and (&&) if this hits any of the grounds… (_root[”ground” i] will be _root.ground and then whatever i equals, so if i = 2, it would be _root.ground2. Since it is in a loop it will equal all the numbers to match all your grounds, if you get what I mean. That probably didn’t make make much sense.*/
jumping = false; //Jumping equals false
}
}
if(Key.isDown(Key.LEFT)){ //You should have taken my moving movieclips with the arrowkeys tutorial so I won’t need to explain this.
this._x -= 5;
}else if(Key.isDown(Key.RIGHT)){
this._x = 5;
}
for(i=0;i if(!jumping && !this.hitTest(_root[”ground” i]) && !falling){ //If jumping is flase and this isn’t hitting any of the grounds and falling is false…
falling = true; //Falling is true and…
this._y -= 2; //This _y decreases by 1 so it doesn’t fall through.
}
}
if(falling == true){ //If falling is true
for(i=0;i if(this.hitTest(_root[”ground” i])){ //if this hits any of the grounds…
falling = false; //falling is false
}
}
jump -= 1; //jump decreases by one
}
}

Sorry about all the comments but I couldn\’t really be bothered taking them out.

 
Comment by awesty
2006-12-04 12:43:31

@Bryce K: I got your email and deleted your 2 other posts since they took up a far bit of scrolling space. :P
I will try and fix it when I have time.

 
Comment by Daniel
2006-12-09 08:42:35

This tutorial is great exept i got 1 error :
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 7: Statement block must be terminated by ‘}’
onClipEvent(enterFrame){

Please help. Thank you.

 
Comment by awesty
2006-12-09 09:45:14

Just add one of theses, }, to the end of your code. It should work.

 
Comment by Daniel
2006-12-10 01:26:16

ok i did that but now my guy just falls and when i press up he flies and doesnt stand on the platforms, can i send you the .fla file?

 
Comment by awesty
2006-12-10 11:17:25

Yep. My email it admin[@]awestyproductions[.]com.

 
Comment by tyler
2006-12-12 16:01:26

hey when I try to jump onto the platform, i jump and go right through it

please help!?!?!?!

tyler

if u dont know… i wanna be able to stand on the platform

P.S. is there any way to make the enemys attack you?

 
Comment by Bryce K :P
2006-12-13 08:53:59

I tried putting “}” and “{” these everywhere but i still have these errors

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 6: Statement block must be terminated by ‘}’
onClipEvent(enterFrame){

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 49: Syntax error.

 
Comment by Bryce K :P
2006-12-13 08:56:31

PEOPLES IF UR GUY FALLS THERW THE FREAKIN WALL IT MEANS YOU DIDNT PUT AN INSTANCE NAME ON THE GROUND name it ground0. (Without the period)

 
Comment by tyler
2006-12-13 09:56:52

ok i did everything with instance names and the code
and speaking of the code i put it on the guy and i still have 3 errors please help and replace them…

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 28: This type of quotation mark is not allowed in ActionScript. Please change it to a standard (straight) double quote.
if (jumping == true && this.hitTest(_root[”ground” i])){

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 39: This type of quotation mark is not allowed in ActionScript. Please change it to a standard (straight) double quote.
if(!jumping && !this.hitTest(_root[”ground” i]) && !falling){ //If jumping is flase and this isn’t hitting any of the grounds and falling is false…

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 46: This type of quotation mark is not allowed in ActionScript. Please change it to a standard (straight) double quote.
if(this.hitTest(_root[”ground” i])){ //if this hits any of the grounds…

Total ActionScript Errors: 3 Reported Errors: 3

 
Comment by awesty
2006-12-13 16:48:08

@Both of you: Just email the .fla’s to me. It is much easier for me to understand what is going on.

admin[@]awestyproductions[.]com

 
Comment by BeM
2006-12-14 04:39:07

Wow, what a great tut awesty! Thanks a lot. But I have one problem… my character bumps like like on each platform and when I jump and the character lands, he falls a little bit trough the platform and then he rises again. After that he starts bumping again.

Could you please help me?

Keep up the good work your tuts are great!

 
Comment by tyler
2006-12-14 13:41:30

it wont let me send it to u

 
Comment by Daniel
2006-12-15 09:57:11

I send mine to you a 10 days ago. Are you going to email back or are you going to post a comment?

 
Comment by awesty
2006-12-15 11:43:07

@BeM: Try changing the number on the last line (something like jump -= 1;) to a smaller number, is will still bump, but not as much.

@Tyler: I cant help you there.

@Daniel: Are you sure I haven\’t replied? Otherwise I mustnt have got the email.

 
Comment by BeM
2006-12-15 22:33:06

Thanks awesty, but stille my character is rising threw the platforms. For example when I jump underneath a platform and it hits a platform it starts rising up till it’s on top of that platform…

Can I do something about that?

 
Comment by Mohit
2006-12-16 01:50:58

Hey awesty,
i tried your tutorial for platform jumping buti got 12 errors. Using a basic knowledge of actionscripting i was able to understand your code and deleted the “//”s and the comments but i get the following three errors.

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 27: Operator ‘&&’ must be followed by an operand
if(jumping == true && this.hitTest(_root[”ground” i])){

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 38: Operator ‘!’ must be followed by an operand
if(!jumping && !this.hitTest(_root[”ground” i]) && !falling){

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 45: Syntax error.
if(this.hitTest(_root[”ground” i])){

Total ActionScript Errors: 3 Reported Errors: 3

I am sending you the flash file document currently.
Please help. Thank you.

 
Comment by BeM
2006-12-16 02:41:26

Mohit

You need to change the ” around ground. When you do it properly it turns into green.

 
Comment by awesty
2006-12-16 17:17:56

@BeM: Try taking out the line:

jump -= 1; //jump decreases by one

@Mohit & BeM: Yea, I think its because this site as a different font, when you paste it flash cant read the quotation marks properly.

 
Comment by Bryce K :P
2006-12-17 11:21:20

yah awesty i e-mailed u like 3 weeks ago >.> and i never got a response…

 
Comment by awesty
2006-12-17 13:32:00

Hmm… I can remember emailing you back. Thats weird. I have the message in my sent box.

 
Comment by Bryce K :P
2006-12-18 00:03:12

o.. could u post it cause i guess my e-mail is screwed up

 
Comment by awesty
2006-12-18 10:52:44

onClipEvent(load){
fight = false;
}
onClipEvent(enterFrame){
if(fight == false){
if(Key.isDown(Key.LEFT) && fight != true){
this._x -= 4;
this._xscale = -100;
this.gotoAndStop(2);
}else if(Key.isDown(Key.RIGHT) && fight != true){
this._x = 4;
this._xscale = 100;
this.gotoAndStop(2);
}else{
this.gotoAndStop(1);
}
}
if(Key.isDown(Key.SPACE)){
this.gotoAndStop(3);
fight = true;
}
if(this._currentframe == 1){
fight = false;
}
}
onClipEvent(load){
var jump:Number = 0;
var jumping:Boolean = false;
var falling:Boolean = false;
var g:Number = 4;
}
onClipEvent(enterFrame){
this._y -= jump;
if(jumping == false){
if(!falling){
jump = 0;
}
if(Key.isDown(Key.UP)){
jump = 15;
jumping = true
}

}
if(jumping == true){
jump -= 1;
}
if(jump <= -10){
jump = -10;
}
for(i=0;i if(jumping == true && this.hitTest(_root[”ground” i])){

}
}
if(Key.isDown(Key.LEFT)){
this._x -= 5;
}else if(Key.isDown(Key.RIGHT)){
this._x = 5;
}
for(i=0;i if(!jumping && !this.hitTest(_root[”ground” i]) && !falling){
falling = true;
this._y -= 1;
}
if(falling == true){
for(i=0;i if(this.hitTest(_root[”ground” i])){
falling = false;
}
}
jump -= 1;
}
}
}

 
Comment by Bryce K :P
2006-12-19 00:54:04

Thanks for the help but that doesn’t work either it keeps saying all clip events have to appear on a clip handler when they are attached to a movieclip anyway could you check out my version of the game its rite here, the only thing wrong with is is you go through the ground even is the code is on it…
[url=http://www.swfup.com/swf-view.php?id=3509]View my swf file![/url]

 
Comment by Bryce K :P
2006-12-19 00:56:33

wow, thats weird i just played my game again… and i didnt fall through but on my comp. i do… cool :) anyway if you wanna see the code here it is :P (i just give the ground an instance name of ground)
onClipEvent (load) {

moveSpeed = 10;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {

this._x = moveSpeed;

}else if (Key.isDown(Key.LEFT)) {
this._x -= moveSpeed;

}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP) && !jumping) {
vel_y = 36;

jumping = true;
}
if (jumping == true) {
vel_y -= 2;
if (vel_y

 
Comment by Bryce K :P
2006-12-19 00:57:44

awww dammit i hate when it gets cut off… I’ll e-mail it to u so you can make it better, if you want

 
Comment by awesty
2006-12-19 17:50:30

It won’t get cut off if you take out the angle brackets (< and >) ;)
It works fine on my computer to, maybe its the version of flash on that computer.

 
Comment by Bryce K :P
2006-12-20 11:55:35

yes i finally got it to work Thnaks for the tutorial but, my guy keeps falling through the ground XD and i have all my instance names -_-

 
Comment by awesty
2006-12-21 11:48:12

You can email it to:

awestyproductions[@]gmail[.]com

If you want. I will try and fix it.

 
Comment by Bryce K :P
2006-12-22 00:28:58

Thanx man it looks sick now :P

 
Comment by awesty
2006-12-22 11:19:14

No problem. :D

 
Comment by KIM
2006-12-22 17:26:49

I need help please? how can i make my char jump when i press up?

thnx awesty

 
Comment by awesty
2006-12-22 17:53:18

Ummm, read the tutorial.

 
Comment by KIM
2006-12-22 18:20:20

i did but it wont work…

 
Comment by RDB2006
2006-12-22 18:43:53

im about to try the platforms but theres one prob. Im gona have the platforms moving sideways in a motion tween so u hav to try and catch it, and i cant make it in a loop or it will go back to the the first frame where the health, etc, is set back to its original varible etc. Is ther anyway just to loop the tween?

 
Comment by awesty
2006-12-22 18:53:36

@KIM: Read it again, I just changed it a bit.

@RBD2006: Make the platform a MC, and tween it inside the MC. So on the main timeline it is only 1 frame.

 
Comment by RDB2006
2006-12-22 19:22:37

ty awesty this is one of the best tutz :) therz just one more thing. Is it possible to make it that if you fall of a platform, you fall, but down the bottom of the screen and a varible for your life decreases? Or something like that to indicate you lost a life

 
Comment by no1jock
2006-12-22 19:39:19

its not very accurate, it will jump onto platforms, but with platforms that are close, if you walk off one it goes up onto the other one. Maybe cuz only the surface line should be my mc, im not sure but i thought id ask

 
Comment by RDB2006
2006-12-22 20:09:50

byrce, i had the same problem if u havent fixed it already, make the platform a 0.25 line, and call it ground0 and just move it ontop of the thing u want to jump onto, i had the same prob cuz i was making a function wer u jump onto a tree, and accidently made it all a platform etc

 
Comment by Bobkins
2006-12-22 21:17:02

hey he jumps to high, can anybody help or highlight the code that tells him how high he jumps?

 
Comment by no1jock
2006-12-23 05:59:10

@RDB2006 - thanks for the advice.

 
Comment by awesty
2006-12-23 12:33:12

@RBD2006: Make a MC off the screen, and put a code like this on it:

onClipEvent(enterFrame){
if(this.hitTest(_root.man){
_root.life -= 1;
}
}

And have a dyanamic text for the health with a variable name of life.

@Bobkins: This:

jump -= 1;

And:

jump = 15;

 
Comment by eblup
2006-12-24 11:20:21

hey post a code of this only with an over