Gamestudio Links
Zorro Links
Newest Posts
Camera always moves upwards?
by clonman. 11/13/25 14:04
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
ZorroGPT
by TipmyPip. 11/10/25 11:04
Training with the R bridge does not work
by frutza. 11/05/25 00:46
Zorro 2.70
by opm. 10/24/25 03:44
Alpaca Plugin v1.4.0
by TipmyPip. 10/20/25 18:04
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Grant, AndrewAMD, ozgur, Quad, TipmyPip), 29,980 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sheliepaley, Blueguy, blobplayintennis, someone2, NotEBspark
19177 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
variable causes game to freeze! #307759
01/31/10 14:09
01/31/10 14:09
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
I am a programmer making a simple sci-fi action game with lite-c.
I have a very strange problem...
my bad guy is using the action below:

action ufo_stuff()
{
ufo = me;
var ufo_in = 0;
while (1)
{
c_move (my, vector(0*time_step, 0.7, 0), nullvector, GLIDE); // move the ship right
ufo_in += 1;
if (ufo_in >= 6000)
{
ent_create("g_laser.mdl", vector (ufo.x, ufo.y, ufo.z), e_fire); //create space junk
}
wait (1);
}
}

yet for some reason the variable "ufo_in" causes my game to freeze but I don't know how or why.
if I watch the variable "ufo_in" the watch says that it stays at "0".
The reason that that doesn't make sence is that after a specific amount of time the game freezes.
That has to be connected to the viable because if I make:

if (ufo_in >= 6000)

larger it takes longer to freeze and vice versa.
I am so confused as to what to do, please help.
rtsgamer706

Re: variable causes game to freeze! [Re: rtsgamer706] #307915
01/31/10 20:38
01/31/10 20:38
Joined: Sep 2009
Posts: 496
P
Progger Offline
Senior Member
Progger  Offline
Senior Member
P

Joined: Sep 2009
Posts: 496
there is a problem with ufo_in


try to do a ufo_in=clamp(ufo_in,0,6005)
hope it helps (:


asking is the best Way to get help laugh laugh laugh
Re: variable causes game to freeze! [Re: Progger] #307922
01/31/10 20:59
01/31/10 20:59
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
var ufo_in not reset, ENTITY created every frame after ufo_in at 6000+?
var ufo_in addition is frame-rate dependent?
c_move right-directional movement is frame-rate dependent?
Unnecessary multiplication of time_step and 0 in c_move call?
No check against NULL for ufo ENTITY pointer in ent_create call?
Code:
action ufo_stuff()
{
	ufo = me;
	var ufo_in = 0;
	while (me != NULL)
	{
		c_move (me, vector(0, 0.7 * time_step, 0), nullvector, GLIDE); // move the ship right
		//ufo_in += 1;
		ufo_in += time_step;
		if (ufo_in >= 6000)
		{
			ent_create("g_laser.mdl", my.x, e_fire); //create space junk
			ufo_in -= 6000;
		}
		wait (1);
	}
}





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