demo-game/scripts/sprite_atlas.gd
simon a32a223881 Add split-screen Space Shooter with pod steering and boost.
Two-player mode with client assignment, 3D vector calibration for cylindrical
pods, lives, tap/double-tap boost with low-intensity LED cooldown feedback,
and Kenney sprite assets.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 18:56:55 +02:00

41 lines
938 B
GDScript

class_name SpriteAtlas
extends RefCounted
static var _sheet: Texture2D
static func sheet() -> Texture2D:
if _sheet == null:
_sheet = load("res://assets/Spritesheet/sheet.png")
return _sheet
static func region(x: int, y: int, w: int, h: int) -> AtlasTexture:
var tex := AtlasTexture.new()
tex.atlas = sheet()
tex.region = Rect2i(x, y, w, h)
return tex
static func named(name: String) -> AtlasTexture:
match name:
"meteorBrown_big1":
return region(224, 664, 101, 84)
"playerShip1_blue":
return region(211, 941, 99, 75)
"playerShip1_orange":
return region(247, 84, 99, 75)
"laserBlue01":
return region(856, 421, 9, 54)
"laserRed01":
return region(858, 230, 9, 54)
"laserGreen01":
return region(855, 173, 9, 57)
"star1":
return region(628, 681, 25, 24)
"star2":
return region(222, 84, 25, 24)
_:
push_warning("SpriteAtlas: unknown sprite '%s'" % name)
return region(0, 0, 1, 1)