New Game topic, some fixes
This commit is contained in:
parent
3782d26e64
commit
3e23fe4814
40
docs/reference/game/touching-edge.md
Normal file
40
docs/reference/game/touching-edge.md
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Touching Edge
|
||||||
|
|
||||||
|
Find whether the sprite is touching the edge of the [LED screen](/device/screen).
|
||||||
|
|
||||||
|
Sprites are touching the edge if they overlap with an LED on the edge
|
||||||
|
of the screen.
|
||||||
|
|
||||||
|
```sig
|
||||||
|
let item: game.LedSprite = null;
|
||||||
|
item.isTouchingEdge();
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
* a **sprite** that might be touching the edge of the screen
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
|
||||||
|
`true` if the sprite is touching the edge of the screen
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
This program makes a sprite in the middle of the left edge of the LED screen.
|
||||||
|
Then it says `EDGY!` if it's on the edge (which it is!), and `SAFE!` if it's
|
||||||
|
not on the edge.
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
let item = game.createSprite(0, 2);
|
||||||
|
if (item.isTouchingEdge()) {
|
||||||
|
basic.showString("EDGY!");
|
||||||
|
} else {
|
||||||
|
basic.showString("SAFE!");
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### See also
|
||||||
|
|
||||||
|
[create sprite](/reference/game/create-sprite),
|
||||||
|
[touching](/reference/game/touching),
|
||||||
|
[if on edge, bounce](/reference/game/if-on-edge-bounce)
|
@ -11,6 +11,7 @@ item.isTouching(null);
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
|
* a **sprite** you are checking
|
||||||
* another **sprite** that might be touching the one you are checking
|
* another **sprite** that might be touching the one you are checking
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
@ -35,5 +36,6 @@ if (matter.isTouching(antimatter)) {
|
|||||||
|
|
||||||
### See also
|
### See also
|
||||||
|
|
||||||
|
[create sprite](/reference/game/create-sprite),
|
||||||
[touching edge](/reference/game/touching-edge),
|
[touching edge](/reference/game/touching-edge),
|
||||||
[if on edge, bounce](/reference/game/if-on-edge-bounce)
|
[if on edge, bounce](/reference/game/if-on-edge-bounce)
|
||||||
|
Loading…
Reference in New Issue
Block a user