tags:

views:

16

answers:

1

In Scratch, there is a condition in the sensing category called touching, that can have edge as a parameter.

Given that the condition returns true, how can I tell which edge was touched (i.e. top, bottom, left or right edge of scene)?

Alternatively: How to tell the dimensions of a scene? I have worked out that position (x=0, y=0) is in the middle of the scene. Where are the four corner point located?

+1  A: 

Make 4 sprites, all thin lines of any color you want. Two vertical, and two horizontal. Place them at the edges of your project. Add a start block followed by a set effect ghost to 100 block in each of these four lines. This hides the line when the project is played. If you name the lines top, bottom, left, right, it's easy to test which edge a different sprite touches, because you can have blocks run after one sprite touches another (the edges).

The whole project is 240 tall and 360 wide, with 0,0 being in the exact center. Always.

thenickperson
great! thank you!
Daren Thomas