How to do a velocity jump -[Tutorial]-

Learn how to make certain types of games and use gameEditor.

Was this tutorial Helpfull?

Yes
14
70%
No
0
No votes
Too Hard
1
5%
:3
5
25%
 
Total votes : 20

How to do a velocity jump -[Tutorial]-

Postby Hblade » Tue Jun 29, 2010 3:15 pm

Do a velocity jump
      by Hblade
Ever want to do a velocity jump, where you jump higher the longer you hold down the jump button? Well now you can! Lets get started shall we? use the graphics provided in the download link for this tutorial.

    Download
        Art.zip
        (690 Bytes) Downloaded 947 times

        Art.rar
        (547 Bytes) Downloaded 641 times


Alright, first thing's first. Set your background color to
    Red: 83
    Green: 103
    Blue: 146
              Screenshot
              S1.JPG


This is so we can actually see our character, and thus making it easier on our eyes :P Good, now that you have the art set downloaded, lets start :D First, make your player. You can see through him, but thats okay. Now that you made him, go to draw actor - put this code in.
Code: Select all
if (yvelocity<4)
{
    yvelocity+=.08;
}

This will limit his falling speed. Now that you have that add your Tile actor, and draw some tiles! :D
              Screenshot
              s2.JPG


Now add a collision, any physical response will do, no need for fancy stuff since your just learning how to do a velocity jump :D. Now that you added a collision effect, you need to make hum jump! For now lets do a single jump. make a variable called cjump
              Screenshot
              s3.JPG

Now that you made that variable, make a keydown Event.
    •Key Down
      •Z
      •Script Editor
      Code: Select all
      if (cjump == 0)
      {
          yvelocity = -9;
          cjump = 1;
      }

Now, go back to your Draw Actor script, and add this to it:
Code: Select all
if (yvelocity>=1)
{
    cjump = 1;
}

This means that when you start to actually fall, the character wont be able to jump in the middle of the air that way you can avoid issues such as you walk off the edge of a cliff and your still able to jump. Since our yvelocity is adding by .8 each time, its good to have it actually say if its greater thatn or equal to 1, that way it wont glitch and keep you unable to jump even if on the ground. This happens as a result of Draw Actor trying to constantly add .8 to the falling speed, which is making yvelocity spike from 0 to .8 and the physical response stops the character so you dont notice it.
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 180 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby Hblade » Tue Jun 29, 2010 4:07 pm

Do a velocity jump
      by Hblade
        Part 2

Part 2, limiting the jump

Now make a collision event with the tiles
    •Collision
      •Top Side of tiles
      •Script Editor
      Code: Select all
      cjump = 0;


Good, your almost done! :D Now, last but not least, make a key up event.
    •Key Up
      •Z
      •Script Editor
      Code: Select all
      if (cjump == 1)
      {
          yvelocity = yvelocity/2;
          cjump = 2;
      }

Now test it out! :D Hold down the Z button for a longer jump, or tap it for a smaller jump.

Now for the jump animation
Go back to you Draw Actor once again, and add this in it
Code: Select all
if (yvelocity>=2)
{
    ChangeAnimation("Event Actor", "dude_jump", FORWARD);
}

Your draw actor code should now look like this:
Code: Select all
if(yvelocity<4)
{
    yvelocity+=.8;
}
if (yvelocity>=1)
{
    cjump = 1;
}
if (yvelocity>=2)
{
    ChangeAnimation("Event Actor", "dude_jump", FORWARD);
}


Now go to the script editor of your collision - top side of tiles, and add this
Code: Select all
ChangeAnimation("Event Actor", "dude", FORWARD);


Now last but not least, we make the animation change when he jumps, so go to your key down Z and put this in between the if statement
Code: Select all
ChangeAnimation("Event Actor", "dude_jump", FORWARD);


Its complete :D!

Download and test it for yourself if you'd like. Use the arrow keys to move in this demo and Z to jump. If this was too complicated, please let me know right away.
                    Demo.zip
                    (2.99 KiB) Downloaded 667 times

                    Demo.rar
                    (2.63 KiB) Downloaded 444 times

User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 180 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby DST » Tue Jun 29, 2010 7:54 pm

good job noticing the canjump enable on the ground vs. speed thing.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby Hblade » Tue Jun 29, 2010 8:02 pm

I think it was you that told me that, or was it Skydereign? :/
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 180 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby Bee-Ant » Wed Jun 30, 2010 2:54 am

Excellent tutorials...
Completed with screenshot and demo, very nice :D
User avatar
Bee-Ant
 
Posts: 3717
Joined: Wed Apr 11, 2007 12:05 pm
Location: Can bee found antywhere
Score: 210 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby Hblade » Wed Jun 30, 2010 4:50 am

Thanks ^.^
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 180 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby Toasterman » Sat Jul 24, 2010 4:50 am

Very useful! Thanks!
This clears up issues I'd been pretty much been stumped with! :D
"If there are no stupid questions, what kind of questions do stupid people ask? Do they get smart just in time to ask a question? -Scott Adams

