0,]']±>Sï}WÿÍu§ðp8·d%qy)6o;]ÉA¦ösï÷ëëë”°ÂVl†3 0 then self.s = 2 self.y = self.y - self.speed elseif btn(1) and self.y+12 < 136 then self.s = 34 self.y = self.y + self.speed else self.s = 0 end if btnp(4) then self:shoot() end for i,b in ipairs(self.bullets) do b:update() if b.x > 240 then table.remove(self.bullets,i) end end end function Player:draw() spr(self.s, self.x, self.y, 0, 1, 0, 0, 2,2) for _,b in ipairs(self.bullets) do b:draw() end end function Bullet:new(x, y, speed, power) local b = { x=player.x+15, y=player.y+7, s=speed, t=6, p=power} setmetatable(b, {__index=Bullet}) return b end function Bullet:update() self.x = self.x + self.s self.t = self.t - 1 end function Bullet:draw() if self.t >= 3 then pix(self.x+1,self.y,5) pix(self.x-1,self.y,5) pix(self.x,self.y+1,5) pix(self.x,self.y-1,5) pix(self.x,self.y,12) else pix(self.x+1,self.y+1,5) pix(self.x-1,self.y-1,5) pix(self.x-1,self.y+1,5) pix(self.x+1,self.y-1,5) pix(self.x,self.y,12) if self.t == 0 then self.t = 6 end end end function Background:new() local stars = {{},{},{}} for j,c in ipairs({2,4,12}) do for i = 1, 25 do stars[j][i] = { x=math.random(0,239), y=math.random(0,136), c=c, s=j/2 } end end setmetatable(stars, {__index=Background}) return stars end function Background:update() -- update the stars for j = 1,3 do for i, s in ipairs(self[j]) do if s.x < 0 then self[j][i] = {x=240,y=math.random(0,136), c=s.c,s=s.s} else s.x = s.x-s.s end end end end function Background:draw() for i=1,3 do for j,s in ipairs(self[i]) do for k=1,i do pix(s.x+1+k,s.y,s.c) end end end end function update() stars:update() player:update() end function draw() stars:draw() player:draw() end function BOOT() player = Player:new() stars= Background:new() end function TIC() cls() update() draw() t=t+1 end