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

Non-platform specific questions.

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

Postby Turon » Thu Jun 25, 2015 2:38 pm

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;
}
Attachments
Ged.zip
I've got the .ged if anyone wants it...
(15.84 KiB) Downloaded 157 times
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

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

Postby digiot » Sun Jun 28, 2015 8:55 pm

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 !
User avatar
digiot
 
Posts: 211
Joined: Sat Mar 17, 2012 2:29 pm
Score: 7 Give a positive score

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

Postby knucklecrunchgames » Sun Jun 28, 2015 9:01 pm

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
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

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

Postby digiot » Sun Jun 28, 2015 9:28 pm

@ KCG : So "Turon" is your secret alias ?

OT: How are your Construct projects going ?

Cheers !
User avatar
digiot
 
Posts: 211
Joined: Sat Mar 17, 2012 2:29 pm
Score: 7 Give a positive score

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

Postby knucklecrunchgames » Mon Jun 29, 2015 4:24 am

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.
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

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

Postby Turon » Mon Jun 29, 2015 9:22 am

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: .
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

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

Postby digiot » Mon Jun 29, 2015 12:29 pm

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 !
User avatar
digiot
 
Posts: 211
Joined: Sat Mar 17, 2012 2:29 pm
Score: 7 Give a positive score

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

Postby Turon » Mon Jun 29, 2015 2:19 pm

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;
}
Last edited by Turon on Mon Jun 29, 2015 5:58 pm, edited 1 time in total.
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

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

Postby digiot » Mon Jun 29, 2015 2:59 pm

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.
User avatar
digiot
 
Posts: 211
Joined: Sat Mar 17, 2012 2:29 pm
Score: 7 Give a positive score

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

Postby Turon » Tue Jun 30, 2015 6:25 am

I don't know... either I'm stating the wrong values of comparing the wrong values... what is with those cases?
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

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

Postby knucklecrunchgames » Tue Jun 30, 2015 11:53 am

Oh god. I thought alias meant friends! :oops: :oops: :oops:
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

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

Postby Turon » Tue Jun 30, 2015 12:49 pm

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)).
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

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

Postby steelwil » Sat Jul 04, 2015 5:23 pm

I added constants for the state values and fixed the bug.

Using numbers makes things very confusing as you have to remember their meanings.
Attachments
Ged.zip
(15.99 KiB) Downloaded 151 times
steelwil
 
Posts: 1
Joined: Tue Mar 30, 2010 4:36 pm
Score: 0 Give a positive score

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

Postby Turon » Sat Jul 04, 2015 7:21 pm

Thank's steelwil I'll have a look at it :wink: .
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

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

Postby Turon » Sun Jul 05, 2015 11:28 am

yeah, I never really figured out the whole constant thing... but now I guess I have a better Idea thank's! :)
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron