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

image MOTION

Coming Soon

image LOOKS

Coming Soon

image SOUND

Coming Soon

image EVENTS

Scratch Godot Details

image

class_name MySprite extends Sprite2D
    func _ready:
Each script will have one _ready() function where you can put things to do at the start

image

if Input.is_key_pressed(KEY_SPACE):
This will be a check in the _process() of the scene or a sprite script

image

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.

How to detect a click on a Sprite in Godot (EASY) - YouTube

image

image

image

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

image

Events.PlayerScored.emit()
This requires the signal being added to the Events global script

image

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

image CONTROL

Coming Soon

image SENSING

Coming Soon

image OPERATORS

Coming Soon

image VARIABLES

Coming Soon

image MY BLOCKS

Coming Soon

⚠️ **GitHub.com Fallback** ⚠️