Add coins in market

This commit is contained in:
Fabien Freling 2019-04-27 16:03:56 +02:00
parent c52143c0b2
commit fadc3e94c6

View file

@ -4,10 +4,17 @@
-- script: lua
t=0
s=8 -- sprite/cell size
w=240
mw=w/s
h=136
mh=h/s
GameState = { start=0, game=1, gameover=2, market=3 }
currentState = GameState.start
currentState = GameState.market
coinBlue=0
coinRed=0
coinYellow=0
function drawStart()
cls(13)
@ -26,21 +33,32 @@ function drawGame()
end
function drawMarket()
s=8 -- sprite size
xOff=s*2
yOff=s*2
for i=xOff+s, w-(2*s)-xOff, s do
spr(64,i,yOff,0,1,0,1)
spr(64,i,h-s-yOff,0,1,0,1)
xOff=2
yOff=2
for i=xOff+1, mw-2-xOff do
spr(64,i*s,yOff*s,0,1,0,1)
spr(64,i*s,(mh-1-yOff)*s,0,1,2,1)
end
for j=yOff+s, h-(2*s)-xOff, s do
spr(64,xOff,j,0,1,0,0)
spr(64,w-s-xOff,j,0,1,0,0)
for j=yOff+1, mh-2-xOff do
spr(64,xOff*s,j*s,0,1,0,0)
spr(64,(mw-1-xOff)*s,j*s,0,1,1,0)
end
spr(65,xOff,yOff,0,1,0,1)
spr(65,w-8-xOff,yOff,0,1,0,2)
spr(65,w-8-xOff,h-8-yOff,0,1,0,3)
spr(65,xOff,h-8-yOff,0,1,0,0)
spr(65,xOff*s,yOff*s,0,1,0,1)
spr(65,(mw-1-xOff)*s,yOff*s,0,1,0,2)
spr(65,(mw-1-xOff)*s,(mh-1-yOff)*s,0,1,0,3)
spr(65,xOff*s,(mh-1-yOff)*s,0,1,0,0)
for i=xOff+1, mw-2-xOff do
for j=yOff+1, mh-2-xOff do
spr(66,i*s,j*s,0,1,0,1)
end
end
spr(80,4*s,4*s,0)
print("x "..coinBlue,5*s+4,4*s+2)
spr(81,4*s,6*s,0)
print("x "..coinRed,5*s+4,6*s+2)
spr(82,4*s,8*s,0)
print("x "..coinYellow,5*s+4,8*s+2)
end
function draw(state)
@ -85,8 +103,13 @@ function TIC()
end
-- <TILES>
-- 064:03aaaa3003aaaa3003aa3a3003aaaa3003aaaa3003aaaa3003a3aa3003aaaa30
-- 065:03aaaa3003aa3a3303aaaaaa03aaaaaa03aaaa3a033aaaaa0033333300000000
-- 064:03aaaa3703aaaa3703aa3a3703aaaa3703aaaa3703aaaa3703a3aa3703aaaa37
-- 065:03aaaa3703aa3a3303aaaaaa03aaaaaa03aaaa3a033aaaaa0033333300000000
-- 066:7777777777777777777777777777777777777777777777777777777777777777
-- 080:0088880008822880082882800828828008288280082882800882288000888800
-- 081:00cccc000cc66cc00c6cc6c00c6cc6c00c6cc6c00c6cc6c00cc66cc000cccc00
-- 082:00eeee000ee99ee00e9ee9e00e9ee9e00e9ee9e00e9ee9e00ee99ee000eeee00
-- 083:0660066066666666666666666666666666666666066666600066660000066000
-- </TILES>
-- <WAVES>