Page 1 of 1

Changing level when variable equals zero

PostPosted: Wed Sep 05, 2007 11:00 pm
by arcreamer
the game im working on, i have a variable called enem, and i have 20 enemies and i want it so when enem = 0, to move the view on the y axis 2066 so i tried this,
if (enem<=0)
{
view.y=2066;
}

but when i clicked add, it says Unknown type of binhcost

what does that mean?

Re: Changing level when variable equals zero

PostPosted: Thu Sep 06, 2007 12:00 am
by Game A Gogo
that means enem is not a var, make sure you haven't named it to something else

Re: Changing level when variable equals zero

PostPosted: Thu Sep 06, 2007 12:27 am
by arcreamer
im positive it was called enem

Re: Changing level when variable equals zero

PostPosted: Thu Sep 06, 2007 12:36 am
by d-soldier
double check by opening up your variable list, make sure it's capped the same way too. Enem vs. enem, etc.

Re: Changing level when variable equals zero

PostPosted: Thu Sep 06, 2007 12:47 am
by arcreamer
it is i just checked, i have on create actor, enem=20; and on draw actor,
if (enem<=0)
{
view.y = 2066;
}

and on collision, enem-=1; but yet when it hits the first enemy, the view moves down when it should when all enemies are dead not just one...

Re: Changing level when variable equals zero

PostPosted: Thu Sep 06, 2007 12:48 am
by arcreamer
its a Integer, actor variable

Re: Changing level when variable equals zero

PostPosted: Thu Sep 06, 2007 12:57 am
by d-soldier
enem should be a global variable.
You need to have something's create-actor event increase enem to twenty, like the create-actor event for each enemy:
enem+=1;

Re: Changing level when variable equals zero

PostPosted: Thu Sep 06, 2007 1:10 am
by arcreamer
ok, i put enem to a gloabal variable, deleted the draw actor of enem=20; and i added enem+=1; to every enemies create actor script and it STILL each time it hits the only one enemy it moves to the next level :(

Re: Changing level when variable equals zero

PostPosted: Thu Sep 06, 2007 1:47 am
by d-soldier
Okay, we need to square away a few basics here:

DRAW ACTOR events occur every single frame during the game play... therefore, you would never put something like your "enem=20;" here, because it would be constantly changing "enem" back to 20 every frame, regardless of how many you killed...

Review your other coding to verify that you don't have things in the draw actor scripts which you are trying to affect by other means (such as ingame actions).

Re: Changing level when variable equals zero

PostPosted: Thu Sep 06, 2007 7:57 pm
by arcreamer
i know, i have enem=20 and the if (health<=0) script all in create actor yet it still changes to level 2 after only one enemy dies

Re: Changing level when variable equals zero

PostPosted: Thu Sep 06, 2007 7:59 pm
by arcreamer
sorry meant to say if (enem<=0) not health lol

Re: Changing level when variable equals zero

PostPosted: Thu Sep 06, 2007 8:08 pm
by arcreamer
in all my other actors, enem=1; is in create actor