Skip to content
Permalink
Browse files
Adding iko's Pikoban.
  • Loading branch information
josefnpat committed Sep 29, 2016
1 parent 6bc4720 commit 60c07070b2b6fbb19916a30ac6e417d75dbbf96e
Showing with 244 additions and 74 deletions.
  1. +8 −8 collab_2/gfx/gfx0
  2. +32 −32 collab_2/gfx/gfx1
  3. +2 −1 collab_2/lua/05.lua
  4. +170 −1 collab_2/lua/06.lua
  5. +16 −16 collab_2/map/map0
  6. +16 −16 collab_2/map/map1
@@ -6,14 +6,14 @@
8282828805c00c50000ff00011911cc18882828228282888ccc1c1c11c1c1ccc0000000000000000000000000000000000000000000000000000000000000000
5688886555555555000ff000199ddcc1568888888888886565cccccccccccc560000000000000000000000000000000000000000000000000000000000000000
5655556505000050f00ee00b11111111560000000000006565000000000000560000000000000000000000000000000000000000000000000000000000000000
44444444555555556666666677777777333366555555555555663131333333330000000000000000000000000000000000000000655500000000000000000000
4444444455555555666666667777777733366555555555555556631333131333000000000000000000000000000000000a000000666600000200000000000000
44944944556556556676676677677677336655555555555555556633333133330000000000000000000000000000000000000000556500000000000000000000
44499444555665556667766677766777366555555555555555555663333333330000000000000000000000000000000000000000666600000000000000000000
44499444555665556667766677766777665555555555555555555566333331310000000000000000000000000000000000000000000000000000000000000000
44944944556556556676676677677677655555555555555555555556333333130000000000000000000000000000000000000000000000000000000000000000
44444444555555556666666677777777555555555555555555555555333333330000000000000000000000000000000000000000000000000000000000000000
44444444555555556666666677777777555555555555555555555555333333330000000000000000000000000000000000000000000000000000000000000000
44444444116666116666666677777777333366555555555555663131333333330000000000000000000000000000000000000000655500000000000000000000
4444444416666661666666667777777733366555555555555556631333131333000000000000000000000000000000000a000000666600000200000000000000
449449441d666656676676677677677336655555555555555556633333133330000000000000000000000000000000000000000556500000000000000000000
444994441dd66556667766677766777366555555555555555555663333333330000000000000000000000000000000000000000666600000000000000000000
444994441ddd55516667766677766777665555555555555555555566333331310000000000000000000000000000000000000000000000000000000000000000
449449441ddd55516676676677677677655555555555555555555556333333130000000000000000000000000000000000000000000000000000000000000000
4444444411dd55116666666677777777555555555555555555555555333333330000000000000000000000000000000000000000000000000000000000000000
44444444111d51116666666677777777555555555555555555555555333333330000000000000000000000000000000000000000000000000000000000000000
8888888844444444aaaaaaaabbbbbbbb666666661111111111111111111111110000000000000000000000000000000000000000000000000000000000000000
8888888846666664aaaaaaaabbbbbbbb155555561111111111171111111111110000000000000000000000000000000000000000000000000000000000000000
88e88e8846464444aa9aa9aabb3bb3bb151151161111111111111111111111110000000000000000000000000000000000000000000000000000000000000000
@@ -1,32 +1,32 @@
00044400000000005555555555555555000000000000000000000000000000000000000000000000000000000000000000000000888488846767676767676767
004ffff0000000005565555555555655000000000000000000000000000000000000000000000000000000000000000000011000444444447676767676333376
004f3f30000880005606666666666065000000000000000000000000000000000000000000000000000000000000000000155100848884886767676767333367
004ffff00088e8005560000000000655000000000000000000000000000000000000000000000000000000000000000001555510444444447676767676333376
000fff00088888805560000000000655000000000000000000000000000000000000000000000000000000000000000001555510888488846767676767476767
0fddd0000d8888805560000000000655000000000000000000000000000000000000000000000000000000000000000000155100444444447676767676467676
00dddf0000d888005560000000000655000000000000000000000000000000000000000000000000000000000000000000011000848884886767676767476767
00404000000dd0005560000000000655000000000000000000000000000000000000000000000000000000000000000000000000444444447676767676767676
55600000000006555560000000000655000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
55600000000006555560000000000655000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
55600000000006555560000000000655000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
55600000000006555560000000000655000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
55600000000006555560000000000655000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
55600000000006555606666666666065000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
55600000000006555565555555555655000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
55600000000006555555555555555555000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000555555555555555555555555000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000555555555555555500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000666666665555555500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000005555555500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000005555555500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
66666666000000005555555500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
55555555000000005555555555555555000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
55555555000000005555555555555555000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00044400000000005555555555555555000000066600000000000000660000000000000000000000000000000000000000000000888488846767676767676767
004ffff0000000005565555555555655000006677766000000000001dd6600000000000000000000000000000000000000011000444444447676767676333376
004f3f3000088000560666666666606500066777777766000000001666dd66000000000000000000000000000000000000155100848884886767676767333367
004ffff00088e800556000000000065506677777777777660000001dd666dd610000000000000000000000000000000001555510444444447676767676333376
000fff000888888055600000000006551d77777777777771100001666dd666110000000000000000000000000000000001555510888488846767676767476767
0fddd0000d888880556000000000065516dd77777777711d100001dd666dd6110000000000000000000000000000000000155100444444447676767676467676
00dddf0000d8880055600000000006551666dd7777711ddd10001666dd6661d10000000000000000000000000000000000011000848884886767676767476767
00404000000dd0005560000000000655166666dd711ddddd10001dd666dd61d10000000000000000000000000000000000000000444444447676767676767676
55600000000006555560000000000655166666661ddddddd1001666dd6661dd10000000000000000000000000000000000000000000000000000000000000000
55600000000006555560000000000655166666661ddddddd1001dd666dd61dd10000000000000000000000000000000000000000000000000000000000000000
55600000000006555560000000000655166666661ddddddd101666dd6661ddd10000000000000000000000000000000000000000000000000000000000000000
55600000000006555560000000000655166666661ddddddd101dd666dd61ddd10000000000000000000000000000000000000000000000000000000000000000
55600000000006555560000000000655166666661dddddd111666dd6661dddd10000000000000000000000000000000000000000000000000000000000000000
55600000000006555606666666666065011666661dddd1100116666dd61dd1100000000000000000000000000000000000000000000000000000000000000000
55600000000006555565555555555655000116661dd110000001166661d110000000000000000000000000000000000000000000000000000000000000000000
55600000000006555555555555555555000001161110000000000116611000000000000000000000000000000000000000000000000000000000000000000000
00000000555555555555555555555555000000011000000000000001100000000000000000000000000000000000000000000000000000000000000000000000
00000000555555555555555500000000000000dd0000000090000900000000000000000000000000000000000000000000000000000000000000000000000000
000000006666666655555555000000000000dd55dd0000097100999000ddd0000000000000000000000000000000000000000000000000000000000000000000
0000000000000000555555550000000000dd555555dd0001778079780d111d000000000000000000000000000000000000000000000000000000000000000000
00000000000000005555555500000000dd5555555555dd0777002770d16661d00000000000000000000000000000000000000000000000000000000000000000
6666666600000000555555550000000055555555555555027e2222201666661d0000000000000000000000000000000000000000000000000000000000000000
55555555000000005555555555555555dd5555555555dde22e22e22e1666661d0000000000000000000000000000000000000000000000000000000000000000
5555555500000000555555555555555500dd555555dd00e22e22e22e166666610000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000dd55dd0000eccc22ccce166666610000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000dd000000ec0c72c0c7166666d10000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000888888888888887c0c07c0c01666ddd10000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000888888888888880c0c00c0c016ddddd10000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000888888888888880c0c00c0c01dddddd10000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000888888888888880c022022c0011dddd10000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000088888888888888022000002200011dd10000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000888888888888880000000000000001110000000000000000000000000000000000000000000000000000000000000000
@@ -1 +1,2 @@
add(games,{name="tbd",author="tbd",_update = function() win() end}) -- game 3
add(games,{name="tbd",author="tbd",_update = function() win() end}) -- game 5

