Page 1 of 1

Jumping

PostPosted: Mon Jul 19, 2010 12:34 am
by Setokyo
When i Jump and go left or right the player Walks?
How to solve :o this

Re: Jumping

PostPosted: Tue Jul 20, 2010 3:51 am
by NUTINC
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?

Re: Jumping

PostPosted: Tue Jul 20, 2010 12:34 pm
by Setokyo
Yea i know how to use

Re: Jumping

PostPosted: Sat Jul 24, 2010 3:36 pm
by Bee-Ant
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

Re: Jumping

PostPosted: Sat Jul 24, 2010 3:50 pm
by krenisis
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.

Re: Jumping

PostPosted: Sat Jul 24, 2010 3:55 pm
by Bee-Ant
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...

Re: Jumping

PostPosted: Sun Jul 25, 2010 1:26 am
by Setokyo
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:

Re: Jumping

PostPosted: Wed Jul 28, 2010 11:25 am
by Camper1995
Look at my game: Crash bandicoot or how its called, I think that princip is used there. :p