123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- -- title: palettefade
- -- author: pixelbath
- -- desc: fades elements of the palette
- -- script: lua
- -- TODO: read the TIC palette at runtime
- local basepalette = {
- 0x1a1c2c, 0x29366f, 0x3b5dc9, 0x1a1c2c, 0x5d275d, 0x38b764, 0xb13e53, 0x333c57, 0x41a6f6, 0xef7d57, 0x94b0c2, 0xa7f070, 0xe06f8b, 0x73eff7, 0xffcd75, 0xf4f4f4
- }
- function pal(v)
- if v>1 then v=1 end
- if v<0 then v=0 end
- for i = 1, #basepalette do
- local offset, color = i-1, basepalette[i]
- poke(0x3fc0+(offset*3), ((color//65536) * v))
- poke(0x3fc1+(offset*3), ((color//256)%256) * v)
- poke(0x3fc2+(offset*3), (color%256) * v)
- end
- end
- local palval=0
- local palinc=0.1
- t=0
- x=96
- y=24
- 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
- cls(13)
- spr(1+t%60//30*2,x,y,14,3,0,0,2,2)
- print("HELLO WORLD!",84,84)
- t=t+1
-
- palval=palval+palinc
- if palval > 0.9 then palinc=-0.1 end
- if palval < 0.1 then palinc=0.1 end
- pal(palval)
- end
- -- <TILES>
- -- 001:7fffffffff111111f8888888f8111111f8fffffff8ff0ffff8ff0ffff8ff0fff
- -- 002:fffff7771111ff7788880f7711180f77fff80fff0ff80f0f0ff80f0f0ff80f0f
- -- 003:7fffffffff111111f8888888f8111111f8fffffff8fffffff8ff0ffff8ff0fff
- -- 004:fffff7771111ff7788880f7711180f77fff80ffffff80f0f0ff80f0f0ff80f0f
- -- 017:f8fffffff8888888f888f888f8888ffff8888888f1111111ff000fff7fffff7f
- -- 018:fff800ff88880ff7f8880f7788880f7788880f771111ff77000ff777ffff7777
- -- 019:f8fffffff8888888f888f888f8888ffff8888888f1111111ff000fff7fffff7f
- -- 020:fff800ff88880ff7f8880f7788880f7788880f771111ff77000ff777ffff7777
- -- </TILES>
- -- <WAVES>
- -- 000:00000000ffffffff00000000ffffffff
- -- 001:0123456789abcdeffedcba9876543210
- -- 002:0123456789abcdef0123456789abcdef
- -- </WAVES>
- -- <SFX>
- -- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
- -- </SFX>
- -- <PALETTE>
- -- 000:1a1c2c29366f3b5dc91a1c2c5d275d38b764b13e53333c5741a6f6ef7d5794b0c2a7f070e06f8b73eff7ffcd75f4f4f4
- -- </PALETTE>
|