Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Newbie Questions
by AndrewAMD. 12/04/23 11:14
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
2 registered members (TipmyPip, izorro), 556 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
-= but not +=?? #292398
10/03/09 00:14
10/03/09 00:14
Joined: Oct 2009
Posts: 17
Darzoz Offline OP
Newbie
Darzoz  Offline OP
Newbie

Joined: Oct 2009
Posts: 17
okay so i'm using this code:

BMAP* player_bmap = "playertest.bmp";
PANEL* player_blue =
{
pos_x = 100;
pos_y = 100;
bmap = player_bmap;
flags = OVERLAY | SHOW;
}

function main()
{
video_mode = 7;
screen_color.red = 150;
while(1)
{
while(!key_w)
wait(1);
{
player_blue.pos_y -= 0.3;
wait(1);
}
}
while(1)
{
while(!key_s)
wait(1);
{
player_blue.pos_y += 0.3;
wait(1);
}
}
}

and the first while loop works, it makes the player panel move up, but the second loop doesn't make the player move down, any idea why?


Q. Help! When I run the game, everything is spinning!
A. Put your joystick in center position.
Re: -= but not +=?? [Re: Darzoz] #292399
10/03/09 00:22
10/03/09 00:22
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
The while(!key_?) loops are stopping anything else in the main loop from being run.

Try this instead
Code:
function main()
{
	video_mode = 7;
	screen_color.red = 150;
	while(1)
	{
		if(key_w)	{	player_blue.pos_y -= 0.3;	}
		if(key_s)	{	player_blue.pos_y += 0.3;	}
		wait(1);
	}
}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: -= but not +=?? [Re: EvilSOB] #292400
10/03/09 00:33
10/03/09 00:33
Joined: Oct 2009
Posts: 17
Darzoz Offline OP
Newbie
Darzoz  Offline OP
Newbie

Joined: Oct 2009
Posts: 17
Thanks.


Q. Help! When I run the game, everything is spinning!
A. Put your joystick in center position.

Gamestudio download | chip programmers | 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