0,]']ÿÿÿï}WÿÍu§ðp8·d%qy)6o;]ÉA¦ösï÷ôôô”°ÂVl†3WIDTH then x=0 end if y<0 then y=HEIGHT elseif y>HEIGHT then y=0 end this.vct.set(x,y) circ(x,y,rad,clr) local diff_vct = Vect.new(x,y) diff_vct.sub(plyr.vct) dx, dy = diff_vct.pos() if dx ^ 2 + dy ^ 2 <= 16 then GAME_OVER=true end end return this end ------------------------Player class Player={} Player.new=function() local this={} local vct=Vect.new(WIDTH/2,HEIGHT/2) this.vct=vct local clr=2 local rtt=.1 local spd=Vect.new(0,0) local acc=Vect.new(0,-.05) local mx_spd=2 local bllts={} local lst_b=0 local shp={ p={ Vect.new(0,-2.5), Vect.new(-1.5,1), Vect.new(1.5,1) }, sz=2 } shp.p[1].mul(shp.sz) shp.p[2].mul(shp.sz) shp.p[3].mul(shp.sz) local function draw() local x,y=vct.pos() local x1,y1=shp.p[1].pos() local x2,y2=shp.p[2].pos() local x3,y3=shp.p[3].pos() line(x+x3,y+y3,x+x1,y+y1,clr) line(x+x1,y+y1,x+x2,y+y2,clr) line(x+x2,y+y2,x+x3,y+y3,clr) end local function rotate(k) acc.rtt(rtt*k) for _,pt in ipairs(shp.p) do pt.rtt(rtt*k) end end this.update=function() draw() local b_n=#(bllts)+1 score=b_n print('Score: '..b_n-1,0,0,3) if btn(2) then rotate(-1) elseif btn(3) then rotate(1) elseif btn(0) then spd.add(acc) end vct.add(spd) if btn(5) and fC-lst_b>5 then lst_b=fC sfx(0) local x,y=vct.pos() local xa,ya=shp.p[1].pos() x=x+xa*1.5 y=y+ya*1.5 bllts[b_n]=Bllt.new(x,y,shp.p[1]) end for _,b in ipairs(bllts) do b.update() end local x,y=vct.pos() if x<0 then x=WIDTH elseif x>WIDTH then x=0 end if y<0 then y=HEIGHT elseif y>HEIGHT then y=0 end vct.set(x,y) end return this end score=0 plyr={} lin={} update_func={} new_high=false function start() music(0) plyr=Player.new() lin=Vect.new(5,0) new_high=false update_func=plyr.update end start() high_score=0 function gameOver() local width,height=print('GAME OVER',0,-10) print('GAME OVER',120-width/2,136/2,3) print('press Z to restart',0,120,2) width,height=print('High Score: '..high_score,0,-10) print('High Score: '..high_score,120-width/2,136/2+20) if new_high then print('NEW HIGH SCORE!!',0,0,5) end if btn(4) then start() end end function TIC() cls(0) update_func() if GAME_OVER then music() sfx(3,13,30) if score > high_score then high_score=score new_high=true end GAME_OVER=false update_func=gameOver end fC=fC+1 end