๐Ÿค Simple Interactions - myBetabox

๐Ÿค Simple Interactions

Play Me!

ย 
Did you see how the bear only said “Good morning!” once it got close to the dino?

Often times, weโ€™ll want to be able to write some code that happens when two sprites touch each other. This could be things like:

  • A laser beam touches an enemy in a game
  • A character touches another character while walking across the screen
  • Any other ideas?

In Scratch, this is really easy!

For example, letโ€™s say we want a character to say โ€œExcuse me!โ€ when she walks past another character, like this:

We can have the first character walk across the screen as usual, but use anย if/elseย block to check if sheโ€™s touching the other character.

Your Turn!

Watch this video to create a simple sprite interaction. Once you’ve done that, can you do the same thing with other sprites?