HI all,
Im making a game where when the player hits a red color they are pushed off from
that color, however I am confused why does it only work when using the forever if
forever ifand not using the if
if <touching color [#FF0000]?>why does the forever part be required?
when gf clicked if <touching color [#FF0000]?> move (10) stepsThis one doesnt work
when gf clicked forever if <touching color [#FF0000]?> move (10) stepsThis one does.
Offline
The "if" block checks the condition only once. So, if you are touching color red when the green flag is pressed, you'll move ten steps once. If you're not, you won't do anything.
With the forever if, it continuously checks, so anytime you are touching red, you'll move.
Hope that helps!
Offline
What Scimonster said, but if you need to check multiple ifs with one script, instead of
forever ifuse
when gf clicked forever if <whatever> do stuff end if <other stuff> do other stuff end
Offline
To paraphrase, the
when gf clicked if <> Do stuffis almost the same thing as
when gf clicked forever if<> Do stuff, but if you have extra stuff after the if<> block in the first one, it is not under the 'if' condition.
Offline