Skip to content

Commit f733711

Browse files
author
Mike Barkmin
committed
Update README
1 parent 72f03d5 commit f733711

13 files changed

+45
-1
lines changed

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@ To add a new backdrop call `stage.addBackdrop("newBackdrop",
4848
"path/to/newBackdrop.png");`. Afterwards you can swith to the backdrop by calling
4949
`stage.switchBackdrop("newBackdrop");`.
5050

51+
#### Sensing
52+
53+
| Scratch | Processing |
54+
| :-: | :-: |
55+
| ![stage mouse down](web/assets/sprite_mouse_down.png) | `stage.isMouseDown()` |
56+
| ![stage mouse x](web/assets/sprite_mouse_x.png) | `stage.getMouseX()` |
57+
| ![stage mouse y](web/assets/sprite_mouse_y.png) | `stage.getMouseY()` |
58+
| ![stage is key pressed](web/assets/sprite_key_pressed.png) | `stage.isKeyPressed(32)` <br> For key pressed you need to use key codes see https://keycode.info/ to find the appropriate one. |
59+
| ![stage current ?](web/assets/sprite_current_time.png) | `stage.getCurrentYear()`, `stage.getCurrentDay()`, `stage.getCurrentHour()`, `stage.getCurrentMinute()`, `stage.getCurrentSecond()`, `stage.getCurrentMillisecond()`, `stage.getCurrentDayOfWeek()` |
60+
61+
#### Events
62+
63+
| Scratch | Processing |
64+
| :-: | :-: |
65+
| ![stage when key pressed](web/assets/sprite_when_keypressed.png) | Overwrite `stage.keyEvent(KeyEvent e)`. The method will be called everytime a new KeyEvent is fired. For example when pressing or releasing a key. See [KeyEvent](https://processing.github.io/processing-javadocs/core/processing/event/KeyEvent.html) for more Information. |
66+
| ![stage when move moved](web/assets/sprite_when_mouse_moved.png) | Overwrite `stage.mouseEvent(MouseEvent e)`. The method will be called everytime a new MouseEvent is fired. For example when pressing, releasing or moving the mouse. See [MouseEvent](https://processing.github.io/processing-javadocs/core/processing/event/MouseEvent.html) for more Information. |
5167

5268
#### Sound
5369

@@ -148,6 +164,26 @@ To add a new costume call `sprite.addCostume("newCostume",
148164
"path/to/newCostume.png");`. Afterwards you can swith to the costume by calling
149165
`sprite.switchCostume("newCostume");`.
150166

167+
#### Sensing
168+
169+
| Scratch | Processing |
170+
| :-: | :-: |
171+
| ![sprite mouse down](web/assets/sprite_mouse_down.png) | `sprite.isMouseDown()` |
172+
| ![sprite mouse x](web/assets/sprite_mouse_x.png) | `sprite.getMouseX()` |
173+
| ![sprite mouse y](web/assets/sprite_mouse_y.png) | `sprite.getMouseY()` |
174+
| ![sprite is key pressed](web/assets/sprite_key_pressed.png) | `sprite.isKeyPressed(32)` <br> For key pressed you need to use key codes see https://keycode.info/ to find the appropriate one. |
175+
| ![sprite current ?](web/assets/sprite_current_time.png) | `sprite.getCurrentYear()`, `sprite.getCurrentDay()`, `sprite.getCurrentHour()`, `sprite.getCurrentMinute()`, `sprite.getCurrentSecond()`, `sprite.getCurrentMillisecond()`, `sprite.getCurrentDayOfWeek()` |
176+
| ![sprite touching mouse pointer](web/assets/sprite_touching_mouse_pointer.png) | `sprite.isTouchingMousePointer()` |
177+
| ![sprite touching edge](web/assets/sprite_touching_edge.png) | `sprite.isTouchingEdge()` |
178+
| ![sprite touching sprite](web/assets/sprite_touching_sprite.png) | `sprite.isTouchingSprite(anotherSprite)` |
179+
180+
#### Events
181+
182+
| Scratch | Processing |
183+
| :-: | :-: |
184+
| ![sprite when key pressed](web/assets/sprite_when_keypressed.png) | Overwrite `sprite.keyEvent(KeyEvent e)`. The method will be called everytime a new KeyEvent is fired. For example when pressing or releasing a key. See [KeyEvent](https://processing.github.io/processing-javadocs/core/processing/event/KeyEvent.html) for more Information. |
185+
| ![sprite when move moved](web/assets/sprite_when_mouse_moved.png) | Overwrite `sprite.mouseEvent(MouseEvent e)`. The method will be called everytime a new MouseEvent is fired. For example when pressing, releasing or moving the mouse. See [MouseEvent](https://processing.github.io/processing-javadocs/core/processing/event/MouseEvent.html) for more Information. |
186+
151187
#### Sound
152188

153189
When you work with sound you need to install
@@ -358,10 +394,18 @@ A little game developed which this library.
358394

359395
![color_hit](web/assets/color_hit.gif)
360396

397+
## Clock
398+
399+
Source Code: https://github.com/mikebarkmin/processing-library-scratch/tree/master/examples/Clock
400+
401+
Shows the sensing time methods
402+
403+
![clock](web/assets/clock.gif)
404+
405+
361406
## Missing
362407

363408
* blocks which are not listed above are currently missing
364-
* sprites can not sense something. E.g.: a color or another sprite
365409
* sprites can not speak or think
366410

367411
## How to install Scratch

web/assets/clock.gif

55.3 KB
Loading

web/assets/sound_play.png

-373 Bytes
Loading

web/assets/sprite_current_time.png

3.06 KB
Loading

web/assets/sprite_key_pressed.png

3.55 KB
Loading

web/assets/sprite_mouse_down.png

594 Bytes
Loading

web/assets/sprite_mouse_x.png

3.94 KB
Loading

web/assets/sprite_mouse_y.png

12.8 KB
Loading

web/assets/sprite_touching_edge.png

4.48 KB
Loading
5.39 KB
Loading

0 commit comments

Comments
 (0)