Page 1 of 1

Need help with code

PostPosted: Sat Aug 25, 2007 11:06 pm
by Freddy
Im making a game called Penny Drop, I was inspired by those cheep little home-made donation things, that consist of a board with a whole bunche of nails in it. And if you didnt guess already, youre supposed to put a coin in it and watch it fall to its doom. Anyway, the screenshot will explain more. But as for the code, Im making my game, so that you can only drop five coins in at a time, and of course only if you have more than zero pennies (You drop pennies by pressing the space bar). I did the key down event, script editor, and typed in:
if(pennies>0, reload<5)

{
createactor bla bla bla...
}

and of course, "reload" is the variable for only letting five pennies drop at a time. I tried it, but I found that, although the reload variable worked just fine, even if I ran out of pennies, I was able to drop them (which would not be a problem in real life!!, but since this is a game, well, it needs to be changed :wink: ) So if anyone knows a code that would work, please respond. Thanks :D

Re: Need help with code

PostPosted: Sat Aug 25, 2007 11:10 pm
by d-soldier
IF statements need to be >=, <=, ==, etc... not a single ">".

Re: Need help with code

PostPosted: Sat Aug 25, 2007 11:22 pm
by Freddy
Still dosnt work...

Re: Need help with code

PostPosted: Sat Aug 25, 2007 11:24 pm
by d-soldier
if(pennies>=0 && reload<=5)
{
do stuff;
}

Re: Need help with code

PostPosted: Sat Aug 25, 2007 11:30 pm
by Freddy
Yes! It worked, thanks alot :D