Compare commits

..

No commits in common. 'main' and 'display' have entirely different histories.

@ -10,22 +10,22 @@ __gfx__
0000000000000000000000000000000000000000000000000000000000000b00000bb00000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000bbb000bbbbbbbbbbbbbbbbbb000bb000000bb0bbbbbbbbbbbbbbbbbb0000b0000000000000000000000000000000000
00000000000000000000000000000000000bb00bbbbbbbbbbbbbbbbbb00bb000b0000bbbbbbbbbbbbbbbbbbbb0bbb00000000000000000000000000000000000
0000000000000000000000000000000000000bbbbbbbbbbbbbbbbbbbb00b0000bb0000bbbbbbbbbbbbbbbbbbbbb0000004400000000000000000000000000000
000000000000000000000000000004440000000bbbbbbbbbbbbbbbbbb0b000000bbb000bbbbbbbbbbbbbbbbbbb00000044440000000000000000000000000000
00000000dddddddddddddddddd0044040000000bbbb007bbbb700bbbbbb000000000bbbbbbbbbbbbbbbbbbbbb000000040044400dddddddddddddddddd000000
00000000dd000ddddddddddddd444004000bbbbbbbb007bbbb700bbbbb0000000000000bbbbbbbbbbbbbbbbbbb00000040000440ddddddddddddd007dd000000
00000000dd000ddddddddddddd40040400bb000bbbb000bbbb000bbbb00000000000000bbbbbbbbbbbbbbbbbbbbb000044040004ddddddddddddd000dd000000
00000000dd700ddddddddddddd04000400000bbbbbb000bbbb000bbbbb00000000000bbbbbbbbbbbbbbbbbbbb00b000004040044ddddddddddddd000dd000000
0aa0aaaaaddddddddddddddddd00044400000b0bbbbbbbbbbbbbbbbbbbbbb000000bbb0bbbbbbbbbbbbbbbbbb000bb0004004000dddddddddddddddddaaaa0aa
0aaaaaaaaddddddddddddddddd4044000000bb0bbbbbbbbbbbbbbbbbb00000000bbb000bbbbbbbbbbbbbbbbbb0000b0004440040dddddddddddddddddaaaaaaa
000000aaaddddddddddddddddd4440000000b00bbbbbbbbbbbbbbbbbbbbb0000bb00000bbbbbbbbbbbbbbbbbbbb0000000044444dddddddddddddddddaaa0000
0aaaaaaaaddddddddddddddddd000000000bb00bbbbbbbbbbbbbbbbbb00bbb000000000bbbbbbbbbbbbbbbbbb0bb000000000000dddddddddddddddddaaaaaaa
0aaaaaaaaddddddddddddddddd000000000b000000000bbbbbb00000000000000000000000000bbbbbb000000000000000000000dddddddddddddddddaaaaaaa
00000000dddddddddddddddddd0000000000000000000bbbbbb00000000000000000000000000bbbbbb000000000000000000000dddddddddddddddddd000000
000000000099990990009099900000000000000000000bbbbbb00000000000000000000000000bbbbbb000000000000000000000009999099000909990000000
0000000000999909900990999000000000000000b0000bbbbbb0000b0000000000000000b0000bbbbbb0000b0000000000000000009999099009909990000000
00000000099999099909909990000000000000000bbbbbbbbbbbbbb000000000000000000bbbbbbbbbbbbbb00000000000000000099999099909909990000000
000000000090900090009090900000000000000000000bbbbbb00000000000000000000000000bbbbbb000000000000000000000009090009000909090000000
0000000000000000000000000000000000000bbbbbbbbbbbbbbbbbbbb00b0000bb0000bbbbbbbbbbbbbbbbbbbbb0000000000000000000000000000000000000
000000000000000000000000000000000000000bbbbbbbbbbbbbbbbbb0b000000bbb000bbbbbbbbbbbbbbbbbbb00000000000000000000000000000000000000
000000000000000000000000000000000000000bbbb007bbbb700bbbbbb000000000bbbbbbbbbbbbbbbbbbbbb000000000000000000000000000000000000000
00000000000000000000000000000000000bbbbbbbb007bbbb700bbbbb0000000000000bbbbbbbbbbbbbbbbbbb00000000000000000000000000000000000000
0000000000000000000000000000000000bb000bbbb000bbbb000bbbb00000000000000bbbbbbbbbbbbbbbbbbbbb000000000000000000000000000000000000
0000000000000000000000000000000000000bbbbbb000bbbb000bbbbb00000000000bbbbbbbbbbbbbbbbbbbb00b000000000000000000000000000000000000
0000000000000000000000000000000000000b0bbbbbbbbbbbbbbbbbbbbbb000000bbb0bbbbbbbbbbbbbbbbbb000bb0000000000000000000000000000000000
000000000000000000000000000000000000bb0bbbbbbbbbbbbbbbbbb00000000bbb000bbbbbbbbbbbbbbbbbb0000b0000000000000000000000000000000000
000000000000000000000000000000000000b00bbbbbbbbbbbbbbbbbbbbb0000bb00000bbbbbbbbbbbbbbbbbbbb0000000000000000000000000000000000000
00000000000000000000000000000000000bb00bbbbbbbbbbbbbbbbbb00bbb000000000bbbbbbbbbbbbbbbbbb0bb000000000000000000000000000000000000
00000000000000000000000000000000000b000000000bbbbbb00000000000000000000000000bbbbbb000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000bbbbbb00000000000000000000000000bbbbbb000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000bbbbbb00000000000000000000000000bbbbbb000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000b0000bbbbbb0000b0000000000000000b0000bbbbbb0000b0000000000000000000000000000000000000000
00000000000000000000000000000000000000000bbbbbbbbbbbbbb000000000000000000bbbbbbbbbbbbbb00000000000000000000000000000000000000000
000000000000000000000000000000000000000000000bbbbbb00000000000000000000000000bbbbbb000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000bbbbbb000bbbb000000000000bbbb000bbbbbb000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000bbbbbb0bb00000000000000000000bb0bbbbbb000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000bbbbbbb000000000000000000000000bbbbbbb000000000000000000000000000000000000000000000
@ -33,80 +33,5 @@ __gfx__
00000000000000000000000000000000000000000000b000000b000000000000000000000000b000000b00000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000b00000000b0000000000000000000000b00000000b0000000000000000000000000000000000000000000
000000000000000000000000000000000000000000b0000000000b00000000000000000000b0000000000b000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000550500550000000000555555555500005500005000050000000005500000000
00000000000000000000000000000000000000000000000000000000000000000505550005000000055555005005555555055555555005500000000555550555
00000000000000000000000000000000000000000000000000000000000000000505005550000000505055555555055550005505550005000000000005050005
00000000000000000000000000000000000000000000000000000000000000000505555505000000505555050000055055500505050005000000000005055055
00000000000000000000000000000000000000000000000000000000000000000550000555000000555050050666666006666660550055000000000005055550
00000000000000000000000000000000000000000000000000000000000000000066666000000000005550550666666006666660555050000000000006666600
00000000000000000000000000000000000000000000000000000000000000000066666000000000000066660666666006666660666600000000000006666600
00000000000000000000000000000000000000000000000000000000000000000066666000000000000066660666666006666660666600000000000006666600
0e000000000000000000000000bbbbb00b000000000000000000000000eeeee00066666000000000000066660666666006666660666600000000000006666600
0ee00000000000000000000000b000000bb00000000000000000000000e000000060006000000000000060060600006006000060600600000000000006000600
00eee00000000000000000000b00000000bbb00000000000000000000e0000006666666666666666666666666666666666666666666666666666666666666666
0000eeee1111111111111111100000000000bbbb1111111111111111100000006666666666666666666666666666666666666666666666666666666666666666
00000000111111111111111110000000000000001111111111111111100000006666666600066666666660006666666666666666666666666666666666666666
0222222210001111111110001aaaa0000aaaaaaa1111111111111111122220006666666607066666666660706666666666666666666666666666666666666666
00000000100011111111100010000000000000001111111111111111100000006666666600066666666660006666666666666666666666666666666666666666
00000000100711111111170010000000000000001111111111111111100000006666666666666666666666666666666666666666666666666666666666666666
00000000111111111111111110000000000000001111111111111111100000006666666666666666666666666666666666666666666666666666666666666666
00000333111111007701111118888800000008881111111111111111133333006666666666666666666666666666666666666666666666666666666666666666
03333300111111007701111110000000088888001111111111111111100000006666666666666666666666666666666666666666666666666666666666666666
03000000111111000001111110000000080000001111111111111111100000006666666666606666666606666666666666666666666666666666666666666666
00000000111111000001111110000000000000001111111111111111100000006666666666660666666066666666666666666666666666666666666666666666
0000000f11111100000111111ccc00000000000c11111111111111111fff00006666666666666000000666666666666666666666666666666666666666666666
00000fff1111111111111111100cc00000000ccc1111111111111111100ff0006666666666666666666666666666666666666666666666666666666666666666
0000ff0000000000000000000000ccc00000cc0000000000000000000000fff06666666666666666666666666666666666666666666666666666666666666666
00fff00000000000000000000000000000ccc0000000000000000000000000006666666666666666666666666666666666666666666666666666666666666666
00f0000000000000000000000000000000c000000000000000000000000000006666666666666666666666666666666666666666666666666666666666666666
00000000000000000000000000000000000000000000000000000000000000000000000000066000000660000000000000000000000660000006600000000000
00000000000000000000000000000000000000000000000000000000000000000000000000066000000660000000000000000000000660000006600000000000
00000000000000000000000000000000000000000000000000000000000000000000000000066000000660000000000000000000000660000006600000000000
00000000000000000000000000000000000000000000000000000000000000000000660000066000000660000066000000006600000660000006600000660000
00000000000000000000000000000000000000000000000000000000000000000000666666666000000666666666000000006666666660000006666666660000
00000000000000000000000000000000000000000000000000000000000000000000666666666000000666666666000000006666666660000006666666660000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000011111000000000000000000000000000111110000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000001ccc10000000000000000000000000001ccc10000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000001ccc10000000000000000000000000001ccc10000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000001ccc10000000000000000000000000001ccc10000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000001ccc10000000000000000000000000001ccc10000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000001ccc10000000000000000000000000001ccc10000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000001ccc10000000000000000000000000001ccc10000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000001ccc10000000000000000000000000001ccc10000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000001ccc10000000000000000000000000001ccc10000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000001ccc10000000000000000000000000001ccc10000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000001ccc10000000000000000011100111101ccc10000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000111101ccc1011110011100000001c1001cc101ccc10111100000000000000000000000000000000000000000000000000000000000000000000000
00000000001cc101ccc101cc1001c100000001c1001cc101ccc101cc100000000000000000000000000000000000000000000000000000000000000000000000
00000000001cc101ccc101cc1001c100000001c1001cc101ccc101cc100000000000000000000000000000000000000000000000000000000000000000000000
00000000001cc111ccc101cc1001c100000001c1111cc111ccc101cc100000000000000000000000000000000000000000000000000000000000000000000000
00000000001cc111ccc111cc1111c100000001c1111cc111ccc111cc100000000000000000000000000000000000000000000000000000000000000000000000
00000000001cc111ccc111cc1111c100000001c1111cc111ccc111cc100001100000000000000000000000000000000000000000000000000000000000000000
00011100001cccccccccccccccccc100000001cccccccccccccccccc10001cc10000000000000000000000000000000000000000000000000000000000000000
0001c110001cccccccccccccccccc100000001cccccccccccccccccc10011cc10000000000000000000000000000000000000000000000000000000000000000
0001cc11001cccccccccccccccccc100000001cccccccccccccccccc1011ccc10000000000000000000000000000000000000000000000000000000000000000
0001cccc101cccccccccccccccccc100000001cccccccccccccccccc11ccccc10000000000000000000000000000000000000000000000000000000000000000
0001ccccc11cccccccccccccccccc100000001cccccccccccccccccc1cccccc10000000000000000000000000000000000000000000000000000000000000000
00011ccccc1cccccccccccccccccc100000001cccccccccccccccccc1ccccc110000000000000000000000000000000000000000000000000000000000000000
00001ccccc1cccccccccccccccccc100000001cccccccccccccccccccccccc100000000000000000000000000000000000000000000000000000000000000000
0000011ccccccccccccccccccccc1000000001ccccccccccccccccccccccc1000000000000000000000000000000000000000000000000000000000000000000
0000001cccccccccccccccccccc10000000001ccccccccccccccccccccccc1000000000000000000000000000000000000000000000000000000000000000000
00000001111cccccccccccccccc1000000000011ccccccccccccccccccc110000000000000000000000000000000000000000000000000000000000000000000
00000000001ccccccccccccc11100000000000011cccccccccccccccc11000000000000000000000000000000000000000000000000000000000000000000000
00000000001ccccccccccccc100000000000000111cccccccccccccc100000000000000000000000000000000000000000000000000000000000000000000000
00000000001111111111111110000000000000000111111111111111100000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700
__sfx__
000300001c3501d3501c15020150261502e1502e3501d15027150381500000000000000001d3501c350193501735014350113500c350093500535000350123000f3000e3000b3000830004300003000000000000
0004000007350093500a3500d3501035016450184501a4501b4501b4501c4501b4501a450184500e3500e3500e3500e350114501245012450104500e450073500635003350000000e4000c400064000440000000
00040000175501a5501c5501d5502055023550255502555018250182501825018250182501825016550135500f5500c5500855005550035500255000000000000000000000000000000000000000000000000000
000300002a6502a6502705023650166501205014650156501905029650290502b6502a650230501e65016050166501a6502b6502b0502b65029650240501b0500000000000000000000000000000000000000000
000200003e3503e3503e3503d3503c3503b350393503835033350313502c35000000000000000000000000002c4502a4502945000000264500000021450000001b4500000014450114500e4500d4500000000000

