Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AbrahamR, wdlmaster, 7th_zorro, dr_panther, 1 invisible), 764 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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 | 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