Aego Русский

Editor

The editor's code editor, navigation, completion, hover, library stubs, Problems panel and Profiler sections for scripts are described in Editor. Unsaved edits are analysed but never run; autosave writes them one second after the last keystroke, on focus loss and before Play.

Run it: in the code editor, hover over Turret, Range or Rate to see the comments above them; the Inspector groups the fields by category.

package demo

import "aego/log"

// Turret aims at the nearest target. This comment is shown on hover.
script Turret {
    // Range is how far the turret sees, in world units.
    @export(min=0, max=20, unit="u", category="Aim")
    var Range float = 8

    // Rate is shots per second.
    @export(min=0.1, max=10, category="Fire")
    var Rate float = 2

    var cooldown float
    var shots int

    func Update(dt float) {
        cooldown -= dt
        if cooldown <= 0 {
            cooldown = 1 / Rate
            shots++
            if shots % 2 == 0 {
                log.Info("shot " + string(shots) + " at range " + string(Range))
            }
        }
    }
}