Need help with code

Non-platform specific questions.

Need help with code

Postby Freddy » Sat Aug 25, 2007 11:06 pm

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
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: Need help with code

Postby d-soldier » Sat Aug 25, 2007 11:10 pm

IF statements need to be >=, <=, ==, etc... not a single ">".
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Re: Need help with code

Postby Freddy » Sat Aug 25, 2007 11:22 pm

Still dosnt work...
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: Need help with code

Postby d-soldier » Sat Aug 25, 2007 11:24 pm

if(pennies>=0 && reload<=5)
{
do stuff;
}
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Re: Need help with code

Postby Freddy » Sat Aug 25, 2007 11:30 pm

Yes! It worked, thanks alot :D
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron