When is NOT bumping?

helpwithcode

#1

Ok. I have this game when there is a tree you can climb, and I used a value that turns to 1 when you bump the tree, and when the value is 1, you can climb the tree.

But how do I make it so the value switches to 0 when you are not bumping it? Please help me with this!


#2

Here:
When play button is tapped
(Repeat forever;
increase value by 1
)
When something is touching tree
set value to 1
)
That is it!


#3

First, do this rule. Do your two objects you want to detect are NOT touching in the is touching rule.


Then, do this rule:

For what you want to happen when they are not touching, do a rule:
Is Not Touching = 1


#4

this is not quite on topic but it would be soooooo useful if you could make "check once if: :smiling_imp: is touching :no_mouth: "


#5

@Phase_Studios I want to do it your way because it's easier (no offense @Valgo) but I don't get it. That would make the value 1 then higher and it goes back to 1 when they are touching but then increases even more when not bumping. I know that may work but why did you do it like THAT? It's a bit weird that way.


#6

Wellllll, I did that way so you can do a rule that is when value is smaller than 5(to make it safe), you can put the code that you would want to when it is being bumped, and when it is not being bumped you would do, when value is bigger than 5, do the code when it is not being touched! Hope that helped to do with the value @Hoppertoscotch!


#7

@Phase_Studios ok. Now I understand and I make this post so you know I read this.


#8

@Phase_Studios your way works, but now I must make a new topic to help me with another part.


#9

you can do check if else. It is simpler than the way @Valgo shared.