diff --git a/demos/benchmark.lua b/demos/benchmark.lua index aedf14b7f..54da1054b 100644 --- a/demos/benchmark.lua +++ b/demos/benchmark.lua @@ -6,17 +6,17 @@ local runningTime = 0 local t = 0 local RUNNER = {} --- predictable random +-- predictable random -- give the same sequence every time local random = {} random.max = 8000 random.count = 0 -for x=0,random.max do +for x=0,random.max do random[x+1] = math.random(100)/100 end function Random(v) random.count = random.count+1 - return random[(random.count%random.max)+1] * v + return random[(random.count%random.max)+1] * v end -- epilepsy warning @@ -57,15 +57,15 @@ function UI:mainmenu() cls(1) print("Let the test run until the bar is full",0,0,15) - -- print position + -- print position local yp = 68-((#UI.options*8)/2) -- what is selected local currentOption = 1+(UI.currentOption % (#UI.options)) -- display options - for o=1,#UI.options do + for o=1,#UI.options do color = 6 opt = UI.options[o] - if o==currentOption then + if o==currentOption then color = 15 -- if highlighted and press Z -- then start it @@ -74,7 +74,7 @@ function UI:mainmenu() RUNNER = opt[2] -- if we have an INIT then run it random.count = 0 - if RUNNER.init ~= nil then + if RUNNER.init ~= nil then RUNNER:init() end RUNNER.count = 0 @@ -102,8 +102,8 @@ end function SQRT:run() cls(0) local wiggle= t/20 % 20 - for y=0,136 do - for x=0,RUNNER.count do + for y=0,136 do + for x=0,RUNNER.count do pix(x%240,y,16-(math.sqrt(wiggle+(x*x + y*y)/136)%16)) end end @@ -116,8 +116,8 @@ end function SINCOS:run() cls(0) local wiggle= t/20 % 20 - for y=0,136 do - for x=0,RUNNER.count do + for y=0,136 do + for x=0,RUNNER.count do local v = 0 v = v + math.sin(wiggle+x) + math.cos(wiggle+y) v = v + math.cos(wiggle-y) + math.sin(wiggle-x) @@ -134,8 +134,8 @@ function PIXELRW:init() end function PIXELRW:run() local wiggle= t/20 % 120 - for y=0,136 do - for x=0,RUNNER.count do + for y=0,136 do + for x=0,RUNNER.count do local a = pix(x+wiggle,y) local b = Random(100) if b<25 then @@ -152,8 +152,8 @@ local PIXELW = { add = 5 , callmult = 1} function PIXELW:init() end function PIXELW:run() - for y=0,136 do - for x=0,RUNNER.count do + for y=0,136 do + for x=0,RUNNER.count do pix(x&0xff,y,32+(x+(y*8))) end end @@ -163,7 +163,7 @@ end local MATHRANDOM = { add = 1000 , callmult = 2} function MATHRANDOM:run() cls(0) - for rc=0,RUNNER.count do + for rc=0,RUNNER.count do pix(math.random(240),math.random(136),math.random(15)) end end @@ -172,17 +172,17 @@ end local SHAPES = { add = 25, callmult = 1} function SHAPES:run() cls(2) - for x=0,RUNNER.count do + for x=0,RUNNER.count do circ(Random(240),Random(136),Random(16),x&1) end end --- map +-- map local MAP = { add = 1 , callmult = 1} function MAP:run() cls(10) - for x=0,RUNNER.count do + for x=0,RUNNER.count do map(0,0,30,18,-x,0,10) end end @@ -193,7 +193,7 @@ local Sprites = { add = 100 , callmult = 1} function Sprites:run() local a = t + 1/RUNNER.count cls(0) - for x=0,RUNNER.count do + for x=0,RUNNER.count do spr(1,120+math.sin(x+a)*120,68+math.cos(x-a)*68) end end @@ -209,7 +209,7 @@ function Particles:run() table.sort(Particles, function(a,b) return a.y>b.y end) if (t//40)&1==0 then - if runningTime<16.2 then + if runningTime<16.2 then for x=1,100 do table.insert(Particles.list,{x=Random(240),y=-Random(32),c=1+((x//10)%14),fs=0.5+Random(5)/10.0}) end @@ -218,16 +218,16 @@ function Particles:run() Particles.count = #Particles.list - for x=1,#Particles.list do + for x=1,#Particles.list do p = Particles.list[x] if p.y<100 then - if (pix(p.x,(p.y+p.fs)//1)==0) then + if (pix(p.x,(p.y+p.fs)//1)==0) then p.y=p.y+p.fs else if Random(100)>80 then - if (pix(p.x-1,p.y+1)==0) then + if (pix(p.x-1,p.y+1)==0) then p.x = p.x-1 - elseif (pix(p.x+1,p.y+1)==0) then + elseif (pix(p.x+1,p.y+1)==0) then p.x = p.x+1 end end @@ -256,12 +256,12 @@ RUNNER = nil function MAINTIC() local stime = time() - if RUNNER~=nil then + if RUNNER~=nil then if RUNNER.count~=nil then - if runningTime<16.6 then + if runningTime<16.6 then RUNNER.count=RUNNER.count + RUNNER.add end - if runningTime>18.0 then + if runningTime>18.0 then RUNNER.count=RUNNER.count - RUNNER.add end print(RUNNER.count,0,110,15) @@ -274,7 +274,7 @@ function MAINTIC() print(string.format("runTime %.2f",runningTime),1,127,0) print(string.format("runTime %.2f",runningTime),0,126,15) - if runningTime>16 then + if runningTime>16 then UI:bench() end end @@ -294,7 +294,7 @@ function TIC() t=t+1 if (t>60*2) then UI:bench() - if btnp(4) then + if btnp(4) then TIC=MAINTIC end end diff --git a/demos/bpp.lua b/demos/bpp.lua index b3432f890..8e31eb266 100644 --- a/demos/bpp.lua +++ b/demos/bpp.lua @@ -1,6 +1,6 @@ -- title: Blit segment demo cart -- author: ddelemeny --- desc: Variable BPP rendering +-- desc: Variable BPP rendering -- script: lua W=16*4 @@ -84,7 +84,7 @@ function TIC() -- font inverts BG and FG segments -- blit segment = 8+4+page rText(text, 100, 60, 8+4+sel//2,sel%2==1) -end +end -- -- 032:0020505000205070002000500000007000200050000000000000000000000000 diff --git a/demos/bunny/jsmark.js b/demos/bunny/jsmark.js index 4735271d6..8e172fb30 100644 --- a/demos/bunny/jsmark.js +++ b/demos/bunny/jsmark.js @@ -1,7 +1,7 @@ // title: Bunnymark in JavaScript // author: Rob Loach // desc: Benchmarking tool to see how many bunnies can fly around the screen, using JavaScript. -// license: MIT License +// license: MIT License // input: gamepad // script: js // version: 1.1.0 diff --git a/demos/bunny/moonmark.moon b/demos/bunny/moonmark.moon index 431459806..5a50d3af3 100644 --- a/demos/bunny/moonmark.moon +++ b/demos/bunny/moonmark.moon @@ -1,7 +1,7 @@ -- title: Bunnymark in MoonScript -- author: Rob Loach -- desc: Benchmarking tool to see how many bunnies can fly around the screen, using MoonScript. --- license: MIT License +-- license: MIT License -- input: gamepad -- script: moon -- version: 1.1.0 diff --git a/demos/bunny/pythonmark.py b/demos/bunny/pythonmark.py index 2987d67cd..f924e1681 100644 --- a/demos/bunny/pythonmark.py +++ b/demos/bunny/pythonmark.py @@ -4,7 +4,7 @@ # input: gamepad # script: python # version: 0.0.0 -import random +import random screen_width = 240 screen_height = 136 diff --git a/demos/bunny/rubymark.rb b/demos/bunny/rubymark.rb index 4b07f1c61..b1a4c3634 100644 --- a/demos/bunny/rubymark.rb +++ b/demos/bunny/rubymark.rb @@ -1,7 +1,7 @@ # title: Bunnymark in Ruby # author: Julia Nelz; based on the original work of Rob Loach # desc: Benchmarking tool to see how many bunnies can fly around the screen, using Ruby. -# license: MIT License +# license: MIT License # input: gamepad # script: ruby # version: 0.1.0 diff --git a/demos/bunny/schememark.scm b/demos/bunny/schememark.scm index befc91783..1f7c3196a 100644 --- a/demos/bunny/schememark.scm +++ b/demos/bunny/schememark.scm @@ -1,7 +1,7 @@ ;; title: Bunnymark in Scheme ;; author: David St-Hilaire, based on the original work of Rob Loach ;; desc: Benchmarking tool to see how many bunnies can fly around the screen, using Scheme. -;; license: MIT License +;; license: MIT License ;; input: gamepad ;; script: scheme ;; version: 1.1.0 @@ -13,7 +13,7 @@ (define (randomFloat lower greater) (+ (random (- greater lower) lower))) -(defstruct bunny +(defstruct bunny (w 26) (h 32) (x (floor (random (- screenWidth 26)))) diff --git a/demos/bunny/squirrelmark.nut b/demos/bunny/squirrelmark.nut index 53df47802..3d5186d8a 100644 --- a/demos/bunny/squirrelmark.nut +++ b/demos/bunny/squirrelmark.nut @@ -1,7 +1,7 @@ // title: Bunnymark in Squirrel // author: Rob Loach // desc: Benchmarking tool to see how many bunnies can fly around the screen, using Squirrel. -// license: MIT License +// license: MIT License // input: gamepad // script: squirrel // version: 1.1.0 diff --git a/demos/bunny/wasmmark/wasmmark.wasm b/demos/bunny/wasmmark/wasmmark.wasm index 48950c051..905517ca9 100644 Binary files a/demos/bunny/wasmmark/wasmmark.wasm and b/demos/bunny/wasmmark/wasmmark.wasm differ diff --git a/demos/bunny/wasmmark/wasmmark.wasmp b/demos/bunny/wasmmark/wasmmark.wasmp index 65ee6f5b2..57fd75142 100644 --- a/demos/bunny/wasmmark/wasmmark.wasmp +++ b/demos/bunny/wasmmark/wasmmark.wasmp @@ -8,10 +8,10 @@ """"""""""""""""""""""""""""""""""""""" -This is a WASM binary project, you +This is a WASM binary project, you won't find the Zig source here. -For source code see the TIC-80 +For source code see the TIC-80 repository folder: /demos/bunny/wasmmark/ diff --git a/demos/bunny/wrenmark.wren b/demos/bunny/wrenmark.wren index 923473e6c..d6d2e314a 100644 --- a/demos/bunny/wrenmark.wren +++ b/demos/bunny/wrenmark.wren @@ -1,7 +1,7 @@ // title: Bunnymark in Wren // author: Rob Loach // desc: Benchmarking tool to see how many bunnies can fly around the screen, using Wren. -// license: MIT License +// license: MIT License // input: gamepad // script: wren // version: 1.1.0 diff --git a/demos/car.lua b/demos/car.lua index 00a16c011..df2e5a58f 100644 --- a/demos/car.lua +++ b/demos/car.lua @@ -8,7 +8,7 @@ fov=100 mesh={} -- Table that contains all the 3D points polygon={} -- Table that contains all connections of 3D points to create triangle polygons, with their texture specified too zorder={} -- Table used to know the rendering order of the triangles -rspeed=.1 -- Rotation speed, you can change it +rspeed=.1 -- Rotation speed, you can change it tspeed=10 -- Translation speed, you can change it function addMesh(mx,my,mz) @@ -183,8 +183,8 @@ function showMesh() p.u2,p.v2, p.u3,p.v3, 0,{}, - (m[p.p1].z+point.z), - (m[p.p2].z+point.z), + (m[p.p1].z+point.z), + (m[p.p2].z+point.z), (m[p.p3].z+point.z)) end end diff --git a/demos/fire.lua b/demos/fire.lua index 3b654ac42..d59d20ca7 100644 --- a/demos/fire.lua +++ b/demos/fire.lua @@ -21,7 +21,7 @@ function addParticle(x,y) table.insert(particle,p) end -function ticParticle() +function ticParticle() --print("#"..#particle) local s=0 local s2=0 @@ -39,8 +39,8 @@ function ticParticle() --remove old ones if p.t > 300 then table.remove(particle,k) - end - end + end + end end function TIC() @@ -48,28 +48,28 @@ function TIC() if btn(0) then y=y-1 end if btn(1) then y=y+1 end if btn(2) then x=x-1 end - if btn(3) then x=x+1 end + if btn(3) then x=x+1 end --warp space x = x % 240 y = y % 136 --reset - if btn(4) then + if btn(4) then x = 120 y = 120 end - addParticle(x,y) - addParticle(30,130) - addParticle(210,130) + addParticle(x,y) + addParticle(30,130) + addParticle(210,130) cls(8) - --Update & Draw particles + --Update & Draw particles ticParticle() - --cursor + --cursor pix(x,y,7) print("! FIRE !",94,64) diff --git a/demos/p3d.lua b/demos/p3d.lua index 50c0b4b62..52f97d449 100644 --- a/demos/p3d.lua +++ b/demos/p3d.lua @@ -47,9 +47,9 @@ function createCurve(t) p={x=x*r1, y=y*r1, z=(u/(l1+0.7)+v/5), - c=pal[1+i%7]} + c=pal[1+i%7]} table.insert(points,p) - end + end i=i+1 end end @@ -80,17 +80,17 @@ function rotate(p3d,center,ax,ay,az) b = p3d.y-center.y c = p3d.z-center.z - a1 = a*math.cos(az)-b*math.sin(az) + a1 = a*math.cos(az)-b*math.sin(az) b1 = a*math.sin(az)+b*math.cos(az) c1 = c - c2 = c1*math.cos(ay)-a1*math.sin(ay) + c2 = c1*math.cos(ay)-a1*math.sin(ay) a2 = c1*math.sin(ay)+a1*math.cos(ay) b2 = b1 - b3 = b2*math.cos(ax)-c2*math.sin(ax) + b3 = b2*math.cos(ax)-c2*math.sin(ax) c3 = b2*math.sin(ax)+c2*math.cos(ax) - a3 = a2 + a3 = a2 np3d.x=a3 np3d.y=b3 @@ -126,17 +126,17 @@ function TIC() angle, angle/2, angle/4) - points[k] = pr - end + points[k] = pr + end --Z Sort table.sort(points,zsort) --Draw points for k,p in pairs(points)do - i,j = p2d(p) + i,j = p2d(p) rect(i,j,6,6,p.c) - end + end angle = angle + 0.05 t=t+1 diff --git a/demos/palette.lua b/demos/palette.lua index 0b990c157..01c8e2bfa 100644 --- a/demos/palette.lua +++ b/demos/palette.lua @@ -38,7 +38,7 @@ function updpal() local pal=PALETTES[index].data for i=1,#pal,2 do poke(ADDR+i//6*3+i//2%3,tonumber(pal:sub(i,i+1),16)) - end + end end updpal() @@ -46,12 +46,12 @@ updpal() function TIC() -- handle input - if btnp(0,20,5) and index>1 then - index=index-1 + if btnp(0,20,5) and index>1 then + index=index-1 updpal() - end - if btnp(1,20,5) and index<#PALETTES then - index=index+1 + end + if btnp(1,20,5) and index<#PALETTES then + index=index+1 updpal() end @@ -64,7 +64,7 @@ function TIC() print("SELECT PALETTE",6,6,0) for i,v in pairs(PALETTES) do - print(v.name,12,12+i*6,0) + print(v.name,12,12+i*6,0) end print(">",6+(t//16%2),12+index*6,0) diff --git a/demos/quest.lua b/demos/quest.lua index 4f316c14a..524d5cc77 100644 --- a/demos/quest.lua +++ b/demos/quest.lua @@ -82,7 +82,7 @@ local function PrintDebug(object) elseif type(v)=="function" then trace("["..i.."] ".."function") end - end + end trace("------------------") end @@ -96,7 +96,7 @@ function Collision:GetEdges(x,y,w,h) local x=x+(CELL-w)/2 local y=y+(CELL-h)/2 - -- get the map ids in the edges + -- get the map ids in the edges local topLeft=mget(x/CELL,y/CELL) local topRight=mget((x+w)/CELL,y/CELL) local bottomLeft=mget(x/CELL,(y+h)/CELL) @@ -106,7 +106,7 @@ function Collision:GetEdges(x,y,w,h) end function Collision:CheckSolid(indx) - return indx==tiles.WALL_1 or + return indx==tiles.WALL_1 or indx==tiles.WALL_2 or indx==tiles.CLOSED_GRATE or indx==tiles.MIMIC_HARM or @@ -116,8 +116,8 @@ function Collision:CheckSolid(indx) indx==tiles.STATUE_2 or indx==tiles.ALTAR or indx==tiles.CRYSTAL_WHOLE or - indx==tiles.CLOSED_DOOR or - indx==tiles.CLOSED_COFFER or + indx==tiles.CLOSED_DOOR or + indx==tiles.CLOSED_COFFER or indx==tiles.OPENED_COFFER end @@ -143,7 +143,7 @@ local function Anim(span,frames,loop) ended=false } - function s.Update(time) + function s.Update(time) if time>=s.tick and #s.frames>0 then if s.loop then s.indx=(s.indx+1)%#s.frames @@ -155,7 +155,7 @@ local function Anim(span,frames,loop) if s.indx==#s.frames then s.ended=true end end s.tick=time+s.span - end + end end function s.RandomIndx() @@ -245,7 +245,7 @@ local function Bullet(x,y,vx,vy) visible=true } - function s.Move() + function s.Move() -- detect flip if s.vx~=0 then s.flip=s.vx<0 and 1 or 0 end @@ -271,7 +271,7 @@ local function Bullet(x,y,vx,vy) if s.x<0 then s.x=0 end if s.x>MAP_W-CELL then s.x=MAP_W-CELL end if s.y<0 then s.y=0 end - if s.y>MAP_H-CELL then s.y=MAP_H-CELL end + if s.y>MAP_H-CELL then s.y=MAP_H-CELL end end function s.Collide() @@ -310,7 +310,7 @@ local function Bullet(x,y,vx,vy) -- if the range is exceeded, ends the life of the bullet local dx=s.x-s.xStart local dy=s.y-s.yStart - if math.sqrt(dx^2+dy^2)>s.range then s.Collide() end + if math.sqrt(dx^2+dy^2)>s.range then s.Collide() end end function s.Display(time) @@ -322,7 +322,7 @@ local function Bullet(x,y,vx,vy) if s.visible then spr(s.curAnim.frame,x,y,s.alpha,1,s.flip) -- rectb(x,y,CELL,CELL,14) - end + end end return s @@ -340,7 +340,7 @@ local function Mob(x,y,player) health=3, power=1, fov=6*CELL, - proximity=CELL-2, + proximity=CELL-2, died=false, dx=0, dy=0, @@ -485,7 +485,7 @@ local function Mob(x,y,player) if s.visible then spr(s.curAnim.frame,x,y,s.alpha,1,s.flip) -- rectb(x,y,CELL,CELL,14) - end + end end return s @@ -534,7 +534,7 @@ local function Boss(x,y,player) s.anims={ idle=Anim(25,{128,129,130,131}), - walk=Anim(15,{128,129,130,131}), + walk=Anim(15,{128,129,130,131}), attack=Anim(15,{132,133,128},false), die=Anim(5,{132,137,138,139,140,141},false), damaged=Anim(20,{142,128},false) @@ -613,7 +613,7 @@ local function Boss(x,y,player) if s.visible then spr(s.curAnim.frame,x,y,s.alpha,1,s.flip) spr(s.curAnim.frame-16,x,y-CELL,s.alpha,1,s.flip) - end + end end return s @@ -632,7 +632,7 @@ local function Player(x,y) s.anims={ idle=Anim(60,{16,17}), - walk=Anim(15,{18,19}), + walk=Anim(15,{18,19}), attack=Anim(15,{20,17},false), die=Anim(5,{21,22,23,24,25},false), damaged=Anim(20,{26,17},false) @@ -654,7 +654,7 @@ local function Player(x,y) CheckKeys(dx,dy) end - function s.Update(time) + function s.Update(time) s.dx=0 s.dy=0 @@ -667,7 +667,7 @@ local function Player(x,y) end -- prevent update in these particular states - if s.died or s.attack then return end + if s.died or s.attack then return end -- default: idle if not s.damaged then s.curAnim=s.anims.idle end @@ -741,10 +741,10 @@ local function Player(x,y) if tl==tiles.CLOSED_COFFER then mset((s.x+dx)/CELL,(s.y+dy)/CELL,tiles.OPENED_COFFER) - if math.random(100)0 then local posX=x+pos.x - local posY=y+pos.y + local posY=y+pos.y if posX<=0 or posX>grid.width then - return true + return true elseif posY>grid.height then - return true + return true elseif not (grid.grid[posY][posX]==EMPTY_CELL_SPR) then - return true + return true end end end @@ -220,7 +220,7 @@ local function Tetrimino(sprId) for x=1,s.width do if shape~=nil and shape[y][x]>0 then local posX=cx+x-1+s.pos.x - local posY=cy+y-1+s.pos.y + local posY=cy+y-1+s.pos.y DrawToCell(s.sprId,posX,posY) end end @@ -236,7 +236,7 @@ local function Tetrimino(sprId) function s.GoDown(grid) local p={x=s.pos.x,y=s.pos.y} - p.y=p.y+1 + p.y=p.y+1 if not isCollision(grid,s.shape,p) then s.pos=p @@ -247,7 +247,7 @@ local function Tetrimino(sprId) function s.GoLeft(grid) local p={x=s.pos.x,y=s.pos.y} - p.x=p.x-1 + p.x=p.x-1 if not isCollision(grid,s.shape,p) then s.pos=p @@ -281,8 +281,8 @@ local function Tetrimino(sprId) s.pos = pLeft s.shape = shape return - end - end + end + end end @@ -358,7 +358,7 @@ local function ZTetrimino(sprId) {0,1,0}, {1,1,0}, {1,0,0} - } + } end return s @@ -371,7 +371,7 @@ local function STetrimino(sprId) s.width=3 s.height=3 s.shape=1 - s.wallkickGap=1 + s.wallkickGap=1 s.shapes[1]={ {0,1,1}, {1,1,0}, @@ -394,7 +394,7 @@ local function STetrimino(sprId) {1,0,0}, {1,1,0}, {0,1,0} - } + } end return s @@ -407,7 +407,7 @@ local function LTetrimino(sprId) s.width=3 s.height=3 s.shape=1 - s.wallkickGap=1 + s.wallkickGap=1 s.shapes[1]={ {0,0,1}, {1,1,1}, @@ -430,7 +430,7 @@ local function LTetrimino(sprId) {1,1,0}, {0,1,0}, {0,1,0} - } + } end return s @@ -443,7 +443,7 @@ local function JTetrimino(sprId) s.width=3 s.height=3 s.shape=1 - s.wallkickGap=1 + s.wallkickGap=1 s.shapes[1]={ {1,0,0}, {1,1,1}, @@ -466,7 +466,7 @@ local function JTetrimino(sprId) {0,1,0}, {0,1,0}, {1,1,0} - } + } end return s @@ -479,7 +479,7 @@ local function TTetrimino(sprId) s.width=3 s.height=3 s.shape=1 - s.wallkickGap=1 + s.wallkickGap=1 s.shapes[1]={ {0,1,0}, {1,1,1}, @@ -502,7 +502,7 @@ local function TTetrimino(sprId) {0,1,0}, {1,1,0}, {0,1,0} - } + } end return s @@ -515,7 +515,7 @@ local function ITetrimino(sprId) s.width=4 s.height=4 s.shape=1 - s.wallkickGap=2 + s.wallkickGap=2 s.shapes[1]={ {0,0,0,0}, {1,1,1,1}, @@ -542,7 +542,7 @@ local function ITetrimino(sprId) {0,1,0,0}, {0,1,0,0}, {0,1,0,0} - } + } end return s @@ -555,7 +555,7 @@ local function OTetrimino(sprId) s.width=4 s.height=3 s.shape=1 - s.wallkickGap=0 + s.wallkickGap=0 s.shapes[1]={ {0,1,1,0}, {0,1,1,0}, @@ -578,7 +578,7 @@ local function OTetrimino(sprId) {0,1,1,0}, {0,1,1,0}, {0,0,0,0} - } + } end return s @@ -732,9 +732,9 @@ local function ScreenManager() function s.GoTo(name) for i,screen in pairs(s.items) do if screen.name == name then - leave() + leave() s.current = screen - enter() + enter() end end end @@ -770,7 +770,7 @@ local function MenuScreen() local function onNewGame() gameScreen.Reset() - screenMng.GoTo(GAME_SCR) + screenMng.GoTo(GAME_SCR) end local function onSoundChanged(itemMenu) @@ -804,7 +804,7 @@ local function PauseScreen() s.menu = Menu(2) local function onContinue() - screenMng.GoTo(GAME_SCR) + screenMng.GoTo(GAME_SCR) end local function onMenu() @@ -846,7 +846,7 @@ local function GameScreen() s.isGameOver=false local function onPause() - screenMng.GoTo(PAUSE_SCR) + screenMng.GoTo(PAUSE_SCR) s.pauseTime=time() end @@ -861,7 +861,7 @@ local function GameScreen() s.current.Move(3,0) s.fallTime=time() - s.next = s.spawner.Spawn() + s.next = s.spawner.Spawn() s.next.Create() end end @@ -910,7 +910,7 @@ local function GameScreen() if score==0 then soundMng.PlaySfx(FELL_SFX) else - soundMng.PlaySfx(LINE_SFX) + soundMng.PlaySfx(LINE_SFX) end score=score+4*s.level @@ -993,13 +993,13 @@ local function GameScreen() PrintToCell("Best: ",1,4,6) PrintToCell(best,1,5,15) - --Level + --Level local level = string.format("%02d", s.level) PrintToCell("Level: ",1,13,6) - PrintToCell(level,2,14,15) + PrintToCell(level,2,14,15) s.grid.Draw(9,0) - s.next.Draw(23,2) + s.next.Draw(23,2) if s.current~=nil then s.current.Draw(9,0) end @@ -1025,13 +1025,13 @@ local function GameOverScreen() function s.OnLeave() soundMng.BreakSfx(GAME_OVER_SFX) - end + end function s.Update() local now=time() local isTime=(now>start+delay) local isBtn=btnp(4) or btnp(5) - if isTime or isBtn then + if isTime or isBtn then onMenu() end end @@ -1258,7 +1258,7 @@ local function Init() soundMng.LoadSettings() soundMng.Add(FellSfx()) soundMng.Add(LineSfx()) - soundMng.Add(GameOverSfx()) + soundMng.Add(GameOverSfx()) soundMng.Add(MenuSfx()) soundMng.Add(SelMenuSfx()) diff --git a/demos/wasm/src/main.zig b/demos/wasm/src/main.zig index 073094882..42c759137 100644 --- a/demos/wasm/src/main.zig +++ b/demos/wasm/src/main.zig @@ -19,19 +19,19 @@ export fn TIC() void { if (tic.btn(0)) { mascot.y -= 1; - } + } if (tic.btn(1)) { mascot.y +=1; - } + } if (tic.btn(2)) { mascot.x -= 1; - } + } if (tic.btn(3)) { mascot.x += 1; - } + } tic.cls(13); - tic.spr(@as(i32, 1+t%60/30*2),mascot.x,mascot.y,.{ + tic.spr(@as(i32, 1+t%60/30*2),mascot.x,mascot.y,.{ .transparent = &.{14}, .scale = 3, .w = 2, diff --git a/demos/wasm/wasmdemo.wasmp b/demos/wasm/wasmdemo.wasmp index b7104f0e3..d5b7b4793 100644 --- a/demos/wasm/wasmdemo.wasmp +++ b/demos/wasm/wasmdemo.wasmp @@ -2,8 +2,8 @@ -- script: wasm """"""""""""""""""""""""""""""""""""""" -WASM is a binary format. The demo -binary code is embedded in this +WASM is a binary format. The demo +binary code is embedded in this cartridge, the source code is not. Run the cart to see the demo. @@ -11,14 +11,14 @@ This demo exits for completeness, but you can't (yet) develop WASM projects using the built-in editor. -The code used to build this project +The code used to build this project can be found in the TIC-80 repo: https://github.com/nesbox/TIC-80 /demos/wasm/ -This demo was built with Zig, but many -languages are supported. You simply +This demo was built with Zig, but many +languages are supported. You simply build your project with your external compiler, then import the final WASM binary into your cartridge: