Changing level when variable equals zero

Non-platform specific questions.

Changing level when variable equals zero

Postby arcreamer » Wed Sep 05, 2007 11:00 pm

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?
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score

Re: Changing level when variable equals zero

Postby Game A Gogo » Thu Sep 06, 2007 12:00 am

that means enem is not a var, make sure you haven't named it to something else
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Changing level when variable equals zero

Postby arcreamer » Thu Sep 06, 2007 12:27 am

im positive it was called enem
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score

Re: Changing level when variable equals zero

Postby d-soldier » Thu Sep 06, 2007 12:36 am

double check by opening up your variable list, make sure it's capped the same way too. Enem vs. enem, etc.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Re: Changing level when variable equals zero

Postby arcreamer » Thu Sep 06, 2007 12:47 am

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...
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score

Re: Changing level when variable equals zero

Postby arcreamer » Thu Sep 06, 2007 12:48 am

its a Integer, actor variable
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score

Re: Changing level when variable equals zero

Postby d-soldier » Thu Sep 06, 2007 12:57 am

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;
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Re: Changing level when variable equals zero

Postby arcreamer » Thu Sep 06, 2007 1:10 am

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 :(
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score

Re: Changing level when variable equals zero

Postby d-soldier » Thu Sep 06, 2007 1:47 am

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).
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Re: Changing level when variable equals zero

Postby arcreamer » Thu Sep 06, 2007 7:57 pm

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
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score

Re: Changing level when variable equals zero

Postby arcreamer » Thu Sep 06, 2007 7:59 pm

sorry meant to say if (enem<=0) not health lol
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score

Re: Changing level when variable equals zero

Postby arcreamer » Thu Sep 06, 2007 8:08 pm

in all my other actors, enem=1; is in create actor
arcreamer
 
Posts: 398
Joined: Tue Jul 03, 2007 4:08 pm
Score: 9 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron