Perfect Anti-Moonwalk

Game Editor comments and discussion.

Perfect Anti-Moonwalk

Postby Sgt. Sparky » Tue Feb 13, 2007 9:56 pm

:D Here is the Perfect Anti-Moonwalk for people who are having trouble with there guys facing left when they go right ect. .
first: make a var called Left and Make a Var called Right and also a Var called AnimFinish. when the left key is pressed LEft = 1; and Same with the right(only use the Right Var) and o nthe animation finish event have this: AnimFinish = 1; also have that for when the left or right keys are released. :D and on the key down even of left have this script(if you do not want special vars see the middle of the page):

Code: Select all
Left = 1;
if (Left == 1 && Right == 0)
{
    ChangeAnimationDirection("Event Actor", FORWARD);
    xvelocity = - 3;
}
if (Left == 1 && Right == 1)
{
    xvelocity = 0;
}
if(AinimFinish == 1 && Left == 1 && Right == 0)
{
 ChangeAnimation("Event Actor", "KnightLeft1", FORWARD);
 AinimFinish = 0;
}

and for the right key pressed:
Code: Select all
Right = 1;
if (Left == 0 && Right == 1)
{
    ChangeAnimationDirection("Event Actor", FORWARD);
    xvelocity = - 3;
}
if (Left == 1 && Right == 1)
{
    xvelocity = 0;
}
if(AinimFinish == 1 && Left == 0 && Right == 1)
{
 ChangeAnimation("Event Actor", "KnightRight1", FORWARD);
 AinimFinish = 0;
}

remember to have Left and Right at 0 when both keys are up :D I hope that helps.
also for the repeated key down events, without any extra vars exept AnimFinish you could do For the key Right Event:
Code: Select all
char *key=GetKeyState();
if (key[KEY_RIGHT] == 1 && key[KEY_LEFT] == 0)
{
    x += 5;
    if(AnimFinish == 1)
    {
       ChangeAnimation("Event Actor", "KnightRight1", FORWARD);
       AnimFinish = 0;
     }
}
if (key[KEY_RIGHT] == 1 && key[KEY_LEFT] == 1)
{
    ChangeAnimationDirection("Event Actor", FORWARD);
}

and for the repeated left use:
Code: Select all
char *key=GetKeyState();
if (key[KEY_RIGHT] == 0 && key[KEY_LEFT] == 1)
{
    x -= 5;
    if(AnimFinish == 1)
    {
       ChangeAnimation("Event Actor", "KnightLeft1", FORWARD);
       AnimFinish = 0;
       }
}
if (key[KEY_RIGHT] == 1 && key[KEY_LEFT] == 1)
{
    ChangeAnimationDirection("Event Actor", FORWARD);
}

you could also use xvelocity += or -= or = instead of x += or x -=
or x *= or x /= ect.
Last edited by Sgt. Sparky on Mon Feb 19, 2007 5:35 pm, edited 1 time in total.
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Troodon » Fri Feb 16, 2007 4:18 pm

I think that's too complicated way to have just perfect walking left and right with left and right animation. :shock:
I think you can make it lots easier, I'll try to make you a demo in some days. :wink:
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Sgt. Sparky » Fri Feb 16, 2007 8:28 pm

tekdino's Subconscious mind(No offence.) wrote:I think that's too complicated way to have just perfect walking left and right with left and right animation. :shock:
I think you can make it lots easier, I'll try to make you a demo in some days. :wink:

:shock: it is not code for just left and right walking, it is to keep the actor looking the direction He is going,
and it allows you to add sprint stuff alot easier. :D
do you know what moonwalking is?
it is when the actor looks right when he is going left,
that code eliminates that factor. :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Troodon » Fri Feb 16, 2007 10:27 pm

I know what moonwalking is in GE and in real life.
:) I used to delete moonwalking in another way, but I guess this is like you said easier to import sprint stuff.
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Game A Gogo » Fri Feb 16, 2007 11:18 pm

If you take a look in my Mini Cross platform game on the demo page, I think i have the easiest code around it, and (For me) Its very easy to add stuff etc...
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Sgt. Sparky » Sat Feb 17, 2007 3:14 am

