MOONWALK BUG! need hellp

Talk about making games.

MOONWALK BUG! need hellp

Postby kyensoftware » Sat Oct 28, 2006 6:14 am

ok. I have the start of my RPG. Its called Ben's Life.
Wen i pres two buttonz at wonce ben (the player) walks the rong way.

IT'S ANNOYING!
User avatar
kyensoftware
 
Posts: 198
Joined: Thu Oct 26, 2006 7:49 am
Score: 5 Give a positive score

Postby DilloDude » Sat Oct 28, 2006 7:55 am

Basically, you need to decide what you want to happen When you press two keys at once. Do you want your character to stop in the direction he's facing, or do you want him to have one key preference (ie. if bother keys are pressed he will walk one direction, no matter which came first; this method is probably simpler)?
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby Game A Gogo » Sat Oct 28, 2006 5:21 pm

when will i decide to post the demo about that :x
I know how to stop it, but, i never sended teh demo
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

THIS

Postby kyensoftware » Sun Oct 29, 2006 6:18 am

User avatar
kyensoftware
 
Posts: 198
Joined: Thu Oct 26, 2006 7:49 am
Score: 5 Give a positive score

Postby DilloDude » Sun Oct 29, 2006 6:30 am

So you want when you push a ney key, it changes to that direction no matter what?
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

well...yeah

Postby kyensoftware » Sun Oct 29, 2006 7:02 am

yup! 8)
User avatar
kyensoftware
 
Posts: 198
Joined: Thu Oct 26, 2006 7:49 am
Score: 5 Give a positive score

Postby DilloDude » Sun Oct 29, 2006 8:56 am

Here is a simple method: create an actor integer called 'moving'. the reason it's an actor variable is so other actors can use it too. On your player actor, it should be in one of three values: -1 (moving left), 0 (stopped) or 1 (moving right). Other metheds migh make use of more variables, such as moving, turning direction, it depends on what you want to do with it. For this case we'll just use moving. On your players draw actor event, put this script:
Code: Select all
x += moving * 5;//adjust the five to suit your need

An alternative is to use velocity variables so you start increasing velocity when you start moving, rather than be either moving or not. (you could use another variable with this, too, to make situations like on ice, for example, you don't want to speed up as quickly). For the purpose of this example, we'll just stick with the simple method.
Now, this will move you according to the moving variable, but we still need to set it and change animations.
On keydown->right(no repeat), put this script:
Code: Select all
if (moving != 1)
{
    ChangeAnimation("Event Actor", "WalkRight", FORWARD);//substitute the name of your animation
    moving = 1;
}

On keydown->left(no repeat), put a similar script:
Code: Select all
if (moving != -1)
{
    ChangeAnimation("Event Actor", "WalkLeft", FORWARD);//substitute the name of your animation
    moving = -1;
}

Now, add two keyup events:
left:
Code: Select all
if (moving == -1)
{
    moving = 0;
    ChangeAnimation("Event Actor", "StopLeft", FORWARD););//substitute the name of your animation
}


right:
Code: Select all
if (moving == 1)
{
    moving = 0;
    ChangeAnimation("Event Actor", "StopRight", FORWARD););//substitute the name of your animation
}

I think this should do what you want. If you have problems, or any other questions, just ask.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

TANX

Postby kyensoftware » Mon Oct 30, 2006 4:45 am

thanx dude or should I say, DilloDude!!
It works perfectly!!
EDIT:I added up and it dint work :?
User avatar
kyensoftware
 
Posts: 198
Joined: Thu Oct 26, 2006 7:49 am
Score: 5 Give a positive score

Postby saabian » Mon Jan 08, 2007 6:45 pm

using key down event.

press "left arrow" (at key down event) and change the "players"/actors animation to "player move left animation".

Do the same thing with right arrow.

Now make the player move to the right/left when you press right/left arrow ( i assume you know how to do that).

Now in game mode if you press and hold the right arrow the animation will change to "player move right animation" and the actor will move to the right but when you press the left arrow and (after that) relise the right arrow the player/actor will do a strange moonwalk to right or left, and thats the problem i guess?

In key down event, simple press the right arrow and then the left arrow and select "keys must be presed in order" (or what ever it says). now select the "player move left animation" and make the actor move to the left.
Do tha same thing the opposite.
Now your actor should not do a strange moonwalk!

Was that what you mented? :P
User avatar
saabian
 
Posts: 25
Joined: Sat Dec 09, 2006 1:27 pm
Location: Gothenburg => Sweden
Score: 0 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron