picking pokemon sorta

main
RageCage64 3 years ago
parent e01ea1309f
commit d82b3afeb1

@ -33,5 +33,77 @@ __gfx__
00000000000000000000000000000000000000000000b000000b000000000000000000000000b000000b00000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000b000000b000000000000000000000000b000000b00000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000b00000000b0000000000000000000000b00000000b0000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000b00000000b0000000000000000000000b00000000b0000000000000000000000000000000000000000000
000000000000000000000000000000000000000000b0000000000b00000000000000000000b0000000000b000000000000000000000000000000000000000000 000000000000000000000000000000000000000000b0000000000b00000000000000000000b0000000000b000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000077000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000077000
__sfx__ __sfx__
000300001c3501d3501c15020150261502e1502e3501d15027150381500000000000000001d3501c350193501735014350113500c350093500535000350123000f3000e3000b3000830004300003000000000000 000300001c3501d3501c15020150261502e1502e3501d15027150381500000000000000001d3501c350193501735014350113500c350093500535000350123000f3000e3000b3000830004300003000000000000

@ -0,0 +1,127 @@
require("pokemon.lua")
require("textbox.lua")
require("menu.lua")
function new_game(start_state)
return {
player = nil,
enemy = nil,
main_txb = new_textbox(2, 98, 124, 124),
menu = nil,
state = start_state,
lockout = 0,
}
end
function new_state(name, init, draw, update, next, timer)
return {
name = name,
init = init,
draw = draw,
update = update,
next = next,
timer = timer,
next_state = false,
}
end
function start_menu()
init = function(g)
end
update = function(g)
if btn(4) then
return true
end
return false
end
draw = function(g)
print("welcome to pico-mon!", 0, 0)
print("press a to continue", 0, 10)
end
return new_state("start_menu", init, draw, update, "pick_player")
end
function pick_state(enemy, name, next)
init = function(g)
g.lockout = 2
menu = pokemon_menu()
g.menu = menu
if enemy then
g.main_txb.current_text = "choose your enemy's pokemon"
else
g.main_txb.current_text = "choose your pokemon"
end
end
update = function(g)
if g.lockout > 0 then
g.lockout = g.lockout - 1
return false
end
if btn(2) then
m_up(g.menu)
elseif btn(3) then
m_down(g.menu)
end
if btn(4) then
p_name = m_select(g.menu)
p = choose(p_name, enemy)
if enemy then
g.enemy = p
else
g.player = p
end
g.menu = nil
return true
end
return false
end
draw = function(g)
draw_m(g.menu)
draw_txb(g.main_txb)
end
return new_state(name, init, draw, update, next)
end
function appear_enemy()
init = function(g)
appear(g.enemy)
g.main_txb.current_text = "enemy " .. g.enemy.name .. " appeared!"
end
update = function(g)
end
draw = function(g)
draw_p(g.enemy)
draw_txb(g.main_txb)
end
return new_state("appear_enemy", init, draw, update, "appear_player", 80)
end
function appear_player()
init = function(g)
appear(g.player)
g.main_txb.current_text = "go " .. g.player.name .. "!"
end
update = function(g)
end
draw = function(g)
draw_p(g.enemy)
draw_p(g.player)
draw_txb(g.main_txb)
end
return new_state("appear_player", init, draw, update, "appear_player", 80)
end

@ -1,36 +1,40 @@
require("pokemon.lua") require("pokemon.lua")
require("textbox.lua") require("textbox.lua")
require("game.lua")
main_txb = new_textbox(2, 98, 124, 124)
enemy_x = 78
enemy_y = 8
player_x = 12
player_y = 56
function _init() function _init()
cls(0) cls(0)
p_player = axoleafel(false)
p_player.x = player_x
p_player.y = player_y
p_enemy = axoleafel(true)
p_enemy.x = enemy_x
p_enemy.y = enemy_y
-- appear(p_enemy) states = {}
-- main_txb.current_text = "enemy " .. p_enemy.name .. " appeared!" states["start_menu"] = start_menu()
states["pick_player"] = pick_state(false, "pick_player", "pick_enemy")
states["pick_enemy"] = pick_state(true, "pick_enemy", "appear_enemy")
states["appear_enemy"] = appear_enemy()
states["appear_player"] = appear_player()
-- states["player_turn"] = new_state("player_turn")
appear(p_player) gm = new_game("start_menu")
main_txb.current_text = "go " .. p_enemy.name .. "!" states[gm.state].init(gm)
end end
function _draw() function _draw()
cls(0) cls(0)
draw_p(p_enemy) states[gm.state].draw(gm)
draw_p(p_player)
draw_txb(main_txb)
end end
function _update() function _update()
next_state = states[gm.state].update(gm)
t = states[gm.state].timer
if t then
if t <= 0 then
next_state = true
end
states[gm.state].timer = t - 1
end
if next_state then
gm.state = states[gm.state].next
states[gm.state].init(gm)
end
end end

@ -0,0 +1,51 @@
-- Constructor
cursor_spr = 207
function new_menu(x, y, w, h, options)
return {
x = x,
y = y,
w = w,
h = h,
options = options,
cursor = 1,
}
end
-- Menu methods
function pokemon_menu()
return new_menu(60, 8, 88, 68, {
"axoleafel",
})
end
function draw_m(m)
rect(m.x, m.y, m.w, m.h)
for i,o in ipairs(m.options) do
r = i-1
o_x = m.x+14
o_y = m.y+4+(8*r)
print(o, o_x, o_y)
end
spr(cursor_spr, m.x+14, m.y+4+(8*m.cursor))
end
function m_down(m)
if m.cursor == 1 then
m.cursor = table.getn(m.options)
end
end
function m_up(m)
if m.cursor == table.getn(m.options) then
m.cursor = 1
end
end
function m_select(m)
return m.options[m.cursor]
end

@ -1,6 +1,18 @@
-- 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
enemy_y = 8
player_x = 12
player_y = 56
p_x = player_x
p_y = player_y
if enemy then
p_x = enemy_x
p_y = enemy_y
end
return { return {
name = name, name = name,
enemy = enemy, enemy = enemy,
@ -9,8 +21,8 @@ function new_pokemon(name, enemy, front_sprite, back_sprite, cry)
cry = cry, cry = cry,
-- moves = moves, -- moves = moves,
x = 0, x = p_x,
y = 0, y = p_y,
appeared = false, appeared = false,
} }
@ -22,8 +34,6 @@ function appear(p)
if p.appeared then if p.appeared then
return return
end end
draw_p(p)
cry(p) cry(p)
p.appeared = true p.appeared = true
end end
@ -37,11 +47,11 @@ function draw_p(p)
end end
function draw_front(p) function draw_front(p)
draw(p.front_sprite, p.x, p.y) draw_p_spr(p.front_sprite, p.x, p.y)
end end
function draw_back(p) function draw_back(p)
draw(p.back_sprite, p.x, p.y) draw_p_spr(p.back_sprite, p.x, p.y)
end end
function cry(p) function cry(p)
@ -50,6 +60,12 @@ end
--Pokemon --Pokemon
function choose(name, enemy)
if name == "axoleafel" then
return axoleafel(enemy)
end
end
function axoleafel(enemy) function axoleafel(enemy)
return new_pokemon( return new_pokemon(
"axoleafel", "axoleafel",
@ -63,7 +79,7 @@ end
-- Functions -- Functions
function draw(start, x, y) function draw_p_spr(start, x, y)
for i=0,3 do for i=0,3 do
tile_row = 16 * i tile_row = 16 * i
spr_row = 8 * i spr_row = 8 * i

Loading…
Cancel
Save