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 = [ @sprite_index = [
"sprites/square/black.png", Sprite.for(:black),
"sprites/square/red.png", Sprite.for(:red),
"sprites/square/green.png", Sprite.for(:green),
"sprites/square/blue.png", Sprite.for(:blue),
"sprites/square/yellow.png", Sprite.for(:yellow),
"sprites/square/indigo.png", Sprite.for(:indigo),
"sprites/square/violet.png", Sprite.for(:violet),
"sprites/square/orange.png", Sprite.for(:orange),
"sprites/square/gray.png", Sprite.for(:gray)
] ]
@grid = [] @grid = []

View file

@ -2,14 +2,24 @@ module Sprite
# annoying to track but useful for reloading with +i+ in debug mode; would be # annoying to track but useful for reloading with +i+ in debug mode; would be
# nice to define a different way # nice to define a different way
SPRITES = { SPRITES = {
bullet: "sprites/bullet.png", bullet: 'sprites/bullet.png',
enemy: "sprites/enemy.png", enemy: 'sprites/enemy.png',
enemy_king: "sprites/enemy_king.png", enemy_king: 'sprites/enemy_king.png',
enemy_super: "sprites/enemy_super.png", enemy_super: 'sprites/enemy_super.png',
exp_chip: "sprites/exp_chip.png", exp_chip: 'sprites/exp_chip.png',
familiar: "sprites/familiar.png", familiar: 'sprites/familiar.png',
player: "sprites/player.png", player: 'sprites/player.png',
pause: "sprites/pause.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 class << self