@ -1,235 +0,0 @@
require("pokemon.lua")
require("textbox.lua")
require("menu.lua")
-- Game Constructor
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,
player_move = nil,
enemy_move = nil,
}
end
-- Game methods
function set_txb(g, s)
g.main_txb.current_text = s
end
-- State Constructor
function new_state(name, init, draw, update, next, timer)
return {
name = name,
init = init,
draw = draw,
update = update,
next = next,
timer = timer,
timer_max = 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
set_txb(g, "choose your enemy's pokemon")
else
set_txb(g, "choose your pokemon")
end
end
update = function(g)
if btn(2) then
m_up(g.menu)
g.lockout = 4
elseif btn(3) then
m_down(g.menu)
g.lockout = 4
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)
set_txb(g, "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)
set_txb(g, "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, "player_choose_move", 80)
end
function player_choose_move()
init = function(g)
set_txb(g, "")
g.menu = move_menu(g.player)
states["player_turn"].timer = 80
states["enemy_turn"].timer = 80
end
update = function(g)
if btn(2) then
m_up(g.menu)
g.lockout = 4
elseif btn(3) then
m_down(g.menu)
g.lockout = 4
end
if btn(4) then
m_name = m_select(g.menu)
g.player_move = g.player.moves[m_name]
g.menu = nil
return true
end
return false
end
draw = function(g)
draw_p(g.enemy)
draw_status(g.enemy)
draw_p(g.player)
draw_status(g.player)
draw_m(g.menu)
end
return new_state("player_choose_move", init, draw, update, "enemy_choose_move")
end
function enemy_choose_move()
init = function(g)
end
update = function(g)
g.enemy_move = choose_random_move(p)
return true
end
draw = function(g)
draw_p(g.enemy)
draw_status(g.enemy)
draw_p(g.player)
draw_status(g.player)
end
return new_state("enemy_choose_move", init, draw, update, "player_turn")
end
function player_turn()
init = function(g)
set_txb(g, g.player.name .. " used " .. g.player_move.name)
attack(g.enemy, g.player_move)
end
update = function(g)
end
draw = function(g)
draw_p(g.enemy)
draw_status(g.enemy)
draw_p(g.player)
draw_status(g.player)
draw_txb(g.main_txb)
end
return new_state("player_turn", init, draw, update, "enemy_turn", 80)
end
function enemy_turn()
init = function(g)
set_txb(g, g.enemy.name .. " used " .. g.enemy_move.name)
attack(g.player, g.enemy_move)
end
update = function(g)
end
draw = function(g)
draw_p(g.enemy)
draw_status(g.enemy)
draw_p(g.player)
draw_status(g.player)
draw_txb(g.main_txb)
end
return new_state("enemy_turn", init, draw, update, "player_choose_move", 80)
end

@ -1,45 +1,36 @@
require("game.lua")
require("pokemon.lua")
require("textbox.lua")
main_txb = new_textbox(2, 98, 124, 124)
enemy_x = 78
enemy_y = 8
player_x = 12
player_y = 56
function _init()
states = {}
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_choose_move"] = player_choose_move()
states["enemy_choose_move"] = enemy_choose_move()
states["player_turn"] = player_turn()
states["enemy_turn"] = enemy_turn()
gm = new_game("start_menu")
states[gm.state].init(gm)
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)
-- main_txb.current_text = "enemy " .. p_enemy.name .. " appeared!"
appear(p_player)
main_txb.current_text = "go " .. p_enemy.name .. "!"
end
function _draw()
cls(0)
states[gm.state].draw(gm)
draw_p(p_enemy)
draw_p(p_player)
draw_txb(main_txb)
end
function _update()
if gm.lockout > 0 then
gm.lockout = gm.lockout - 1
return false
else
next_state = states[gm.state].update(gm)
end
t = states[gm.state].timer
if t then
if t <= 0 then
next_state = true
states[gm.state].timer = states[gm.state].timer_max
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

@ -1,48 +0,0 @@
-- Constants
cursor_spr = 207
-- Constructor
function new_menu(x, y, options)
return {
x = x,
y = y,
options = options,
cursor = 1,
}
end
-- Menu methods
function draw_m(m)
for i,o in ipairs(m.options) do
r = i-1
o_x = m.x+12
o_y = m.y+4+(8*r)
print(o, o_x, o_y)
end
spr(cursor_spr, m.x+2, m.y+2+(8*(m.cursor-1)))
end
function m_up(m)
if m.cursor == 1 then
m.cursor = count(m.options)
else
m.cursor = m.cursor - 1
end
end
function m_down(m)
if m.cursor == count(m.options) then
m.cursor = 1
else
m.cursor = m.cursor + 1
end
end
function m_select(m)
return m.options[m.cursor]
end

@ -1,145 +0,0 @@
-- Constructor
function new_move(name, damage)
return {
name = name,
damage = damage,
}
end
-- Move methods
-- Move Builders
function tackle()
return new_move(
"tackle",
10
)
end
function grass_knot()
return new_move(
"grass knot",
10
)
end
function wrap()
return new_move(
"wrap",
10
)
end
function leaf_blade()
return new_move(
"leaf blade",
10
)
end
function psychic()
return new_move(
"psychic",
10
)
end
function psybeam()
return new_move(
"psybeam",
10
)
end
function slam()
return new_move(
"slam",
10
)
end
function tail_glow()
return new_move(
"tail glow",
10
)
end
function leech_life()
return new_move(
"leech life",
10
)
end
function bug_buzz()
return new_move(
"bug buzz",
10
)
end
function aurora_beam()
return new_move(
"aurora beam",
10
)
end
function smokescreen()
return new_move(
"smokescreen",
10
)
end
function double_edge()
return new_move(
"double edge",
10
)
end
function flash_cannon()
return new_move(
"flash cannon",
10
)
end
function blast_burn()
return new_move(
"blast burn",
10
)
end
function taunt()
return new_move(
"taunt",
10
)
end
function swagger()
return new_move(
"swagger",
10
)
end
function ice_shard()
return new_move(
"ice shard",
10
)
end
function ice_punch()
return new_move(
"ice punch",
10
)
end

@ -1,53 +1,33 @@
require("menu.lua")
require("move.lua")
-- Constructor
function new_pokemon(name, enemy, front_sprite, back_sprite, cry, health, moves)
p_x = 12
p_y = 56
if enemy then
p_x = 78
p_y = 8
end
move_table = {}
for i,m in ipairs(moves) do
move_table[m.name] = m
end
function new_pokemon(name, enemy, front_sprite, back_sprite, cry)
return {
name = name,
enemy = enemy,
front_sprite = front_sprite,
back_sprite = back_sprite,
cry = cry,
health = health,
max_health = health,
-- moves = moves,
moves = move_table,
x = p_x,
y = p_y,
x = 0,
y = 0,
appeared = false,
}
end
-- Methods
-- Pokemon methods
function appear(p)
if p.appeared then
return
end
draw_p(p)
cry(p)
p.appeared = true
end
function cry(p)
sfx(p.cry)
end
function draw_p(p)
if p.enemy then
draw_front(p)
@ -57,87 +37,18 @@ function draw_p(p)
end
function draw_front(p)
draw_p_spr(p.front_sprite, p.x, p.y)
draw(p.front_sprite, p.x, p.y)
end
function draw_back(p)
draw_p_spr(p.back_sprite, p.x, p.y)
draw(p.back_sprite, p.x, p.y)
end
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
function move_menu(p)
move_names = {}
for n in pairs(p.moves) do
add(move_names, n)
end
return new_menu(68, 84, move_names)
end
function choose_random_move(p)
move_names = {}
for n in pairs(p.moves) do
add(move_names, n)
end
choice = flr(rnd(4)) + 1
choice_move = move_names[choice]
return p.moves[choice_move]
end
function draw_status(p)
h = tostr(p.health) .. "/" .. tostr(p.max_health)
if p.enemy then
print(p.name, 16, 8)
print(h, 16, 16)
else
print(p.name, 50, 58)
print(h, 50, 66)
end
end
function attack(p, move)
dmg = flr(rnd(move.damage)) + 1
p.health = p.health - dmg
if p.health < 0 then
p.health = 0
end
end
-- Pokemon builders
function pokemon_menu()
return new_menu(30, 8, {
"axoleafel",
"paraplat",
"rainborachnid",
"fumineral",
"antagonice",
})
function cry(p)
sfx(p.cry)
end
function choose(name, enemy)
if name == "axoleafel" then
return axoleafel(enemy)
elseif name == "paraplat" then
return paraplat(enemy)
elseif name == "rainborachnid" then
return rainborachnid(enemy)
elseif name == "fumineral" then
return fumineral(enemy)
elseif name == "antagonice" then
return antagonice(enemy)
end
end
--Pokemon
function axoleafel(enemy)
return new_pokemon(
@ -145,81 +56,21 @@ function axoleafel(enemy)
enemy,
4,
8,
0,
50,
{
tackle(),
wrap(),
grass_knot(),
leaf_blade(),
}
)
end
function paraplat(enemy)
return new_pokemon(
"paraplat",
enemy,
0,
12,
1,
50,
{
tackle(),
slam(),
psychic(),
psybeam(),
}
)
end
function rainborachnid(enemy)
return new_pokemon(
"rainborachnid",
enemy,
64,
68,
2,
50,
{
leech_life(),
tail_glow(),
bug_buzz(),
aurora_beam(),
}
0
-- {}
)
end
function fumineral(enemy)
return new_pokemon(
"fumineral",
enemy,
72,
76,
3,
50,
{
smokescreen(),
flash_cannon(),
double_edge(),
blast_burn(),
}
)
end
-- Functions
function antagonice(enemy)
return new_pokemon(
"antagonice",
enemy,
128,
132,
4,
50,
{
taunt(),
ice_punch(),
ice_shard(),
swagger(),
}
)
function draw(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