Jumping

Non-platform specific questions.

Jumping

Postby Setokyo » Mon Jul 19, 2010 12:34 am

When i Jump and go left or right the player Walks?
How to solve :o this
Laws control the lesser man. Right conduct controls the greater one

"I'd rather be hated for who I am than loved for who I am not
User avatar
Setokyo
 
Posts: 85
Joined: Fri Jul 09, 2010 1:52 am
Location: Holetown barbados
Score: 3 Give a positive score

Re: Jumping

Postby NUTINC » Tue Jul 20, 2010 3:51 am

What's going on is the animation of your walking is going off. You'll need to use a variable to make it so that the animations are different while in the air than while walking. Do you know how to make variables?
To those of you out there, I am not dead. I am a ghost! There is a difference!
Currently Working on: Parts, A self-assembling adventure
User avatar
NUTINC
 
Posts: 98
Joined: Fri Feb 09, 2007 1:06 am
Location: Lost in the deep dark recesses of my mind, wondering why the exit sign leads to brick wall
Score: 6 Give a positive score

Re: Jumping

Postby Setokyo » Tue Jul 20, 2010 12:34 pm

Yea i know how to use
Laws control the lesser man. Right conduct controls the greater one

"I'd rather be hated for who I am than loved for who I am not
User avatar
Setokyo
 
Posts: 85
Joined: Fri Jul 09, 2010 1:52 am
Location: Holetown barbados
Score: 3 Give a positive score

Re: Jumping

Postby Bee-Ant » Sat Jul 24, 2010 3:36 pm

Basically :

Player -> Keydown -> Right -> ScriptEditor :
Code: Select all
if(canjump==1) //variable to define his jumping status
{
    ChangeAnimation("Event Actor", "WalkRight", NO_CHANGE);
}
if(canjump==0) //when in air
{
    ChangeAnimation("Event Actor", "JumpRight", NO_CHANGE);
}
x+=3;

Player -> Keydown -> Left -> ScriptEditor :
Code: Select all
if(canjump==1) //variable to define his jumping status
{
    ChangeAnimation("Event Actor", "WalkLeft", NO_CHANGE);
}
if(canjump==0) //when in air
{
    ChangeAnimation("Event Actor", "JumpLeft", NO_CHANGE);
}
x-=3;

That way, your player will change his movement animation according to his jumping status...walk animation when not jumping, and jump animation when jumping. :D
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Jumping

Postby krenisis » Sat Jul 24, 2010 3:50 pm

Oh snap bee-ant that needs to be addded to the jumping tutorial. Later I will add it and say code was from you. Thanks bee-ant.
Tutorial Database for all beginners click this link
viewtopic.php?f=4&t=8680
krenisis
 
Posts: 606
Joined: Sat Jul 25, 2009 3:27 pm
Score: 51 Give a positive score

Re: Jumping

Postby Bee-Ant » Sat Jul 24, 2010 3:55 pm

It's just for the movement code only, for the rest code lookie here...

Player -> KeyDown -> KeyToJump -> ScriptEditor :
Code: Select all
if(canjump==1)
{
    yvelocity=-15;
    if(right==1) //facing right
    {
        ChangeAnimation("Event Actor", "JumpRight", FORWARD);
    }
    if(right==0) //facing left
    {
        ChangeAnimation("Event Actor", "JumpLeft", FORWARD);
    }
    canjump=0;
}


Player -> Collision -> Top side of Ground -> Script Editor :
Code: Select all
if(canjump==0)
{
    if(right==1) //facing right
    {
        ChangeAnimation("Event Actor", "StopRight", FORWARD);
    }
    if(right==0) //facing left
    {
        ChangeAnimation("Event Actor", "StopLeft", FORWARD);
    }
    canjump=1;
}


Player -> Draw Actor -> Script Editor :
Code: Select all
if(yvelocity<=-3||yvelocity>=3)
{
    if(right==1) //facing right
    {
        ChangeAnimation("Event Actor", "JumpRight", NO_CHANGE);
    }
    if(right==0) //facing left
    {
        ChangeAnimation("Event Actor", "JumpLeft", NO_CHANGE);
    }
    canjump=0;
}

Kinda long??? yes they're...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Jumping

Postby Setokyo » Sun Jul 25, 2010 1:26 am

O ok
thanks
can you tell me what's going on in the code tho
I seeing it
but not everything is going to the brain :twisted:
Laws control the lesser man. Right conduct controls the greater one

"I'd rather be hated for who I am than loved for who I am not
User avatar
Setokyo
 
Posts: 85
Joined: Fri Jul 09, 2010 1:52 am
Location: Holetown barbados
Score: 3 Give a positive score

Re: Jumping

Postby Camper1995 » Wed Jul 28, 2010 11:25 am

Look at my game: Crash bandicoot or how its called, I think that princip is used there. :p
Say hello to my little friend.
User avatar
Camper1995
 
Posts: 707
Joined: Tue Dec 30, 2008 7:20 pm
Location: Lost in the past.
Score: 44 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest