Page 1 of 2

Game Editor Favors Left over Right (Déjá vu)

PostPosted: Thu Jun 25, 2015 2:38 pm
by Turon
Sorry for the repetitive title but this seems to be a never ending issue for me...
you can jump left no problem it displays the correct animation, and you can jump right no problem and it will still display the correct animation, however if you jump without pressing any directional keys while in a right position the player will proceed to jump jump however it will not play out the jump right animation and will stay in a standing position until the falling animation kicks in...

This reminds me of something..
Here is the Code:

Keydown Left
Code: Select all
switch(STATE)
{
    case 0:
    ChangeAnimation("Event Actor", "StillLeft", NO_CHANGE);
    STATE=1;
    break;
 
    case 1:
    ChangeAnimation("Event Actor", "MoveLeft", NO_CHANGE);
    STATE=3;
    break;
 
    case 2:
    ChangeAnimation("Event Actor", "StillLeft", NO_CHANGE);
    STATE=1;
    break;
 
    case 3:
    break;
 
    case 4:
    ChangeAnimation("Event Actor", "JumpLeft", NO_CHANGE);
    STATE=5;
    break;
 
    case 5:
    break;
 
    case 6:
    ChangeAnimation("Event Actor", "FallLeft", NO_CHANGE);
    STATE=7;
    break;
 
    case 7:
    break;
}
x-=3;


Keydown Right
Code: Select all
switch(STATE)
{
    case 0:
    ChangeAnimation("Event Actor", "MoveRight", NO_CHANGE);
    STATE=2;
    break;
 
    case 1:
    ChangeAnimation("Event Actor", "StillRight", NO_CHANGE);
    STATE=0;
    break;
 
    case 2:
    break;
 
    case 3:
    ChangeAnimation("Event Actor", "StillRight", NO_CHANGE);
    STATE=0;
    break;
 
    case 4:
    break;
 
    case 5:
    ChangeAnimation("Event Actor", "JumpRight", NO_CHANGE);
    STATE=4;
    break;
}
x+=3;


Keydown X (Jump Key)
Code: Select all
switch(STATE)
{
    case 0:
    ChangeAnimation("Even Actor", "JumpRight", NO_CHANGE);
    yvelocity=-10;
    STATE=4;
    break;
 
    case 1:
    ChangeAnimation("Event Actor", "JumpLeft", NO_CHANGE);
    yvelocity=-10;
    STATE=5;
    break;
 
    case 2:
    ChangeAnimation("Event Actor", "JumpRight", NO_CHANGE);
    yvelocity=-10;
    STATE=4;
    break;
 
    case 3:
    ChangeAnimation("Event Actor", "JumpLeft", NO_CHANGE);
    yvelocity=-10;
    STATE=5;
    break;
 
    case 4:
    break;
 
    case 5:
    break;
 
    case 6:
    break;
 
    case 7:
    break;
}


KeyUp Left
Code: Select all
switch(STATE)
{
    case 0:
    break;
 
    case 1:
    break;
 
    case 2:
    break;
 
    case 3:
    ChangeAnimation("Event Actor", "StillLeft", NO_CHANGE);
    STATE=1;
    break;
 
    case 4:
    break;
}
 


KeyUp Right
Code: Select all
switch(STATE)
{
    case 0:
    break;
 
    case 2:
    ChangeAnimation("Event Actor", "StillRight", NO_CHANGE);
    STATE=0;
    break;
 
    case 1:
    break;
 
    case 3:
    break;
 
    case 4:
    break;
 
    case 5:
    break;
 
    case 6:
    break;
 
    case 7:
    break;
}

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Sun Jun 28, 2015 8:55 pm
by digiot
Your incredible messy use of the state-var makes me wonder, how anything is
working at all !

If you have such a complex set of animations, it is better, you use different
state-vars for the actions, eg. one state for the directions, one for the moves,
one for the jumps, etc.
In the switch-cases, you have to combine the states with logical and(&&) then.

Annother point again, you can name your vars like you want, but using only capital
letters is common for CONSTANTS.


Cheers !

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Sun Jun 28, 2015 9:01 pm
by knucklecrunchgames
digiot wrote:Your incredible messy use of the state-var makes me wonder, how anything is
working at all !

If you have such a complex set of animations, it is better, you use different
state-vars for the actions, eg. one state for the directions, one for the moves,
one for the jumps, etc.
In the switch-cases, you have to combine the states with logical and(&&) then.

Annother point again, you can name your vars like you want, but using only capital
letters is common for CONSTANTS.


Cheers !


cheers to you as well! What's the occasion? :lol: :P

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Sun Jun 28, 2015 9:28 pm
by digiot
@ KCG : So "Turon" is your secret alias ?

OT: How are your Construct projects going ?

Cheers !

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Mon Jun 29, 2015 4:24 am
by knucklecrunchgames
digiot wrote:@ KCG : So "Turon" is your secret alias ?

OT: How are your Construct projects going ?

Cheers !


Everyone on this site is my alias. :)

And I currently have one game on the playstore made with construct 2.

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Mon Jun 29, 2015 9:22 am
by Turon
Okay so I should make multiple variables to regulate different actions as apposed to making one state for all actions?
-Edit-
Ah I get it! one variable for the animations and another for the actions?
digiot wrote:Another point again, you can name your vars like you want, but using only capital
letters is common for CONSTANTS.

um, what is a CONSTANT?
knucklecrunchgames wrote:
digiot wrote:@ KCG : So "Turon" is your secret alias ?

OT: How are your Construct projects going ?

Cheers !


Everyone on this site is my alias. :)

And I currently have one game on the playstore made with construct 2.

Ha ha ha :lol: ... I hope you were joking :shock: .

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Mon Jun 29, 2015 12:29 pm
by digiot
KCG wrote:Everyone on this site is my alias.

Then you and me are the only people posting here, wow !
KCG wrote:And I currently have one game on the playstore made with construct 2.

As a "Shawn, the Sheep"-fan, I have to say, your very worse one !
Starting from counting sheeps, what is not bad at all, you turned into a
butcher, cutting off their heads and legs and tails, and then throwing their
bodys down from the sky, to shoot at them !
What an evil massacre !
Turon wrote:Okay so I should make multiple variables to regulate different actions
as apposed to making one state for all actions?

If there are enough animations to get puzzled with, yes.
And don't take "state" as the name, it's just the purpose it has. Name the
state-vars eg. direction, move, jump, whatever is matching the animation.
Imagine, you can have several different animations for every such state !
Eg. for an human player sprite, you quickly have one or two dozens animations
for each direction !
Turon wrote:um, what is a CONSTANT?

It's a kind of frozen variable.
Every number and character is a constant, but for your convenience, you
can name them. A popular example is the number PI, and every number and
string keeping the same content over the whole program.

I hope this helps a little.


Cheers !

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Mon Jun 29, 2015 2:19 pm
by Turon
I'm trying to break it up a bit, "Move" is the variable for walking but I'm not getting the right animations to display, I'm quite in the dark...
Keydown Left
Code: Select all
switch(Move)
{
    case 0:
    ChangeAnimation("Event Actor", "StillLeft", NO_CHANGE);
    Move=1;
    break;
 
    case 1:
//  ChangeAnimation("Event Actor", "StillRight", NO_CHANGE);
//  Move=2;
    break;
 
    case 2:
    ChangeAnimation("Event Actor", "MoveLeft", NO_CHANGE);
    Move=3;
    break;

    case 3:
//  ChangeAnimation("Event Actor", "MoveRight", NO_CHANGE);
//  Move=0;
    break;
}
x-=3;

Keydown Right
Code: Select all
switch(Move)
{
    case 0:
//  ChangeAnimation("Event Actor", "StillLeft", NO_CHANGE);
//  Move=1;
    break;
 
    case 1:
    ChangeAnimation("Event Actor", "StillRight", NO_CHANGE);
    Move=2;
    break;
 
    case 2:
//  ChangeAnimation("Event Actor", "MoveLeft", NO_CHANGE);
//  Move=3;
    break;
 
    case 3:
    ChangeAnimation("Event Actor", "MoveRight", NO_CHANGE);
    Move=0;
    break;
}
x+=3;

KeyUp Left
Code: Select all
switch(Move)
{
    case 0:
    ChangeAnimation("Event Actor", "StillLeft", NO_CHANGE);
    Move=1;
    break;
 
    case 1:
//  ChangeAnimation("Event Actor", "StillRight", NO_CHANGE);
//  Move=2;
    break;
 
    case 2:
//  ChangeAnimation("Event Actor", "MoveLeft", NO_CHANGE);
//  Move=3;
    break;
 
    case 3:
//  ChangeAnimation("Event Actor", "MoveRight", NO_CHANGE);
//  Move=0;
    break;
}

KeyUp Right
Code: Select all
switch(Move)
{
    case 0:
//  ChangeAnimation("Event Actor", "StillLeft", NO_CHANGE);
//  Move=1;
    break;
 
    case 1:
    ChangeAnimation("Event Actor", "StillRight", NO_CHANGE);
    Move=2;
    break;
 
    case 2:
//  ChangeAnimation("Event Actor", "MoveLeft", NO_CHANGE);
//  Move=3;
    break;
 
    case 3:
//  ChangeAnimation("Event Actor", "MoveRight", NO_CHANGE);
//  Move=0;
    break;
}

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Mon Jun 29, 2015 2:59 pm
by digiot
For the animations being still the same, you don't have to do anything.
You just have to change the animations, when you are changing the direction,
or jumping or falling.
And that you have to express with the appropriate state-vars and switch blocks.

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Tue Jun 30, 2015 6:25 am
by Turon
I don't know... either I'm stating the wrong values of comparing the wrong values... what is with those cases?

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Tue Jun 30, 2015 11:53 am
by knucklecrunchgames
Oh god. I thought alias meant friends! :oops: :oops: :oops:

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Tue Jun 30, 2015 12:49 pm
by Turon
I think I don't quite understand the switch thing yet :( .
knucklecrunchgames wrote:Oh god. I thought alias meant friends! :oops: :oops: :oops:

Hahaha... I thought alias mean't something like a pseudonym, in other words you and me have the same person behind our usernames knucklecrunchgames and Turon.
as that theory goes we are the same person which is by the way False (Though we do have some similarities the most obvious being we are both (most likely) Humans otherwise known as "Homo Sapiens" (one of us could be an extraterrestrial but that is less likely)).

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Sat Jul 04, 2015 5:23 pm
by steelwil
I added constants for the state values and fixed the bug.

Using numbers makes things very confusing as you have to remember their meanings.

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Sat Jul 04, 2015 7:21 pm
by Turon
Thank's steelwil I'll have a look at it :wink: .

Re: Game Editor Favors Left over Right (Déjá vu)

PostPosted: Sun Jul 05, 2015 11:28 am
by Turon
yeah, I never really figured out the whole constant thing... but now I guess I have a better Idea thank's! :)