well I like mine better :P



:D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Rufus 01 » Mon Feb 19, 2007 5:32 pm

Hmmm... :?

Don't really works by me...
can only run to the right.... :cry:
!!??HELP!!??

€dit: oppps sry I have forget a little bit of the code :roll:
Last edited by Rufus 01 on Mon Feb 19, 2007 6:11 pm, edited 1 time in total.
Was geht'n? =D
Rufus 01
 
Posts: 73
Joined: Sun Aug 27, 2006 9:51 am
Location: Lisbon, Portugal
Score: 3 Give a positive score

Postby Sgt. Sparky » Mon Feb 19, 2007 5:34 pm

That is what the code does, only with animations :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Sgt. Sparky » Sun Feb 25, 2007 3:07 am

Here is some of it with input that you can Add :D
Player -> Draw Actor
Code: Select all
char *key=GetKeyState();
yvelocity += .5;
if(key[KEY_DOWN] == 1)
{
    Roll = 1;
}
if(key[KEY_DOWN] == 0)
{
    Roll = 0;
}
if(key[KEY_DOWN] == 1 && key[KEY_RIGHT] == 0 && key[KEY_LEFT] == 0)
{
    ChangeAnimation("Event Actor", "CL1", STOPPED);
    animpos = 0;
}
if (key[KEY_RIGHT] == 0 && key[KEY_LEFT] == 1)
{
    if(Jump == 0)xvelocity = -5;
    if(Jump == 1 && xvelocity > -5)xvelocity -= 1;
    if(AnimFinish == 1 && Roll == 0)
    {
       ChangeAnimation("Event Actor", "CowBoyLeft2", FORWARD);
       AnimFinish = 0;
    }
    if(AnimFinish == 1 && Roll == 1)
    {
       ChangeAnimation("Event Actor", "CL1", FORWARD);
       AnimFinish = 0;
    }
}
if (key[KEY_RIGHT] == 1 && key[KEY_LEFT] == 0)
{
    if(Jump == 0)xvelocity = 5;
    if(Jump == 1 && xvelocity < 5)xvelocity += 1;
    if(AnimFinish == 1 && Roll == 0)
    {
       ChangeAnimation("Event Actor", "CowBoyRight2", FORWARD);
       AnimFinish = 0;
    }
    if(AnimFinish == 1 && Roll == 1)
    {
       ChangeAnimation("Event Actor", "CR1", FORWARD);
       AnimFinish = 0;
    }
}
if (key[KEY_RIGHT] == 1 && key[KEY_LEFT] == 1)
{
    ChangeAnimationDirection("Event Actor", STOPPED);
}
if (key[KEY_RIGHT] == 0 && key[KEY_LEFT] == 0)
{
    ChangeAnimationDirection("Event Actor", STOPPED);
}
if(key[KEY_UP] == 1 && Jump == 0)
{
    yvelocity = - 10;
    Jump = 1;
    PlaySound2("data/SpringishSound2.wav", 0.466667, 1, 0.000000);
}

:D
only 60 lines
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby ulrichxyco » Fri Apr 06, 2007 6:16 pm

I'm still having a problem with the 'moonwalking' even if I enter the codes above. Could somebody help me please. I'm just a newbie in GE.
ulrichxyco
 
Posts: 1
Joined: Thu Apr 05, 2007 3:42 pm
Score: 0 Give a positive score

Postby Sgt. Sparky » Fri Apr 06, 2007 9:48 pm

e-mail me the project to my hotmail :D
(.ged and data files)
I Will see what I can do :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby pavel329 » Sat Jul 28, 2007 10:42 am

great codes.thanks sparky.
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby Sgt. Sparky » Sat Jul 28, 2007 5:17 pm

you are welcome. :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Re: Perfect Anti-Moonwalk

Postby jagheera nex » Sat Sep 08, 2007 9:45 pm

i know a way of an anti moonwalk but i don't know how to make it in a script, if u can make the actor flip horrizontily ull need half of the animations and no moonwalk
User avatar
jagheera nex
 
Posts: 46
Joined: Sat Jul 28, 2007 4:13 pm
Location: dik
Score: 1 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron