SiliconGhetto Engine API
    Preparing search index...

    Function spawnProjectile

    • Spawn a new projectile at a position, moving in a direction.

      Parameters

      • x: number

        Starting X position

      • y: number

        Starting Y position

      • dirX: number

        Horizontal direction component (will be normalized)

      • dirY: number

        Vertical direction component (will be normalized)

      • speed: number

        Movement speed in pixels per second

      • opts: ProjectileOpts = {}

        Optional projectile settings (damage, lifetime, owner, size, color)

      Returns number

      The projectile entity ID

      sg.spawnProjectile(player.x, player.y, 1, 0, 300, { damage: 25 });