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UU"UUU(UUU%%"%RiQ%UURUU%UU"RUU"UUURUUU 0 0
-- title: GameTest
-- author: Galindosoft
-- desc: My first TIC-80 game
-- script: lua
Sprite={x=0,y=0,width=8,height=8,spr=0}
Sprite.mt={}
Sprite.New=function()
local sprt={}
setmetatable(sprt,Sprite.mt)
for k,v in pairs(Sprite) do
sprt[k]=v
end
return sprt
end
player=Sprite.New()
player.x=80
player.y=64
player.vx=0
player.vy=0
player.spr=256
player.cooldown=0
player.arrows={}
player.score=0
player.lifes=5
player.invulnerability=0
function player:shoot()
local time = time()/1000
local arrow={x=self.x,y=self.y,width=8,height=8,spr=257}
if time>self.cooldown then
self.cooldown=time+0.2
table.insert(self.arrows,arrow)
end
end
function player:update()
self.x=self.x+self.vx
self.y=self.y+self.vy
for i, arrow in ipairs(self.arrows) do
arrow.x=arrow.x+7
if arrow.x>=232 then table.remove(self.arrows,i)end
end
end
function player:X() return self.x+self.vx end
function player:Y() return self.y+self.vy end
camera={
x=0,
y=0,
pox=120,
poy=64,
move=true,
}
function camera:draw()
self.pox=math.min(120,120-self.x)
self.poy=math.min(64,64-self.y)
self.ccx=self.pox/8+(self.pox%8==0 and 1 or 0)
self.ccy=self.poy/8+(self.poy%8==0 and 1 or 0)
a=15-self.ccx
b=8-self.ccy
map(15-self.ccx,8-self.ccy,31,18,(self.pox%8)-8,(self.poy%8)-8,0)
end
enemies={
list={},
delay=0.0,
time=0,
t=0,
delay=0
}
function enemies:create(x,y,type,speed)
local enemy={x=x,y=y,width=8,height=8,type=type,speed=speed}
table.insert(self.list,enemy)
end
function enemies:DrwAndUp()
if self.time<=time()/1000 then
self.time=time()/1000+self.delay
for i,enemy in ipairs(self.list) do
spr(enemy.type+self.t%60/30,enemy.x,enemy.y,5)
enemy.x=enemy.x-(1*enemy.speed)
if enemy.type==292 then
enemy.y=(enemy.y+(math.cos(time()/700)*-0.8))
end
end
self.t=self.t+1
end
end
boss={}
boss.x=240-32
boss.y=(136-32)/2
boss.alive=true
boss.timer=0
boss.width=32
boss.height=32
boss.life=100
function boss:update()
if self.timer <= time()/1000 then
self.y=self.y+math.cos(time()/400)
self.timer=time()/1000+0.003
end
end
function boss:draw()
spr(290,self.x,self.y,5,2,0,0,2,2)
end
local moon=Sprite.New()
moon.x=200
moon.y=10
moon.spr=270
function moon:update(level_speed)
self.x = self.x-(0.009*level_speed)
end
function moon:draw()
spr(self.spr,self.x,self.y,5,2,0,0,2,2)
end
function solid(x,y,bloque)
return solids[mget((x)/bloque,(y)/bloque)]
end
function overlap(a,b)
al=a.x
ar=a.x+a.width
at=a.y
ab=a.y+a.height
bl=b.x
br=b.x+b.width
bt=b.y
bb=b.y+b.height
if ar>bl and al bt and at=1 and boss.life>=0 then
controllers()
update()
draw()
elseif boss.life<0 then
cls(0)
ui(visible)
print("End, you win",92,68)
print("ctrl+ r to restart",92-20,68+8)
--spr(290,120-24,30+4,5,2,0,0,2,2)
else
cls(0)
ui(visible)
print("Game Over",92,68)
print("press enter to restart",92-34,68+8)
if key(50) then
reset()
end
end
end
function update()
if camera.x >= 2400 then
speed=4
end
if camera.move then
camera.x=camera.x+(0.5*speed)
end
if(boss.alive and math.random(0,15) ==1)then
enemies:create(240-16,boss.y+16,292,3.5)
end
if(camera.x>=(nivelx[1]*10) and #nivelx>1) then
enemies:create(240,nively[1]*17,nivels[1]*2+272,1)
table.remove(nively,1)
table.remove(nivelx,1)
table.remove(nivels,1)
end
for i,enemy in ipairs(enemies.list) do
if enemy.x<=0 or enemy.type==288 and enemy.delay