Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / A little problem with variables.

Author
Message
Lover of games
20
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 3rd Aug 2006 16:22
I've just made a small program with a few variables. lives,maxlives, ect.



if you run the code, you'll see that the variable lives doesn't stop at 0 but keeps going. I've tried everything to let it stop on it. when the maxlives reaches 99, it doesn't go past that number. thanks for ur advice in advance

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack
Profit
19
Years of Service
User Offline
Joined: 19th Feb 2006
Location: United States
Posted: 3rd Aug 2006 16:58 Edited at: 3rd Aug 2006 16:59
Well, I don't quite understand what you're asking, but from the looks of it, you're setting the lives to 0 all the time.
If you're just trying to make the keys move the lives up and down, stopping it at 99 and 0 then change

to


What's the point of setting maxlives to 99 when lives is maxlives?

common people are walking in line.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 3rd Aug 2006 17:00 Edited at: 3rd Aug 2006 17:01
Okay let's think for a second... You want to say, "If the amount of lives you has goes below 0, then make it equal 0." and "If the amount of lives you have goes above the maximum amount, then make it equal the amount." Now, your code says: "If the amount of lives goes above or becomes the maximum amount of lives, then make it equal the maximum amount of lives." That's fine. But now you say, If the amount of lives goes under the maximum amount of lives, then make it 0." That says, "if you have 60 lives left you have 0 because I don't like you. Ha ha ha!" That's not what you want. So instead, say "If the amount of lives goes under 0, then make it 0"

Here's your code:





EDIT:

@ Open Froz:

ARG you just beat me!

Lover of games
20
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 3rd Aug 2006 17:30
thanks......was it what obvious? wow, i'm a dummy

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack

Login to post a reply

Server time is: 2025-05-25 06:26:09
Your offset time is: 2025-05-25 06:26:09