working pokemon display
commit
e01ea1309f
@ -0,0 +1 @@
|
|||||||
|
picomon.p8
|
@ -0,0 +1 @@
|
|||||||
|
p8tool build picomon.p8 --lua ./src/main.lua --gfx ./src/assets.p8 --gff ./src/assets.p8 --sfx ./src/assets.p8 --map ./src/assets.p8
|
@ -0,0 +1,37 @@
|
|||||||
|
pico-8 cartridge // http://www.pico-8.com
|
||||||
|
version 34
|
||||||
|
__gfx__
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000000000000000000000000bb0000000000000000000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000b00000bb00000000000000000000000000000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000bbb000bbbbbbbbbbbbbbbbbb000bb000000bb0bbbbbbbbbbbbbbbbbb0000b0000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000bb00bbbbbbbbbbbbbbbbbb00bb000b0000bbbbbbbbbbbbbbbbbbbb0bbb00000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000bbbbbbbbbbbbbbbbbbbb00b0000bb0000bbbbbbbbbbbbbbbbbbbbb0000000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000000bbbbbbbbbbbbbbbbbb0b000000bbb000bbbbbbbbbbbbbbbbbbb00000000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000000bbbb007bbbb700bbbbbb000000000bbbbbbbbbbbbbbbbbbbbb000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000bbbbbbbb007bbbb700bbbbb0000000000000bbbbbbbbbbbbbbbbbbb00000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000bb000bbbb000bbbb000bbbb00000000000000bbbbbbbbbbbbbbbbbbbbb000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000bbbbbb000bbbb000bbbbb00000000000bbbbbbbbbbbbbbbbbbbb00b000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000b0bbbbbbbbbbbbbbbbbbbbbb000000bbb0bbbbbbbbbbbbbbbbbb000bb0000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000bb0bbbbbbbbbbbbbbbbbb00000000bbb000bbbbbbbbbbbbbbbbbb0000b0000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000b00bbbbbbbbbbbbbbbbbbbbb0000bb00000bbbbbbbbbbbbbbbbbbbb0000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000bb00bbbbbbbbbbbbbbbbbb00bbb000000000bbbbbbbbbbbbbbbbbb0bb000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000b000000000bbbbbb00000000000000000000000000bbbbbb000000000000000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000000000000bbbbbb00000000000000000000000000bbbbbb000000000000000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000000000000bbbbbb00000000000000000000000000bbbbbb000000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000b0000bbbbbb0000b0000000000000000b0000bbbbbb0000b0000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000bbbbbbbbbbbbbb000000000000000000bbbbbbbbbbbbbb00000000000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000000000000bbbbbb00000000000000000000000000bbbbbb000000000000000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000000000000bbbbbb000bbbb000000000000bbbb000bbbbbb000000000000000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000000000000bbbbbb0bb00000000000000000000bb0bbbbbb000000000000000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000000000000bbbbbbb000000000000000000000000bbbbbbb000000000000000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000000000000bbbbbb00000000000000000000000000bbbbbb000000000000000000000000000000000000000000000
|
||||||
|
00000000000000000000000000000000000000000000b000000b000000000000000000000000b000000b00000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000b00000000b0000000000000000000000b00000000b0000000000000000000000000000000000000000000
|
||||||
|
000000000000000000000000000000000000000000b0000000000b00000000000000000000b0000000000b000000000000000000000000000000000000000000
|
||||||
|
__sfx__
|
||||||
|
000300001c3501d3501c15020150261502e1502e3501d15027150381500000000000000001d3501c350193501735014350113500c350093500535000350123000f3000e3000b3000830004300003000000000000
|
@ -0,0 +1,36 @@
|
|||||||
|
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()
|
||||||
|
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)
|
||||||
|
draw_p(p_enemy)
|
||||||
|
draw_p(p_player)
|
||||||
|
draw_txb(main_txb)
|
||||||
|
end
|
||||||
|
|
||||||
|
function _update()
|
||||||
|
end
|
@ -0,0 +1,76 @@
|
|||||||
|
-- Constructor
|
||||||
|
|
||||||
|
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,
|
||||||
|
-- moves = moves,
|
||||||
|
|
||||||
|
x = 0,
|
||||||
|
y = 0,
|
||||||
|
|
||||||
|
appeared = false,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Pokemon methods
|
||||||
|
|
||||||
|
function appear(p)
|
||||||
|
if p.appeared then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
draw_p(p)
|
||||||
|
cry(p)
|
||||||
|
p.appeared = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function draw_p(p)
|
||||||
|
if p.enemy then
|
||||||
|
draw_front(p)
|
||||||
|
else
|
||||||
|
draw_back(p)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function draw_front(p)
|
||||||
|
draw(p.front_sprite, p.x, p.y)
|
||||||
|
end
|
||||||
|
|
||||||
|
function draw_back(p)
|
||||||
|
draw(p.back_sprite, p.x, p.y)
|
||||||
|
end
|
||||||
|
|
||||||
|
function cry(p)
|
||||||
|
sfx(p.cry)
|
||||||
|
end
|
||||||
|
|
||||||
|
--Pokemon
|
||||||
|
|
||||||
|
function axoleafel(enemy)
|
||||||
|
return new_pokemon(
|
||||||
|
"axoleafel",
|
||||||
|
enemy,
|
||||||
|
4,
|
||||||
|
8,
|
||||||
|
0
|
||||||
|
-- {}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Functions
|
||||||
|
|
||||||
|
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
|
@ -0,0 +1,19 @@
|
|||||||
|
-- Constructor
|
||||||
|
|
||||||
|
function new_textbox(x, y, w, h)
|
||||||
|
return {
|
||||||
|
x = x,
|
||||||
|
y = y,
|
||||||
|
w = w,
|
||||||
|
h = h,
|
||||||
|
|
||||||
|
current_text = "",
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Textbox methods
|
||||||
|
|
||||||
|
function draw_txb(t)
|
||||||
|
rect(t.x, t.y, t.h, t.w)
|
||||||
|
print(t.current_text, t.x+4, t.y+4)
|
||||||
|
end
|
Loading…
Reference in New Issue