Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to stop a value from going under 0?
- WildRiolu
-
3 posts
How to stop a value from going under 0?
I am currently making a clicker game on scratch, but i need a data value to not go under 0 so I can prevent cheating.
How do i make a data value impossible to go under 0?
How do i make a data value impossible to go under 0?
- deck26
-
1000+ posts
How to stop a value from going under 0?
Depends which part of your project changes it? If it always changes by 1 only allow it to happen if the value is currently greater than 0. If it changes by a variable amount you have to do a little more but it's still fairly easy.
- inlanoche
-
42 posts
How to stop a value from going under 0?
you can also do a test if the result of a change would put the value below zero:
This way, before the calculation is applied you can verify the result is not lower than expected.
This way, before the calculation is applied you can verify the result is not lower than expected.
Last edited by inlanoche (Sept. 14, 2016 17:44:32)
- scubajerry
-
1000+ posts
How to stop a value from going under 0?
Poof
Last edited by scubajerry (Sept. 14, 2016 17:45:10)
- WildRiolu
-
3 posts
How to stop a value from going under 0?
Thank you all for your answers. But I had figured it out on my own after I posted this using something similar to what inlanoche used.
Thanks.
If you want you can check out what I made with it. (Doge Clicker)
Thanks.
If you want you can check out what I made with it. (Doge Clicker)
Last edited by WildRiolu (Sept. 14, 2016 19:31:01)
- KJtheDJ
-
27 posts
How to stop a value from going under 0?
Theres a way more simple way to do it
Last edited by KJtheDJ (Sept. 14, 2016 23:40:39)
- MegaApuTurkUltra
-
1000+ posts
How to stop a value from going under 0?
yes, and more CPU-intensive Theres a way more simple way to do it
- asivi
-
1000+ posts
How to stop a value from going under 0?
Last edited by asivi (Feb. 9, 2018 21:07:49)
- -ShadowOfTheFuture-
-
1000+ posts
How to stop a value from going under 0?
Please don't necropost. This topic is from 2016 and has already been resolved. Thanks! thanks!!!
Reporting topic to be closed.
Last edited by -ShadowOfTheFuture- (Feb. 9, 2018 20:58:18)
- Discussion Forums
- » Help with Scripts
-
» How to stop a value from going under 0?