74 lines
1.8 KiB
Plaintext
74 lines
1.8 KiB
Plaintext
// title: Doom Fire
|
|
// author: Fabien Freling
|
|
// desc: inspired by https://fabiensanglard.net/doom_fire_psx/
|
|
// script: wren
|
|
|
|
import "random" for Random
|
|
|
|
class Game is TIC{
|
|
|
|
construct new(){
|
|
_t=0
|
|
// Init to black
|
|
_base = List.filled(240 * 136, 0)
|
|
for (last_line in (240 * 135)...(240 * 136)) {
|
|
_base[last_line] = 15
|
|
}
|
|
_random = Random.new(12345)
|
|
TIC.cls(0)
|
|
}
|
|
|
|
dofire() {
|
|
for (x in 0...240) {
|
|
for (y in 135..1) {
|
|
spreadfire(x, y)
|
|
}
|
|
}
|
|
}
|
|
|
|
spreadfire(x, y) {
|
|
var rand = _random.int(2)
|
|
var delta = rand
|
|
var index = x + y * 240
|
|
_base[index - 240] = _base[index] - delta
|
|
if (_base[index - 240] < 0) {
|
|
_base[index - 240] = 0
|
|
}
|
|
}
|
|
|
|
TIC(){
|
|
for (y in 0...136) {
|
|
for (x in 0...240) {
|
|
TIC.pix(x, y, _base[x + y * 240])
|
|
}
|
|
}
|
|
dofire()
|
|
_t=_t+1
|
|
}
|
|
}
|
|
// <TILES>
|
|
// 001:efffffffff222222f8888888f8222222f8fffffff8ff0ffff8ff0ffff8ff0fff
|
|
// 002:fffffeee2222ffee88880fee22280feefff80fff0ff80f0f0ff80f0f0ff80f0f
|
|
// 003:efffffffff222222f8888888f8222222f8fffffff8fffffff8ff0ffff8ff0fff
|
|
// 004:fffffeee2222ffee88880fee22280feefff80ffffff80f0f0ff80f0f0ff80f0f
|
|
// 017:f8fffffff8888888f888f888f8888ffff8888888f2222222ff000fffefffffef
|
|
// 018:fff800ff88880ffef8880fee88880fee88880fee2222ffee000ffeeeffffeeee
|
|
// 019:f8fffffff8888888f888f888f8888ffff8888888f2222222ff000fffefffffef
|
|
// 020:fff800ff88880ffef8880fee88880fee88880fee2222ffee000ffeeeffffeeee
|
|
// </TILES>
|
|
|
|
// <WAVES>
|
|
// 000:00000000ffffffff00000000ffffffff
|
|
// 001:0123456789abcdeffedcba9876543210
|
|
// 002:0123456789abcdef0123456789abcdef
|
|
// </WAVES>
|
|
|
|
// <SFX>
|
|
// 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
|
|
// </SFX>
|
|
|
|
// <PALETTE>
|
|
// 000:0000002424245d343471614ea54c30b66534ff4648da8930b27d55d27d2cc69548caaa2cd2aa4cc2c25ddad45effffff
|
|
// </PALETTE>
|
|
|