Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Direction of Sprites after LeftKey()=0 ect

Author
Message
MoonMan
22
Years of Service
User Offline
Joined: 14th May 2004
Location:
Posted: 27th May 2004 18:31
At this moment I have collision and animation down, but there is still 1 more thing I want to add to my movement before moving on to harder more complicated things. My codes as simple as

LeftKey()=1 THEN Sprite 2, X, Y, FRAME_UP

But now I want my sprite to stop at a specific frame when letting go of which ever key is being used. Here's an example of what I'm trying to say

LeftKey()=1 \\ It plays a simple animation and moves left
LeftKey()=0 \\ Stops the sprite on a left direction sprite

So when it stops it faces the way it was going in the animation.

Now I've tried doing

LeftKey()=0 THEN Sprite 2, X, Y, Standing_Left

But when I do this to all the keys, something glitches and all of them seem to be messed up when letting go of any specific key. When letting go of Up it goes Down, Letting go of Left makes it look Up, ect.

Also, if someone could give me some tips on how to creating the sword animation for my sprite (Link to the Past Clone) type of game.

Sorry if this doesn't make any sense, I was in a hurry writting it.

Thanks in Advance.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th May 2004 00:42
Yeah well Leftkey = 0 will always be true if you are pressing the rightkey, so you are not going to get far with that. You need a Flag. If leftkey = 1 then FlagLeft = 1: Flagright = 0

If rightkey = 1 Then Flagright = 1 : Flagleft = 0

Now you have switches that will work. You need to switch on the one that is being used, and switch off all of the others.....Including Up/Down. I did not show up/down in my example because it is easy to understand.

MoonMan
22
Years of Service
User Offline
Joined: 14th May 2004
Location:
Posted: 28th May 2004 04:51 Edited at: 29th May 2004 01:06
I'll try it out, Once again, you're my savor Pincho.
MoonMan
22
Years of Service
User Offline
Joined: 14th May 2004
Location:
Posted: 29th May 2004 17:49
Sorry to bother you like this Pincho, But I'm not quite understanding this flag system. If you could please do shed some light on this.



Thank you in advance
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 29th May 2004 18:34
Hmm try this.


If leftkey() = 1 then Standing_Pos = Standing_Left

If rightkey() = 1 Then Standing_Pos = Standing_Right



If LeftKey()=0 and rightkey() = 0 and upkey()=0 and downkey() = 0

Sprite 2, X, Y, Standing_Pos

Endif

MoonMan
22
Years of Service
User Offline
Joined: 14th May 2004
Location:
Posted: 4th Jun 2004 11:50
By God It works, Thanks a bunch Pincho, that code helped a lot =)

Login to post a reply

Server time is: 2026-06-09 15:43:27
Your offset time is: 2026-06-09 15:43:27