How do you jump normal?

Game Editor comments and discussion.

How do you jump normal?

Postby supa-tails » Fri Jul 27, 2007 3:22 pm

I know alot of scripts, but how do you make a good script for jumping up and down without the ability to jump infinitly? Also, I am making a game where you play as Tails(A two tailed flying fox) and how can I put a limit to how high he goes before he gets tired and slowly descends?
Attachments
Shot From SupaTails.PNG
................................................................................................ www.freewebs.com/thebiverse .....................................................................................




c'ya on the other side
User avatar
supa-tails
 
Posts: 269
Joined: Fri Jul 27, 2007 3:03 pm
Location: In an aliens tummy... Or in cumming Georgia USA
Score: 17 Give a positive score

Postby d-soldier » Fri Jul 27, 2007 3:38 pm

Welcome to the forum! Keep in mind that most issues you will run into when starting have most likely been addressed in the past, and probably more then once. So try using the search button:

Most of your question can be answered here:
http://game-editor.com/forum/viewtopic. ... light=jump

As far as tails being able to slowly hover down after a jump, you will need to set up a variable.
His normal draw actor script should have something like:

yvelocity += .8;
if(yvelocity > 20) yvelocity = 20;

which acts as gravity pulling him down. If you were to setup a variable called "float" and set it to your jump key:
Keydown event:
float=1;
KeyUp event:
float=0;
then you would have to find the optimum time to check if the key is down (after the jump animation is done?)/??
And the new draw actor script would be something like:
if (float==0)
{
yvelocity += .8;
if(yvelocity > 20) yvelocity = 20;
}
if (float==1 && canjump==0)
{
yvelocity += .2;
if(yvelocity > 20) yvelocity = 20;
}

- which has normal gravity all the time, except when you are not in contact with the ground and the jump key is held down... this of course after you script everything as it is in the first link I posted. Hope this helped.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby supa-tails » Fri Jul 27, 2007 4:26 pm

Thank you so much! But, I read the view topic thingie and it said to Click up on SCRIPT menubar, then add an actor variable called "canjump".
What is the actor variable and how do you add one :?:
Attachments
Shot From SupaTails2.PNG
................................................................................................ www.freewebs.com/thebiverse .....................................................................................




c'ya on the other side
User avatar
supa-tails
 
Posts: 269
Joined: Fri Jul 27, 2007 3:03 pm
Location: In an aliens tummy... Or in cumming Georgia USA
Score: 17 Give a positive score

Postby d-soldier » Fri Jul 27, 2007 4:39 pm

Click up on SCRIPT, then GLOBAL CODE, then the button on the bottom right which says "VARIABLES" click "ADD", put "float" in the NAME box, then CLICK "ADD".
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby supa-tails » Fri Jul 27, 2007 4:57 pm

Oh my gosh! Thank you! You solved my ultimate problem in GE so far, now I can make a worthy Tails game!!! :D :D :D
................................................................................................ www.freewebs.com/thebiverse .....................................................................................




c'ya on the other side
User avatar
supa-tails
 
Posts: 269
Joined: Fri Jul 27, 2007 3:03 pm
Location: In an aliens tummy... Or in cumming Georgia USA
Score: 17 Give a positive score

Postby Game A Gogo » Fri Jul 27, 2007 11:58 pm

welcome to the forum, hehe, I love the over-sized chaos emeralds ;)
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby pavel329 » Sat Jul 28, 2007 1:32 pm

this is good.
it worked well for me.
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby supa-tails » Sun Jul 29, 2007 12:57 pm

Oh, and just a little thing I discovered, it wont let you put float because there is already a variable named that so you have too put floater. And once again, thank you so much for the help. :D
................................................................................................ www.freewebs.com/thebiverse .....................................................................................




c'ya on the other side
User avatar
supa-tails
 
Posts: 269
Joined: Fri Jul 27, 2007 3:03 pm
Location: In an aliens tummy... Or in cumming Georgia USA
Score: 17 Give a positive score

Postby Game A Gogo » Sun Jul 29, 2007 11:32 pm

supa-tails wrote:Oh, and just a little thing I discovered, it wont let you put float because there is already a variable named that so you have too put floater. And once again, thank you so much for the help. :D


its not that its a variable, its a function to declare a variable inside a script (Actor variable, and can only be used inside the script) like
Code: Select all
float MyVar=1.0123
Floats has only 4 decimal places and double is like float but whit greater precision, twice as big. but I'm not sure about htis in GE, i think its the same :O
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Sgt. Sparky » Mon Jul 30, 2007 3:04 am

Game A Gogo wrote:
supa-tails wrote:
Code: Select all
float MyVar=1.0123
Floats has only 4 decimal places

I have used it with alot more decimal places than that and printed them onto a text actor and it came up with the exact numbers I started with. :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Fuzzy » Mon Jul 30, 2007 4:51 am

float is a 16 bit floating point number. the number of decimal places that it will display are not limited to 4 or even 16, but rather, the precision of the number can suffer when its really big or has a really small portion.

A double on the other hand is 32 bit, so its math is a lot more precise.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron