Scratch to GdScript Reference - CoderDojo-Ennis/ScratchyGodot GitHub Wiki
This is a reference to help Scratch programmers find the equivalent features using the Godot game engine and the GdScript language
Coming Soon
Coming Soon
Coming Soon
Scratch | Godot | Details |
---|---|---|
class_name MySprite extends Sprite2D
func _ready: |
Each script will have one _ready() function where you can put things to do at the start | |
if Input.is_key_pressed(KEY_SPACE): |
This will be a check in the _process() of the scene or a sprite script | |
func _input(event):
if event is InputEventMouseButton and event.pressed:
if get_rect().has_point(to_local(event.position)):
print("You clicked the cat!") |
There are lots of ways to do this depending on how specific you need to be. |
|
|
||
|
||
func _ready() -> void:
Events.PlayerScored.connect(OnPlayerScored)
func OnPlayerScored(points):
print("Player got " + str(points) + " points!") |
This requires the signal being added to the Events global script | |
Events.PlayerScored.emit() |
This requires the signal being added to the Events global script | |
Events.PlayerScored.emit()
await Events.ScoreUpdated |
This requires two signals being added to the Events global script. One for the event you’re sending, and one for the one you want to wait for |
Coming Soon
Coming Soon
Coming Soon
Coming Soon
Coming Soon