@@ -1 +1,170 @@
add(games,{name="tbd",author="tbd",_update = function() win() end}) -- game 6
add(games, {
name = "pikoban",
author = "iko",

---------------------------------------
-------------------------------- init
_init = function(self)

----------------------------
--------------------- vars
cubes = {}
playerfacing, curlevel = 101, 0

----------------------------------------------
-------------------------- internal functions

getspritecoords, drawthing, loadlevel =

--------------------------------
function(i)--getspritecoords

if i==101 or i==102 then --player
return 46,49,5,17
elseif i>102 then --player
return 51,49,5,17
elseif i==5 then --floor
return 32,49,14,9
elseif i<4 then --cube
return 32,32,17,17
end
--elseif i==4 then --ramps
return 49,32,16,18
--end

end,

--------------------------------
function(x,y,n)--drawthing

--xy to iso
local finalx, finaly = 56 + 8*x - 8*y, 24 + 4*x + 4*y
local sx, sy, sw, sh = getspritecoords(n)

finaly -= sh

if n<4 then finalx -=1 finaly -=1 end

if n > 100 then
finalx += 5
if playerh then finaly -= 10 end
end --correct player coords

if n == 2 then
pal(7,15)
pal(6,9)
pal(13,4)
end

--draw
sspr(sx,sy,sw,sh,finalx,finaly,sw,sh,
n == 102 or n == 103)--flipx

pal()

--doorway to exit
if n==3 then
sspr(56,49,8,17,finalx+8,finaly-12)
end
end,

--------------------------------
function(lvl) --loadlevel

playerx, playery, playerh, curlevel = 8, 8, false, lvl

for x=1, 8 do
cubes[x] = {}
for y=1, 8 do
cubes[x][y] = mget((lvl%4)*8+x+31,flr(lvl/4)*8+y-1)
end
end
end

--menuitem(1,"restart level",function() loadlevel(curlevel) end)

loadlevel(0)

end,
----------------------------------------------
-------------------------------- draw
_draw = function()

----------------------------------------------
-------------------------------- update
--_update = function()

local deltax, deltay = 0, 0

if btnp "0" then deltax -= 1 playerfacing = 103
elseif btnp "1" then deltax += 1 playerfacing = 101
elseif btnp "2" then deltay -= 1 playerfacing = 104
elseif btnp "3" then deltay += 1 playerfacing = 102
elseif btnp "5" then loadlevel(curlevel) end --restart button

local intendedx, intendedy, moveplayerintended =
mid(1,playerx+deltax,8),
mid(1,playery+deltay,8),
false

local intendedcubeindex = cubes[intendedx][intendedy]

--collisions

if intendedcubeindex==4 and deltay!=0 then --ramp y (both levels)

playery, playerh = intendedy+deltay, not playerh

elseif playerh then --level above

moveplayerintended = intendedcubeindex<3

--level up!
if intendedcubeindex==3 then
loadlevel(curlevel+1)
end

else --level ground

if intendedcubeindex==5 then --walk into nothing

moveplayerintended = true

elseif intendedcubeindex==2 then --walk into movecube

local intplusx, intplusy = intendedx+deltax, intendedy+deltay

if intplusx < 9 and intplusx > 0 and
intplusy < 9 and intplusy > 0 and
cubes[intplusx][intplusy] == 5 then

cubes[intplusx][intplusy] = 2
cubes[intendedx][intendedy] = 5
moveplayerintended = true

end
end
end

if moveplayerintended then
playerx, playery = intendedx, intendedy
end

--end,--update

cls()

print(curlevel<15 and "picoban level "..curlevel or "!congratulations the end!",13,0,13)

for x=1,8 do for y=1,8 do
drawthing(x,y,cubes[x][y])

if x==playerx and y==playery then
drawthing(playerx,playery,playerfacing)
end

end end --end x,y

end,
}
)

0 comments on commit 60c0707

Please sign in to comment.