CanJump problem

Non-platform specific questions.

CanJump problem

Postby MrJolteon » Wed Nov 11, 2009 10:17 am

How can I use the CanJump function?
I use a code already, but it don't work:
On player\draw actor i have this code:
Code: Select all
if(canyoujump==1)
{
 yvelocity-8;
}
if(canyoujump==0)
{
 yvelocity-0;
}
and on player\key down space I have
Code: Select all
if(canyoujump==1)
{
 yvelocity-8;
 canyoujump=0;
}
else
{
 yvelocity-0;
}
and on collision I have
Code: Select all
canyoujump=1;
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_SPECIFIED_MASS, 1.000000, 1.000000, 0.010000, 1.000000);
What did I do wrong?
Join us on Discord!
Game Editor 2
These are the best ways to reach me these days


Your local Community Janitor, always lurking in the shadows...
User avatar
MrJolteon
 
Posts: 2326
Joined: Sat Aug 09, 2008 3:25 pm
Location: Stranded under endless sky
Score: 105 Give a positive score

Re: CanJump problem

Postby skydereign » Wed Nov 11, 2009 12:30 pm

You don't set yvelocity equal to anything, you simply subtract. To do anything at all you need the equal sign, otherwise you are not setting the variable. Something else to note is that you put in extra code, which you probably did when trying to fix your problem, the following should work.
player -> keydown space -> script editor
Code: Select all
if(canyoujump==1)
{
    yvelocity=-8;
    canyoujump=0;
}


player -> collision (ground) -> script editor
Code: Select all
canyoujump=1;
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_SPECIFIED_MASS, 1.000000, 1.000000, 0.010000, 1.000000);
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: CanJump problem

Postby MrJolteon » Mon Aug 23, 2010 6:45 am

Thx worked now except that the player actor jumped only 8 px up in the air.
Join us on Discord!
Game Editor 2
These are the best ways to reach me these days


Your local Community Janitor, always lurking in the shadows...
User avatar
MrJolteon
 
Posts: 2326
Joined: Sat Aug 09, 2008 3:25 pm
Location: Stranded under endless sky
Score: 105 Give a positive score

Re: CanJump problem

Postby MrJolteon » Mon Aug 23, 2010 6:46 am

I need some help with fixing the problem in the post above this one
Join us on Discord!
Game Editor 2
These are the best ways to reach me these days


Your local Community Janitor, always lurking in the shadows...
User avatar
MrJolteon
 
Posts: 2326
Joined: Sat Aug 09, 2008 3:25 pm
Location: Stranded under endless sky
Score: 105 Give a positive score

Re: CanJump problem

Postby DilloDude » Mon Aug 23, 2010 7:14 am

On DrawActor you need to increase the yvelocity:
Code: Select all
yvelocity += 1;//or some other value
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: CanJump problem

Postby MrJolteon » Mon Aug 23, 2010 7:33 am

thx
Join us on Discord!
Game Editor 2
These are the best ways to reach me these days


Your local Community Janitor, always lurking in the shadows...
User avatar
MrJolteon
 
Posts: 2326
Joined: Sat Aug 09, 2008 3:25 pm
Location: Stranded under endless sky
Score: 105 Give a positive score

Re: CanJump problem

Postby lcl » Mon Aug 23, 2010 12:11 pm

Btw, you'd better use shorter variable names, it's easier to use. :D
Like, just "jump", 'cause "canyoujump" takes a lot more writing... :lol:
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: CanJump problem

Postby MrJolteon » Mon Aug 23, 2010 12:20 pm

I use "ALTjump" instead of "canyoujump" now
Join us on Discord!
Game Editor 2
These are the best ways to reach me these days


Your local Community Janitor, always lurking in the shadows...
User avatar
MrJolteon
 
Posts: 2326
Joined: Sat Aug 09, 2008 3:25 pm
Location: Stranded under endless sky
Score: 105 Give a positive score

Re: CanJump problem

Postby lcl » Mon Aug 23, 2010 6:04 pm

Ok...
But why ALT..? :lol:
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: CanJump problem

Postby MrJolteon » Tue Aug 24, 2010 7:51 am

Because I use it in the game i'm currently working on named ALTer(you need to use the ALT keys in that game(that explains the name ALTer))
Join us on Discord!
Game Editor 2
These are the best ways to reach me these days


Your local Community Janitor, always lurking in the shadows...
User avatar
MrJolteon
 
Posts: 2326
Joined: Sat Aug 09, 2008 3:25 pm
Location: Stranded under endless sky
Score: 105 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest