iffy about my maze.

Talk about making games.

iffy about my maze.

Postby MrB » Sun May 09, 2010 10:49 pm

OK I am trying to limit the amount of goes a player has getting through a maze. I have set up a variable goes, and a script that is called every time the player is created. In the script I am trying to use an 'if' to call another actor, however the actor I want to call gets called everytime regardless. Here is the script what am I doing wrong?
Code: Select all
goes=goes+1;


if (goes = 4)CreateActor("win", "icon", "(none)", "(none)", -276, 0, true);
MrB
 
Posts: 41
Joined: Sun Jun 14, 2009 8:41 am
Score: 0 Give a positive score

Re: iffy about my maze.

Postby Hblade » Sun May 09, 2010 11:04 pm

You only have 1 = sign in your if statement :3

correct way of if:
Code: Select all
if (val1 == val2)

if (val1>val2)

if (val1<val2)


Or you can do => and =< which mean equal or less, and equal or more :3
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: iffy about my maze.

Postby MrB » Mon May 10, 2010 5:27 am

Aaah

so = means assign value to and == means check it is the same as.

Thank you so much for your help.

MrB
MrB
 
Posts: 41
Joined: Sun Jun 14, 2009 8:41 am
Score: 0 Give a positive score

Re: iffy about my maze.

Postby Hblade » Mon May 10, 2010 6:15 am

No problem :D Yeah this happens to beginners
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest