The perfect Anti moonwalk for RPG's Version 1.2

You must understand the Game Editor concepts, before post here.

The perfect Anti moonwalk for RPG's Version 1.2

Postby Hblade » Thu Feb 11, 2010 4:42 pm

UPDATES:
Allow only 4 way movement
Wall Collision

Hey guys, I've finally did it! no moonwalk, no glitches, the perfect anti-moonwalk for RPG games :) First, make your player, add event ->Draw Actor -> Script Editor, and put this script in.

First, make a variable called STATE, then place this code in Draw Actor
Code: Select all
char *key=GetKeyState();

if (key[KEY_UP] == 1 && key[KEY_DOWN] == 0){
    if (STATE!=90){
        if (STATE!=10){
        STATE = 10;
        ChangeAnimation("Event Actor", "WalkUp", FORWARD);
                  }
    y-=3;
                  }
    if (STATE == 90){
        ChangeAnimation("Event Actor", "StandingUp", FORWARD);
                    }
                                           }
if (key[KEY_UP] == 0 && key[KEY_DOWN] == 1){
    if (STATE!=91){
        if (STATE!=11){
        STATE = 11;
        ChangeAnimation("Event Actor", "WalkingDown", FORWARD);
                  }
    y+=3;
                  }
    if (STATE == 91){
           ChangeAnimation("Event Actor", "StandingDown", FORWARD);
                       }
                                           }
if (key[KEY_LEFT] == 1 && key[KEY_RIGHT] == 0 && key[KEY_UP] == 0 && key[KEY_DOWN] == 0){
    if (STATE!=92){
        if (STATE!=12){
        STATE = 12;
        ChangeAnimation("Event Actor", "WalkingLeft", FORWARD);
                  }
                  x-=3;
                  }
                  if (STATE == 92){
                      ChangeAnimation("Event Actor", "StandingLeft", FORWARD);
                                  }
                                              }
if (key[KEY_LEFT] == 0 && key[KEY_RIGHT] == 1 && key[KEY_UP] == 0 && key[KEY_DOWN] == 0){
    if (STATE!=93){
        if (STATE!=13){
        STATE = 13;
        ChangeAnimation("Event Actor", "WalkRight", FORWARD);
                  }
                  x+=3;
                  }
                  if (STATE == 93){
                      ChangeAnimation("Event Actor", "StandingRight", FORWARD);
                                  }
                                              }
if (key[KEY_UP] == 1 && key[KEY_DOWN] == 1 && STATE == 10){
    STATE = 40;
                                                          }
if (key[KEY_UP] == 1 && key[KEY_DOWN] == 1 && STATE == 11){
    STATE = 41;
                                                          }
if (key[KEY_LEFT] == 1 && key[KEY_RIGHT] == 1 && STATE == 12){
    STATE = 42;
                                                             }
if (key[KEY_LEFT] == 1 && key[KEY_RIGHT] == 1 && STATE == 13){
    STATE = 43;
                                                             }
if (STATE == 40){
    ChangeAnimation("Event Actor", "StandingUp", FORWARD);
                }
if (STATE == 41){
    ChangeAnimation("Event Actor", "StandingDown", FORWARD);
                }
if (STATE == 42){
    ChangeAnimation("Event Actor", "StandingLeft", FORWARD);
                }
if (STATE == 43){
    ChangeAnimation("Event Actor", "StandingRight", FORWARD);
                }


There you have it! I'm enhancing it as well so keep looking for the updates

Here's an Example of Version 1.2
Example.zip
(140.25 KiB) Downloaded 83 times
Last edited by Hblade on Thu Feb 11, 2010 5:07 pm, edited 2 times in total.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4381
Joined: Fri Dec 08, 2006 11:14 pm
Score: 170 Give a positive score

Re: The perfect Anti moonwalk for RPG's (Get code here)

Postby MrJolteon » Thu Feb 11, 2010 4:59 pm

Sweet.
Owner of the #GameEditor IRC channel at esper.net
User avatar
MrJolteon
 
Posts: 1940
Joined: Sat Aug 09, 2008 3:25 pm
Location: Fifth Layer
Score: 76 Give a positive score

Re: The perfect Anti moonwalk for RPG's (Get code here)

Postby Hblade » Thu Feb 11, 2010 4:59 pm

Thanks :D Updated
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4381
Joined: Fri Dec 08, 2006 11:14 pm
Score: 170 Give a positive score

Re: The perfect Anti moonwalk for RPG's Version 1.2

Postby Bee-Ant » Thu Feb 11, 2010 8:35 pm

Thats pretty long...and too much of IF on draw actor. Thats bad for performance.
I have a simpler version

- make integer variables : "direct", "walk", "anim"
- player-DrawActor :
Code: Select all
if(walk==1){
if(direct==0){
y-=3;
if(anim==0){ChangeAnimation("Event Actor","walk_up",FORWARD);anim=1;}}
if(direct==1){
x+=3;
if(anim==0){ChangeAnimation("Event Actor","walk_right",FORWARD);anim=1;}}
if(direct==2){
y+=3;
if(anim==0){ChangeAnimation("Event Actor","walk_down",FORWARD);anim=1;}}
if(direct==3){
x-=3;
if(anim==0){ChangeAnimation("Event Actor","walk_left",FORWARD);anim=1;}}}

- player-Keydown :
Code: Select all
direct=0; //for up key
//or
direct=1; //for right key
walk=1;

- player-Keyup :
Code: Select all
walk=0;
//add the stop animation depend on direct value here

- player-AnimationFinish :
Code: Select all
anim=0;


This is my standard method. Used on most my game, as well as Winter Blast
User avatar
Bee-Ant
 
Posts: 3696
Joined: Wed Apr 11, 2007 12:05 pm
Location: Can bee found antywhere
Score: 209 Give a positive score

Re: The perfect Anti moonwalk for RPG's Version 1.2

Postby Hblade » Thu Feb 11, 2010 8:52 pm

Yes but your method does have one moonwalk glitch. If you press a key before his animation is done he will float in that direction for a few frames before he switches his animation :P It's still nice for such a small script :D congrats bee :)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4381
Joined: Fri Dec 08, 2006 11:14 pm
Score: 170 Give a positive score

Re: The perfect Anti moonwalk for RPG's Version 1.2

Postby Bee-Ant » Thu Feb 11, 2010 9:06 pm

Ohh...that one. its easy to fix.
Maybe something like this :
Player-Keydown-Up
Code: Select all
direct=0;
walk=1;
ChangeAnimation("Event Actor","walk up",NO_CHANGE);

Etc for the other keydown, but
Dunno...
Im away of computer :P
User avatar
Bee-Ant
 
Posts: 3696
Joined: Wed Apr 11, 2007 12:05 pm
Location: Can bee found antywhere
Score: 209 Give a positive score

Re: The perfect Anti moonwalk for RPG's Version 1.2

Postby Hblade » Thu Feb 11, 2010 9:33 pm

k :D Anyways hope the script comes in handy for people :)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4381
Joined: Fri Dec 08, 2006 11:14 pm
Score: 170 Give a positive score

Re: The perfect Anti moonwalk for RPG's Version 1.2

Postby Bee-Ant » Fri Feb 12, 2010 3:38 am

Im not going to fix and publish it...
User avatar
Bee-Ant
 
Posts: 3696
Joined: Wed Apr 11, 2007 12:05 pm
Location: Can bee found antywhere
Score: 209 Give a positive score

Re: The perfect Anti moonwalk for RPG's Version 1.2

Postby Hblade » Fri Feb 12, 2010 2:09 pm

Oh :(... your script is much simpler though :O, Anyways, BeeAnt, any idea how I can make a 1-grid movement system with this script? :D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4381
Joined: Fri Dec 08, 2006 11:14 pm
Score: 170 Give a positive score

Re: The perfect Anti moonwalk for RPG's Version 1.2

Postby thunderios » Fri Feb 12, 2010 2:57 pm

If you use Bee-Ant's script, you might want to click on 'wait for frame action' when you click add, that way it will only walk the way you want when the animation is finished, right?
thunderios
 
Posts: 87
Joined: Thu Jan 31, 2008 1:18 pm
Score: 1 Give a positive score

Re: The perfect Anti moonwalk for RPG's Version 1.2

Postby Bee-Ant » Fri Feb 12, 2010 3:03 pm

Hblade wrote:Oh :(... your script is much simpler though :O

:D
I'm not Mr. nice guy who will publish his code to everyone (only for certain people)
I'm wicked :(

HBlade wrote:Anyways, BeeAnt, any idea how I can make a 1-grid movement system with this script? :D

Talking about pokemon huh???
Im also going to use that system for the new Winter Blast :P

It may be :
1. Remove the KeyUp event
2. Add this code to the AnimationFinish
Code: Select all
walk=0;

3. Add this code to Draw Actor
Code: Select all
if(walk==0)
{
if(direct==0)ChangeAnimation("Event Actor", "stop up",FORWARD);
if(direct==1)ChangeAnimation("Event Actor", "stop right",FORWARD);
if(direct==2)ChangeAnimation("Event Actor", "stop down",FORWARD);
if(direct==3)ChangeAnimation("Event Actor", "stop left",FORWARD);
}
User avatar
Bee-Ant
 
Posts: 3696
Joined: Wed Apr 11, 2007 12:05 pm
Location: Can bee found antywhere
Score: 209 Give a positive score

Re: The perfect Anti moonwalk for RPG's Version 1.2

Postby Hblade » Fri Feb 12, 2010 5:49 pm

Hey nice bee O.O
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4381
Joined: Fri Dec 08, 2006 11:14 pm
Score: 170 Give a positive score

Re: The perfect Anti moonwalk for RPG's Version 1.2

Postby Bee-Ant » Fri Feb 12, 2010 6:22 pm

Really? I havent tested it yet.
Also, edit your Keydown event to :
Code: Select all
if(walk==0){
direct=yourdirectvalue;
walk=1;}

To avoid a direct turn.

The next job is how you adjust your walking animation to be finished in 1 tile lenght.

Good luck :D
User avatar
Bee-Ant
 
Posts: 3696
Joined: Wed Apr 11, 2007 12:05 pm
Location: Can bee found antywhere
Score: 209 Give a positive score

Re: The perfect Anti moonwalk for RPG's Version 1.2

Postby Hblade » Fri Feb 12, 2010 6:59 pm

Thanks :D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4381
Joined: Fri Dec 08, 2006 11:14 pm
Score: 170 Give a positive score

Re: The perfect Anti moonwalk for RPG's Version 1.2

Postby jimmynewguy » Wed Feb 17, 2010 12:21 am

This is what i usually use. not made by me though Novie made it a ways back :) 2 .geds ones with diagoanol movement the other is 4 way (only faces 4 ways just actual movement)
Attachments
Moonwalk Solved.zip
(24.05 KiB) Downloaded 46 times
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1138
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Next

Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 0 guests

cron