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 (), 17,340 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
How to increase the pan of an object when key_cur is pressed? #351566
12/27/10 02:01
12/27/10 02:01
Joined: Sep 2010
Posts: 67
FutureRaptor Offline OP
Junior Member
FutureRaptor  Offline OP
Junior Member

Joined: Sep 2010
Posts: 67
I need to have my.pan increase the longer key_cur is pressed. I know this is really simple I just cant think of it. Thanks!

Re: How to increase the pan of an object when key_cur is pressed? [Re: FutureRaptor] #351623
12/27/10 14:59
12/27/10 14:59
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Code:
action turner(){
  while(me){
    if(key_cur){ my.pan += time_step; }
    wait(1;
  }
}


or
Code:
action turner(){
  while(me){
    my.pan += time_step*key_cur;
    wait(1);
  }



Re: How to increase the pan of an object when key_cur is pressed? [Re: MrGuest] #351857
12/28/10 23:25
12/28/10 23:25
Joined: Sep 2010
Posts: 67
FutureRaptor Offline OP
Junior Member
FutureRaptor  Offline OP
Junior Member

Joined: Sep 2010
Posts: 67
I dont know if I am doing something wrong but neither of those scripts seem to increase my model's pan the longer the player holds key_cur. I need a kind of acceleration but for turning, the longer the player holds key_cur the faster the model spins. Please help.

Last edited by FutureRaptor; 12/28/10 23:25.
Re: How to increase the pan of an object when key_cur is pressed? [Re: FutureRaptor] #351859
12/28/10 23:34
12/28/10 23:34
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
cause examples above are using static values.
do it like THIS:

Code:
function SpinFaster()
{
  var speed = 0;
  while(1)
  {
    my.pan += speed * key_cur;
    speed += 1*time_step; //you may adjust here for faster
    wait(1);                      //  spinning
  }

}



Last edited by Rackscha; 12/28/10 23:35.

MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development

Re: How to increase the pan of an object when key_cur is pressed? [Re: Rackscha] #352471
01/03/11 20:36
01/03/11 20:36
Joined: Sep 2010
Posts: 67
FutureRaptor Offline OP
Junior Member
FutureRaptor  Offline OP
Junior Member

Joined: Sep 2010
Posts: 67
Thank you so much. How can I limit how fast the pan can increase though? Like a max rate of turn for my plane game.

Re: How to increase the pan of an object when key_cur is pressed? [Re: FutureRaptor] #352473
01/03/11 20:45
01/03/11 20:45
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
in speed += 1*time_step; you can change it for speed += 0.5*time_step; and it will be slower


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB

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