New Game topic
This commit is contained in:
parent
299efaf0f2
commit
3782d26e64
@ -1,6 +1,27 @@
|
||||
# Touching
|
||||
|
||||
Reports true if sprite is touching specified sprite
|
||||
Find whether the sprite is touching another sprite you say.
|
||||
|
||||
Sprites are touching if they share the same LED.
|
||||
|
||||
```sig
|
||||
let item: game.LedSprite = null;
|
||||
item.isTouching(null);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
* another **sprite** that might be touching the one you are checking
|
||||
|
||||
### Returns
|
||||
|
||||
`true` if the two sprites are touching.
|
||||
|
||||
### Example
|
||||
|
||||
This program creates two sprites called ``matter`` and ``antimatter``,
|
||||
and then checks whether they are touching. If they are, there is an
|
||||
explosion.
|
||||
|
||||
```blocks
|
||||
let matter = game.createSprite(2, 2);
|
||||
@ -11,3 +32,8 @@ if (matter.isTouching(antimatter)) {
|
||||
basic.showString("BOOM!");
|
||||
}
|
||||
```
|
||||
|
||||
### See also
|
||||
|
||||
[touching edge](/reference/game/touching-edge),
|
||||
[if on edge, bounce](/reference/game/if-on-edge-bounce)
|
||||
|
Loading…
Reference in New Issue
Block a user