Use scale's reloadable sprites

This commit is contained in:
Gordon Pedersen 2023-03-08 15:11:59 +11:00
parent d77677ae6a
commit 02572450c7
2 changed files with 27 additions and 17 deletions

View file

@ -34,15 +34,15 @@ class BlockTubeGame
]
@sprite_index = [
"sprites/square/black.png",
"sprites/square/red.png",
"sprites/square/green.png",
"sprites/square/blue.png",
"sprites/square/yellow.png",
"sprites/square/indigo.png",
"sprites/square/violet.png",
"sprites/square/orange.png",
"sprites/square/gray.png",
Sprite.for(:black),
Sprite.for(:red),
Sprite.for(:green),
Sprite.for(:blue),
Sprite.for(:yellow),
Sprite.for(:indigo),
Sprite.for(:violet),
Sprite.for(:orange),
Sprite.for(:gray)
]
@grid = []

View file

@ -2,14 +2,24 @@ module Sprite
# annoying to track but useful for reloading with +i+ in debug mode; would be
# nice to define a different way
SPRITES = {
bullet: "sprites/bullet.png",
enemy: "sprites/enemy.png",
enemy_king: "sprites/enemy_king.png",
enemy_super: "sprites/enemy_super.png",
exp_chip: "sprites/exp_chip.png",
familiar: "sprites/familiar.png",
player: "sprites/player.png",
pause: "sprites/pause.png",
bullet: 'sprites/bullet.png',
enemy: 'sprites/enemy.png',
enemy_king: 'sprites/enemy_king.png',
enemy_super: 'sprites/enemy_super.png',
exp_chip: 'sprites/exp_chip.png',
familiar: 'sprites/familiar.png',
player: 'sprites/player.png',
pause: 'sprites/pause.png',
gray: 'sprites/square/gray.png',
black: 'sprites/square/black.png',
white: 'sprites/square/white.png',
red: 'sprites/square/red.png',
green: 'sprites/square/green.png',
blue: 'sprites/square/blue.png',
yellow: 'sprites/square/yellow.png',
indigo: 'sprites/square/indigo.png',
violet: 'sprites/square/violet.png',
orange: 'sprites/square/orange.png'
}
class << self