cleanup before next section

main
RageCage64 3 years ago
parent d82b3afeb1
commit 2418f8beb7

@ -1,17 +1,12 @@
require("pokemon.lua")
require("textbox.lua")
require("game.lua") require("game.lua")
function _init() function _init()
cls(0)
states = {} states = {}
states["start_menu"] = start_menu() states["start_menu"] = start_menu()
states["pick_player"] = pick_state(false, "pick_player", "pick_enemy") states["pick_player"] = pick_state(false, "pick_player", "pick_enemy")
states["pick_enemy"] = pick_state(true, "pick_enemy", "appear_enemy") states["pick_enemy"] = pick_state(true, "pick_enemy", "appear_enemy")
states["appear_enemy"] = appear_enemy() states["appear_enemy"] = appear_enemy()
states["appear_player"] = appear_player() states["appear_player"] = appear_player()
-- states["player_turn"] = new_state("player_turn")
gm = new_game("start_menu") gm = new_game("start_menu")
states[gm.state].init(gm) states[gm.state].init(gm)

@ -1,7 +1,9 @@
-- Constructor -- Constants
cursor_spr = 207 cursor_spr = 207
-- Constructor
function new_menu(x, y, w, h, options) function new_menu(x, y, w, h, options)
return { return {
x = x, x = x,

@ -1,16 +1,11 @@
-- Constructor -- Constructor
function new_pokemon(name, enemy, front_sprite, back_sprite, cry) function new_pokemon(name, enemy, front_sprite, back_sprite, cry)
enemy_x = 78 p_x = 12
enemy_y = 8 p_y = 56
player_x = 12
player_y = 56
p_x = player_x
p_y = player_y
if enemy then if enemy then
p_x = enemy_x p_x = 78
p_y = enemy_y p_y = 8
end end
return { return {
@ -19,7 +14,6 @@ function new_pokemon(name, enemy, front_sprite, back_sprite, cry)
front_sprite = front_sprite, front_sprite = front_sprite,
back_sprite = back_sprite, back_sprite = back_sprite,
cry = cry, cry = cry,
-- moves = moves,
x = p_x, x = p_x,
y = p_y, y = p_y,
@ -38,6 +32,10 @@ function appear(p)
p.appeared = true p.appeared = true
end end
function cry(p)
sfx(p.cry)
end
function draw_p(p) function draw_p(p)
if p.enemy then if p.enemy then
draw_front(p) draw_front(p)
@ -54,8 +52,16 @@ function draw_back(p)
draw_p_spr(p.back_sprite, p.x, p.y) draw_p_spr(p.back_sprite, p.x, p.y)
end end
function cry(p) function draw_p_spr(start, x, y)
sfx(p.cry) for i=0,3 do
tile_row = 16 * i
spr_row = 8 * i
for k=0,3 do
spr_column = 8 * k
tile = start + tile_row + k
spr(tile, x+spr_column, y+spr_row)
end
end
end end
--Pokemon --Pokemon
@ -76,17 +82,3 @@ function axoleafel(enemy)
-- {} -- {}
) )
end end
-- Functions
function draw_p_spr(start, x, y)
for i=0,3 do
tile_row = 16 * i
spr_row = 8 * i
for k=0,3 do
spr_column = 8 * k
tile = start + tile_row + k
spr(tile, x+spr_column, y+spr_row)
end
end
end

Loading…
Cancel
Save