Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,561 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Moving a 2D sprite step by step #330699
06/29/10 11:57
06/29/10 11:57
Joined: Jun 2007
Posts: 15
Norway
G
Gastara Offline OP
Newbie
Gastara  Offline OP
Newbie
G

Joined: Jun 2007
Posts: 15
Norway
Hi!

I try to figure out how to move a 2d player sprite forward in just one step each time the forward key is pressed.
The player needs to press the forward key each time when moving the player sprite.
Every time it moves forward, it moves for example 60 pixels at a time.
Then you need to press the key again to move to the next step. So the idea is to move the sprite step by step.
Someone who knows a solution for this?

Re: Moving a 2D sprite step by step [Re: Gastara] #330700
06/29/10 12:13
06/29/10 12:13
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
Code:
var move_lock = 0;
...

while(1)
{
	if(key_cuu && (!move_lock))
	{
		move_lock = 1;
		... // move your sprite
	}
	if(!key_cuu) move_lock = 0;
	wait(1);
}



Re: Moving a 2D sprite step by step [Re: Lukas] #330701
06/29/10 12:24
06/29/10 12:24
Joined: Jun 2007
Posts: 15
Norway
G
Gastara Offline OP
Newbie
Gastara  Offline OP
Newbie
G

Joined: Jun 2007
Posts: 15
Norway

Nice, thank u very much.smile


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1