
mrgame wrote:Almost forgot.
i am using anti moonwalk in my game but i as you can guess i do it a simple way. i have noticed in some peoples games they are using a code that makes there caracter walk a little bit when they press say right. so they press right and it walks for a second or 2 even when you let go. why would you want that? it just lets people glitch into walls unless you then use the code ive seen about that stops you walking through things .
anyway
put these in the keydowns for the actor you dont want to moon walk
- Code: Select all
Keydown up
direct = 1;
- Code: Select all
keydown right
direct = 2;
- Code: Select all
keydown down
direct = 3;
- Code: Select all
keydown left
direct = 4;
and now in the draw actor of the same actor
- Code: Select all
{
ChangeAnimation("Event Actor", "ups", NO_CHANGE);
actor.y = actort.y - 5;
}
if (direct == 2)
{
ChangeAnimation("Event Actor", "right", NO_CHANGE);
actor.x=actor.x + 5;
}
if (direct == 3)
{
ChangeAnimation("Event Actor", "downs", NO_CHANGE);
actor.y = actor.y + 5;
}
if (direct == 4)
{
ChangeAnimation("Event Actor", "left", NO_CHANGE);
actor.x = actor.x - 5;
}
if (direct == 0)
{
ChangeAnimationDirection("Event Actor", STOPPED);
animpos = 0;
}
Now you change actor to the name of your actor.
now that this does is the movement and the changing of the animation are set to a variable not a keydown. and they are both set to the same variable.
so looking right and going right can not be apart. if one is on the other one has to be. this way if you press both up and right. the actory will look and go either up or right. depending on what was pressed first.
a non flawable anty moon walk code using only if
if (direct==1)
{
ChangeAnimation("Event Actor", "ups", NO_CHANGE);
actor.y = actort.y - 5;
}
if (direct == 2)
{
ChangeAnimation("Event Actor", "right", NO_CHANGE);
actor.x=actor.x + 5;
}
if (direct == 3)
{
ChangeAnimation("Event Actor", "downs", NO_CHANGE);
actor.y = actor.y + 5;
}
if (direct == 4)
{
ChangeAnimation("Event Actor", "left", NO_CHANGE);
actor.x = actor.x - 5;
}
if (direct == 0)
{
ChangeAnimationDirection("Event Actor", STOPPED);
animpos = 0;
}
if(direct = 1)
if (direct==1)
{
ChangeAnimation("Event Actor", "walkup", NO_CHANGE);
actor.y = actort.y - 5;
}
if (direct == 2)
{
ChangeAnimation("Event Actor", "walkright", NO_CHANGE);
actor.x=actor.x + 5;
}
if (direct == 3)
{
ChangeAnimation("Event Actor", "walkdown", NO_CHANGE);
actor.y = actor.y + 5;
}
if (direct == 4)
{
ChangeAnimation("Event Actor", "walkleft", NO_CHANGE);
actor.x = actor.x - 5;
}
if (direct == 0)
{
ChangeAnimationDirection("Event Actor", STOPPED);
animpos = 0;
}
if (direct==1)
{
ChangeAnimationDirection("Event Actor", FORWARD);
ChangeAnimation("Event Actor", "walkup", NO_CHANGE);
actor.y = actor.y - 5;
}
if (direct == 2)
{
ChangeAnimationDirection("Event Actor", FORWARD);
ChangeAnimation("Event Actor", "walkright", NO_CHANGE);
actor.x=actor.x + 5;
}
if (direct == 3)
{
ChangeAnimationDirection("Event Actor", FORWARD);
ChangeAnimation("Event Actor", "walkdown", NO_CHANGE);
actor.y = actor.y + 5;
}
if (direct == 4)
{
ChangeAnimationDirection("Event Actor", FORWARD);
ChangeAnimation("Event Actor", "walkleft", NO_CHANGE);
actor.x = actor.x - 5;
}
if (direct == 0)
{
ChangeAnimationDirection("Event Actor", STOPPED);
animpos = 0;
}
Users browsing this forum: No registered users and 1 guest