Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
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
3 registered members (Martin_HH, steyr, alibaba), 509 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Rotating object in increments #246754
01/16/09 23:51
01/16/09 23:51
Joined: Aug 2006
Posts: 70
NJ
S
SirCamaris Offline OP
Junior Member
SirCamaris  Offline OP
Junior Member
S

Joined: Aug 2006
Posts: 70
NJ
I'm trying to get a player to rotate 90 degrees over 4 equal increments by pressing a key only once. The end result however, is either a full 90 or 22.5 degree turn.

if (key_a == 1) //key_a is pressed

{ while (key_a == 1) //while pressed
{wait(1);} //wait a frame
while (my.pan <= 90) //key_a is released and action is taken
{my.pan += 22.5;} // while my.pan <= 90, increase angle by
wait(1)} // 22.5 then wait a frame
}

Re: Rotating object in increments [Re: SirCamaris] #246900
01/17/09 20:38
01/17/09 20:38
Joined: Aug 2006
Posts: 70
NJ
S
SirCamaris Offline OP
Junior Member
SirCamaris  Offline OP
Junior Member
S

Joined: Aug 2006
Posts: 70
NJ
Hello all,

I was able to figure it out. I had to write a separate function and call it in the action code.

function rotate_left()
{ var new_angle = my.pan + 90;
while (my.pan < new_angle)
{my.pan += 22.5;
wait(1);
{
}

Then within the action...

if (key_a == 1)
{ while (key_a == 1)
{wait(1);}
rotate_left();
}


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