scripts

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package scripts holds this game's custom types. This is the pattern for extending Collider: embed *engine.Object in your own struct, add fields and methods, and the result is both a full engine object (Move, OnCollisionWith, velocity...) and your own domain type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chaser

type Chaser struct {
	*engine.Object
	// contains filtered or unexported fields
}

Chaser is an engine object extended with its own hunting speed.

func NewChaser

func NewChaser(s *engine.Scene, target *Player) *Chaser

NewChaser spawns an animated chaser on a random screen edge, hunting the player at a speed that varies per individual.

type Player

type Player struct {
	*engine.Object
	HP int
	// contains filtered or unexported fields
}

Player is an engine object extended with hit points and damage rules.

func NewPlayer

func NewPlayer(g *engine.Game, s *engine.Scene) *Player

NewPlayer creates the animated player in a scene and wires movement.

func (*Player) Knockback

func (p *Player) Knockback(fromX, fromY float64)

Knockback shoves the player away from a point of impact.

func (*Player) Reset

func (p *Player) Reset()

Reset restores the player's stats for a fresh round. Position is handled by the engine's Restart snapshot; stats are the game's job.

func (*Player) TakeDamage

func (p *Player) TakeDamage(n int) bool

TakeDamage applies damage unless the player is in the invulnerability window, then opens a new window for one second. Reports whether the hit landed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL