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
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 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
wait()? #175180
12/28/07 22:57
12/28/07 22:57
Joined: Jun 2007
Posts: 63
Italy
Sonic220 Offline OP
Junior Member
Sonic220  Offline OP
Junior Member

Joined: Jun 2007
Posts: 63
Italy
I've a sort of problem with wait and a while loop
Code:
while(my)
{
my.x -= 3* time;
if (my.x < -3600)
{
my.y += 10*time_step;
if (my.tilt <= 15){
my.tilt += 5*time_step;
}
ent_create(bullet1,vector(my.x-20,my.y,my.z),move_bullet1);
wait(10);
}
wait (1);
}


This is a ship, it moves and when is .x is smaller than -3600 start fire and move towards y.
Cause of the wait the ship doesn't move quikly.
I've tryed to divide the while loop and create 2 different, but that's the same thing.

how to do?

Last edited by Sonic220; 12/28/07 22:58.

~Vision Divine~
Re: wait()? [Re: Sonic220] #175181
12/29/07 00:15
12/29/07 00:15
Joined: Jan 2003
Posts: 4,305
Damocles Offline
Expert
Damocles  Offline
Expert

Joined: Jan 2003
Posts: 4,305
Kind of strange function,
but the main thing you should change is to never use wait(10);
this waits 10 frames, and not a specific time, use the negative number like wait(-0.1); or so
for time in seconds. (is like sleep() function)

var fps_max=120; //limiting the framerate an fast computers

...

while(my)
{
my.x -= 3* time;
if (my.x < -3600)
{
my.y += 10*time_step;
if (my.tilt <= 15){
my.tilt += 5*time_step;
}
ent_create(bullet1,vector(my.x-20,my.y,my.z),move_bullet1);
wait(-1); //or another value, that is not framerate dependent
}
wait (1);
}

Re: wait()? [Re: Damocles] #175182
12/29/07 08:56
12/29/07 08:56
Joined: Jun 2007
Posts: 63
Italy
Sonic220 Offline OP
Junior Member
Sonic220  Offline OP
Junior Member

Joined: Jun 2007
Posts: 63
Italy
ah, I see, but the problem isn't this.
Cause the wait is in the while and must be after the ent_create(a bullet for 2 seconds for example), the ship moves like: +10 stop +10 stop.
Sorry my bad english, I can't explane myself better.


~Vision Divine~
Re: wait()? [Re: Sonic220] #175183
12/29/07 10:09
12/29/07 10:09
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
var tempa;
while(my)
{
my.x -= 3* time;
if (my.x < -3600)
{
my.y += 10*time_step;
if (my.tilt <= 15){
my.tilt += 5*time_step;
}
int(tempa);
if(tempa == 8)
{
ent_create(bullet1,vector(my.x-20,my.y,my.z),move_bullet1);
}
tempa += 1;
tempa %=9;//must be one higher then the one in the if(tempa,enz.
}
wait (1);
}

change tempa the red parts for longer ore shorter



Last edited by flits; 12/29/07 10:13.
Re: wait()? [Re: flits] #175184
12/29/07 11:37
12/29/07 11:37
Joined: Jun 2007
Posts: 63
Italy
Sonic220 Offline OP
Junior Member
Sonic220  Offline OP
Junior Member

Joined: Jun 2007
Posts: 63
Italy
Thx a lot!
It work, but I don't understand how.
There are a var int, and...
°A°


~Vision Divine~
Re: wait()? [Re: Sonic220] #175185
12/29/07 12:47
12/29/07 12:47
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
the int cuts evthing after "," so 33,23 woulde be 33 dont know if its necery
tempa += 1; ads 1 every frame
tempa %= 9; if(tempa == 9) tempa = 0


"empty"

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