Can't make animation sprite stop moving.

Non-platform specific questions.

Can't make animation sprite stop moving.

Postby LucasA33 » Mon Jan 12, 2009 9:53 pm

I have placed a sprite in my game, as its a main character.... One prob. Its never going to stop moving... I want it to move, only when I press a key.... Help?
Attachments
Megaman.png
LucasA33
 
Posts: 79
Joined: Mon Jul 21, 2008 12:17 am
Location: Science, Technology, Computers, Programming, and Robotics.
Score: 1 Give a positive score

Re: Can't make animation sprite stop moving.

Postby Quill » Mon Jan 12, 2009 9:59 pm

With the keydown you change the animation and make the xvelocity = 5 or similar, as you already know. The way I made him stop running was by adding a key up event to that actor which changes the animation to the resting one, and make the xvelocity = 0

Does that help or should I put the process in more detail?
My current projects:
Megaman style platformer test: 50%
Kittyman adventures: Designing. Will start after the platformer engine is finished

Overall goal:
Top down view Dead Rising style game: Designing ideas/characters/map/how to make it on paper
Quill
 
Posts: 6
Joined: Tue Dec 30, 2008 12:40 pm
Location: Sitting in front of my computer-24/7
Score: 0 Give a positive score

Re: Can't make animation sprite stop moving.

Postby LucasA33 » Mon Jan 12, 2009 9:59 pm

I think ill need more detail
LucasA33
 
Posts: 79
Joined: Mon Jul 21, 2008 12:17 am
Location: Science, Technology, Computers, Programming, and Robotics.
Score: 1 Give a positive score

Re: Can't make animation sprite stop moving.

Postby LucasA33 » Mon Jan 12, 2009 10:09 pm

oh I mean, The sprite, its changing animatines every second.... It shows the Sprite running, when its not.
LucasA33
 
Posts: 79
Joined: Mon Jul 21, 2008 12:17 am
Location: Science, Technology, Computers, Programming, and Robotics.
Score: 1 Give a positive score

Re: Can't make animation sprite stop moving.

Postby skydereign » Tue Jan 13, 2009 12:17 am

This can get relatively complicated... There are moonwalk demos that will help get rid of all moving errors. A simple fix, which does not prevent moonwalking, is on the keyup event, change animation to your standing sprite. Or if you don't have a standing sprite, change the animation to your run right sprite and stop it.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Can't make animation sprite stop moving.

Postby Quill » Fri Jan 16, 2009 4:34 pm

Well, not meaning to be patronising or be big headed (for I know I'm not good at this program) but I thought that was asimple fix by using a keyup event changing the animation.

As for moonwalking, all I did was use the running sprite (I'm using the same sprites as you Lucas) and in an image editing program flipped the image horizontally.

Then I used that as an animation for running left and bascially did the same as running right, but changing the animation to the running left one and added another event that made:
xvelocity = -5
or similar.

There is a much neater way of putting most of this into a few scripts but I haven't quite done that yet
My current projects:
Megaman style platformer test: 50%
Kittyman adventures: Designing. Will start after the platformer engine is finished

Overall goal:
Top down view Dead Rising style game: Designing ideas/characters/map/how to make it on paper
Quill
 
Posts: 6
Joined: Tue Dec 30, 2008 12:40 pm
Location: Sitting in front of my computer-24/7
Score: 0 Give a positive score

Re: Can't make animation sprite stop moving.

Postby skydereign » Fri Jan 16, 2009 11:52 pm

It depends on what you want. Did you try pressing down left and then right and then releasing right, and such? Adding up and down also increases the confusion that can arise. This problem does not matter if you use most controllers, like a PS3 controller as you can't press left and right at the same time.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Can't make animation sprite stop moving.

Postby paperboy321 » Sun Jan 18, 2009 2:22 pm

Try looking at teh tutorials menu on the top bar on game editor.
User avatar
paperboy321
 
Posts: 67
Joined: Mon Jun 09, 2008 11:08 pm
Score: 0 Give a positive score

Re: Can't make animation sprite stop moving.

Postby DST » Sun Jan 18, 2009 6:27 pm

Note that xvelocity is simply a way to 'store' frame velocity, it is an alternate for normal speed (x+=5;)

Velocity isn't needed when the action is occuring each frame (i. e. draw actor, repeated kepress, etc.)

Velocity is for building up speed, its best used on single triggers or gravity, where we want to build up velocity or let it sustain after the event is over.

So if you use velocity in a keypress, you'll need an action (like keyup) to stop the velocity; if you use x+=5; in a keypress, you don't need a keyup. It stops when the event stops. For most situations, x+= is much better suited than velocity, because most game movements are immediate, rather than gradual.

Also note that velocity, x+=, and angle+directional velocity are interchangeable.
You can say x+=5;, then say if(xvelocity==5) or (if angle==0) because all three forms of speed are interchangeable in GE.

So its

x+= normal movement
xvelocity= sustained or builtup movement
angle & directional velocity= for objects than move in any direction instead of only 4.

Hope this helped.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron