Browse Source

ladders and some sprites

main
Andy Wallace 2 years ago
parent
commit
1d40147d91
  1. 6
      credits.txt
  2. 85
      jam.p8
  3. BIN
      simple_sprites.psd
  4. BIN
      sprites.png
  5. BIN
      sprites.psd

6
credits.txt

@ -0,0 +1,6 @@
Game by Andy Wallace
andymakes.com
https://twitter.com/Andy_Makes
Sprites from or based on sprites by surt, Sharm & vk
https://opengameart.org/content/simple-broad-purpose-tileset

85
jam.p8

@ -74,8 +74,10 @@ function make_display_obj(actor)
flip_y=false,
render=true,
}
if (actor.type == "goomba") d.spr=3
if (actor.type == "bullet") d.spr=5
if (actor.type == "bullet") d.spr=3
if (actor.type == "goomba") d.spr=5
if (actor.type == "bat") d.spr=7
next_display_id += 1
add(displays,d)
return d
@ -96,7 +98,8 @@ end
function make_tile()
local t={
filled = false
filled = false,
ladder = false,
}
--t.filled = false
return t
@ -134,6 +137,10 @@ function reset()
grid[4][6].filled = true
grid[5][6].filled = true
grid[4][5].ladder = true
grid[4][4].ladder = true
grid[4][3].ladder = true
--add the player
pl = make_actor(6,3, "player")
make_actor(4,5, "goomba")
@ -200,7 +207,7 @@ function _update()
--input
for dir=dir_left,dir_right,2 do
for dir=dir_left,dir_down do
button = max(0,dir) --convert -1 to 0 for dir_left
if btnp(button) then
--shoot if they were holding shoot button
@ -217,13 +224,14 @@ function _update()
}
end
tick()
break
end
end
if btnp(dir_down) then
tick()
end
-- if btnp(dir_down) then
-- tick()
-- end
end
@ -263,7 +271,7 @@ function tick()
--apply gravity
for a in all(actors) do
if a.use_grav and a.r < grid_h and grid[a.c][a.r+1].filled == false then
if a.use_grav and a.r < grid_h and grid[a.c][a.r+1].filled == false and not grid[a.c][a.r].ladder then
a.r += 1
--create animation
local anim = make_anim(a)
@ -300,6 +308,7 @@ function _draw()
if grid[c][r].filled then
rectfill(x,y, x+tile_s, y+tile_s, 5 )
end
if (grid[c][r].ladder) spr(32, x,y, 2,2)
end
end
@ -362,7 +371,8 @@ function trigger_anim(a)
a.t = 0
a.disp = get_disp_by_actor(a.actor_id)
if(a.dir != nil) a.disp.flip_x = a.dir == dir_right
if(a.dir != nil and a.dir == dir_left) a.disp.flip_x = true
if(a.dir != nil and a.dir == dir_right) a.disp.flip_x = false
a.start_x = a.disp.x
a.start_y = a.disp.y
@ -410,8 +420,10 @@ function actor_execute_order(a)
if(a.order == nil) return
if a.order.type == "move" then
if (a.order.dir == dir_right and a.c < grid_w and not grid[a.c+1][a.r].filled) a.c += 1
if (a.order.dir == dir_left and a.c > 1 and not grid[a.c-1][a.r].filled) a.c -= 1
if (a.order.dir == dir_right and can_move_to(a.c+1,a.r)) a.c += 1
if (a.order.dir == dir_left and can_move_to(a.c-1,a.r)) a.c -= 1
if (a.order.dir == dir_up and can_move_to(a.c,a.r-1)) a.r -= 1
if (a.order.dir == dir_down and can_move_to(a.c,a.r+1)) a.r += 1
--create animation
local anim = make_anim(a)
@ -432,7 +444,12 @@ function actor_execute_order(a)
if a.order.type == "die" then
kill_actor(a)
end
end
function can_move_to(c,r)
if (c<1 or c>grid_w or r<1 or r>grid_h) return false
if (grid[c][r].filled) return false
return true
end
--AI DECISIONS
@ -554,19 +571,35 @@ function snap_display(d)
end
__gfx__
00000000000000111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000001111111000000000000000000000004400000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000001199991000000000000000000000054454400000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000001190900000000000000000000000445054440000000000050000005000000000000000000000000000000000000000000000000000000000000
000770000000019999900000000000ccc300000004400044e0000000000550000005500000000000000000000000000000000000000000000000000000000000
00700700000000199990000000000cc66c300000450000044ee00000055550500505555000000000000000000000000000000000000000000000000000000000
00000000000055000005000000003c666c3300004400000000000000555550555505555500000000000000000000000000000000000000000000000000000000
00000000000555555555500000003c66cc3300004400000044e0044e505555505055550500000000000000000000000000000000000000000000000000000000
000000000005505555505000000033ccc3330000545000044e0044e00005555d4d55500000000000000000000000000000000000000000000000000000000000
000000000000055555500000000033333cc300000544450440404404000505544500500000000000000000000000000000000000000000000000000000000000
000000000009900000009000000003cccc3000000544445454005540000005555000000000000000000000000000000000000000000000000000000000000000
00000000000990ddddd0900000000033330000000054454555444500000055500000000000000000000000000000000000000000000000000000000000000000
0000000000000ddddddd000000000000000000000005554454040400000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000dd000dd000000000000000000000004545545e5e000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000050000500000000000000000000000045040040050500000000000000000000000000000000000000000000000000000000000000000000000000
00000000000055000550000000000000000000000400400040050500000000000000000000000000000000000000000000000000000000000000000000000000
04440000000044400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
04440000000044400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
04444444444444400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
04999999999999400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
04440000000044400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
04440000000044400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
04440000000044400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
04440000000044400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
04440000000044400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
04444444444444400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
04999999999999400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000077777770000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000770000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000700707070000000000008800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000700000070000000000880888000000000000111000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000707700770000000000800000800000000001ccc100000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000077000770000000000880808080000000001cccccc0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000007777700000000000800808080000000001cccccc0000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000007000000000000800000008000000001cccccc0000000000000000000000000000000000000000000000000000000000000000000000000000
00000000007700070007000000008000000080000000001cccc00000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000777777777000000008008880080000000000ccc000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000070000000000008800000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000777770000000000888888880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000007700070000000000008000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000007000070000000008888088800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000007000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
04440000000044400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
04440000000044400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
04440000000044400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

BIN
simple_sprites.psd

Binary file not shown.

BIN
sprites.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
sprites.psd

Binary file not shown.
Loading…
Cancel
Save