← Back to Documentation

Pup Language

⚠️ Experimental - Pre-Release

Pup is Perro's native scripting language - a beginner-friendly language designed specifically for game development. Clean syntax, powerful features, and seamless integration with Perro's engine systems.

Script Definition

Scripts are defined with the @script directive:

@script Player extends Sprite2D    var speed = 7.5     fn init() {        Console.print("Player is ready!")        set_speed(2.1)    }     fn set_speed(new_speed: float) {        speed = new_speed    }     fn update() {        var delta = Time.get_delta()        self.transform.position.x += speed * delta    }

Variables

Declare variables with the var keyword:

var health = 100var name = "Player"var position = new Vector2(0.0, 0.0)var is_alive = true

Functions

Define functions with fn:

fn my_function(param: float) {    Console.print("Parameter: " + param)} fn get_health() -> int {    return health}

Signals

Use the on keyword for automatic signal connection:

on start_Pressed() {    Console.print("Start button pressed!")} on player_Died() {    // Handle player death}

See the Signals documentation for more details.

Types

  • int - Integer numbers
  • float - Floating point numbers
  • string - Text strings
  • bool - Boolean (true/false)
  • Node, Node2D, etc. - Node types

Related

  • Signals- Signal system documentation