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
2 registered members (TipmyPip, 1 invisible), 18,789 guests, and 8 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
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 | 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