Hey! I've got okayish internet now! Now I can try all those cool demos I've seen!
User avatar
Toasterman
 
Posts: 75
Joined: Thu Jul 22, 2010 4:22 am
Location: Drowning in Dial-Up Ocean
Score: 7 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby Orlando911 » Thu Dec 09, 2010 8:38 pm

thank you for the explanation,

I got confused, for the change intimation when the player jump,

just explain this to me plz,

what I know, I have to picture of the player, when playerRight, and PlayerLeft,

I used the playerRight, in the beginning , then when I move it to the left, I want to show the PlayerLeft ,
Orlando911
 
Posts: 84
Joined: Tue Dec 07, 2010 8:18 am
Score: 1 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby skydereign » Thu Dec 09, 2010 11:39 pm

There is a function called ChangeAnimation(). You have to use this on the event that moves the player. These questions are pretty basic, you really should check out the built in tutorials and the tutorials section. They'll give you enough grounding to learn effectively from the forum.
User avatar
skydereign
 
Posts: 3513
Joined: Mon Jul 28, 2008 8:29 am
Score: 588 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby Orlando911 » Fri Dec 10, 2010 8:16 pm

thank u , I got it,

everything clear in the tutorial in the product ,
Orlando911
 
Posts: 84
Joined: Tue Dec 07, 2010 8:18 am
Score: 1 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby happyjustbecause » Wed Aug 03, 2011 3:23 pm

I know this is an old tutorial, but I'm new and trying to get the hang of everything. I got the velocity jump to work, but I'm not sure how to implement both left and right jumping animations . But I had my animation changing when I was walking left and right before, but now it won't. And I'm not completely sure how to do the script editor to allow both animation changes. :mrgreen: :?:

I'm attaching my game in hope of someone checking it out and seeing what is wrong with the animation of walking. I can see it is still there, and when I jump and mess around with the arrowkeys it will occasionally switch to the walking animation. So anyways, any help of this would be greatly appreciated. I'm still learning the ropes, but I hope to get a grasp on the program! I will give a point to anyone that helps if that encourages them at all.
Attachments
Andrewoid.ged
Here it is
(4.75 KiB) Downloaded 330 times
Last edited by happyjustbecause on Thu Aug 04, 2011 3:01 am, edited 2 times in total.
For small creatures such as we the vastness is bearable only through love.
-Carl Sagan

Night Knight Development Thread
User avatar
happyjustbecause
 
Posts: 268
Joined: Tue Jul 26, 2011 3:10 pm
Location: Frazier Park, Ca
Score: 15 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby Hblade » Wed Aug 03, 2011 6:29 pm

OH! Change "FORWARD" in the change animation to "NO_CHANGE"
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 180 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby happyjustbecause » Thu Aug 04, 2011 10:02 pm

Ahhh, Thank you, I was thinking it was probably just something simple. :D

Thanks Again for the tutorial in the first place, and for the added help!
For small creatures such as we the vastness is bearable only through love.
-Carl Sagan

Night Knight Development Thread
User avatar
happyjustbecause
 
Posts: 268
Joined: Tue Jul 26, 2011 3:10 pm
Location: Frazier Park, Ca
Score: 15 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby Hblade » Sat Aug 06, 2011 3:23 am

lol your welcome. did it help? o3o
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 180 Give a positive score

Re: How to do a velocity jump -[Tutorial]-

Postby marcus » Mon Feb 17, 2014 6:46 pm

Hello,

I think this script is awesome, thanks a lot Hblade! But I trying to do a little improve/modification and don't know how to do it: I wish the character gain speed as it falls, especially if you are jumping from a higher platform - it's possible?

I posting my game for example (it is in the very begining, no sprite animations there); use the arrows to move left and right, spacebar to jump. There's some glitches with the colision on plataforms too, but I'm sure there's nothing to do with the script of this thread - but if someone can help, it will be nice! The glitches is: just walk to the right and the character will "climb" the plataforms, no need to jump; if you stop near the edge, the character will move until he falls; and the character can be stuck in the plataform by his (big and weird) hair.



Thanks for the attention and sorry for the bad english,
=]

UPDATE

I think I make it work! Probably it isn't the better code, but is working. First, I declared a variable name tempy, then I added this to Player -> Draw Actor

Code: Select all
if <yvelocity>=0>
{
    tempy=yvelocity;
}
// if the character is ascending, the yvelocity is stored in the tempy variable

if <tempy<=yvelocity>
{
    yvelocity+=0.5;
}
// if your yvelocity starts to decline (the script check this comparing the stored yvelocity with the actual yvelocity), you get down more fast (increasing your yvelocity)
// the 0.5 is a trial-and-error that works best for my case, you should experiment with little increments


=]
Attachments
Preso pelo cabelo.jpg
The charater stuck by hi hair XD
Coco Jumper.zip
(4.99 KiB) Downloaded 267 times
marcus
 
Posts: 9
Joined: Thu Feb 13, 2014 6:39 pm
Score: 0 Give a positive score


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

cron