Discuss Scratch

AbrahamSam
Scratcher
22 posts

Variable in my Tornado Tracker game not working properly

I am working on a new game called tornado tracker, and up until this point all of the scripts have been working, except this one that I just coded, which changed the Category depending on which Costume the tornado currently is. It usually is working for one clone but then when there's 2 or more it seems to break on the newer clones.. All of the numbers are what they are supposed to be, however it just seems to not work sometimes. I would assume that this is just a small error that I have not caught onto, but if anyone could help, it would be very appreciated.

Project:
AbrahamSam
Scratcher
22 posts

Variable in my Tornado Tracker game not working properly

just realizzed i posted the link wrongProject
Modz31
Scratcher
72 posts

Variable in my Tornado Tracker game not working properly

Let's say MPH = 210.

Meets all conditions in the image and thats why it doesnt working properly.



Better to do something like that:

when I start as a clone
forever
if <[MPH] < [65]> then
switch costume to [whatever you want v]
end
if <<[MPH] > [64]> and <[MPH] < [86]>> then
switch costume to [whatever you want v]
end
... //keep going like that.
end
deck26
Scratcher
1000+ posts

Variable in my Tornado Tracker game not working properly

The best option is to use if/else blocks

if <(MPH) < [65]> then 
your code here
else
if <(MPH) < [86]> then
your code here
else
if <(MPH) < [111]> then
your code
else
and so on
end
end
end
So once you find a value that the MPH is less than you don't need to check any further.
AbrahamSam
Scratcher
22 posts

Variable in my Tornado Tracker game not working properly

Thanks! I tried the first one from Modz31 but it didn't really seem to work, but then your reply loaded and so far it has fixed the problem.

Powered by DjangoBB