I am trying to create the collision effect in this app. But it does not work as expected. When the bunny touches the dog, I want the bunny to bounce off.
Can someone help please. Sprite Lab bounceoff
I am trying to create the collision effect in this app. But it does not work as expected. When the bunny touches the dog, I want the bunny to bounce off.
Can someone help please. Sprite Lab bounceoff
The bounce off
block works by changing the movement direction of a sprite. This means it works best with sprites that are moving with behaviors that include a move forward
block. Behaviors like moving with arrow keys
use the move in direction
block. This block will only ever move the sprite in the chosen direction and is not affected by a sprite’s movement direction
.
It looks like you’ve possibly changed your code since you posted, but one way to achieve a similar kind of effect is to use a while touches
event with a move pixels toward
block (using a negative value to move away).
I hope this helps!
Thank you! That does address what I wanted to do to a certain extent. However, at some point it does not block the bunny. The bunny can move right through the sprite. I was looking to implement a block and deflect activity
Try changing when touches
to while touches
and see if that makes a difference.