-
-
Notifications
You must be signed in to change notification settings - Fork 489
Nanobrd
parlortricks edited this page Jun 3, 2022
·
4 revisions
GIF compressed with gifsicle
This is a direct translation of daves84 nanobrd in Lua to Fennel. You can find the cart on tic80.com and the code is supplied below.
I have tried to make this as Fennel(ish) as possible while still staying true to what daves84 coded. I have run fnlfmt and check.fnl against it to clean up any obvious mistakes.
You can also find the source code for both Lua and Fennel hosted at https://gitlab.com/ParlorTricks/nanobrd
;; title: nanobrd
;; author: parlortricks
;; desc: fennel conversion of daves84 nanobrd
;; site: https://daves84.itch.io/nanobrd
;; license: MIT
;; SPDX-License-Identifier: MIT
;; version: 1.0
;; script: fennel
;; strict: true
;; input: gamepad
;; saveid: nanobrd-1
(var (a t z p w s) (values 60 0 0 0 240 math.sin))
(var y a)
(fn _G.TIC []
(cls)
(when (btn 4)
(set z 3)
(sfx 0 0))
(when (> z (- 3))
(set z (- z 0.5)))
(set y (- y z))
(for [i 0 4 1]
(rect (% (+ (- w (/ t 2)) (* i a)) w) 0 10 136 2)
(rect (% (+ (- w (/ t 2)) (* i a)) w) (+ 40 (* 30 (s i))) 10 30 0))
(when (or (or (= (pix 20 y) 2) (> y 136)) (< y 0))
(set y a)
(set t 0))
(print (.. "nanobrd " (// t 120)) 0 0 12)
(for [x 0 w]
(for [y 0 136]
(pix x y (+ (+ (+ (pix x y) (s (/ (+ x t) a))) (s (/ y a)))
(s (bxor x y))))))
(circ 20 y 2 12)
(sfx 0 (math.floor (/ y 3)))
(set t (+ t 1)))
This translation was done with daves84 permission
TIC-80 tiny computer https://tic80.com | Twitter | Telegram | Terms
Built-in Editors
Console
Platform
RAM & VRAM | Display | Palette | Bits per Pixel (BPP) |
.tic
Format | Supported Languages
Other
Tutorials | Code Snippets | Libraries | External Tools | FFT
API
- BDR (0.90)
- BOOT (1.0)
- MENU
- OVR (deprecated)
- SCN (deprecated)
- TIC
- btn & btnp
- circ & circb
- clip
- cls
- elli & ellib (0.90)
- exit
- fget & fset (0.80)
- font
- key & keyp
- line
- map
- memcpy & memset
- mget & mset
- mouse
- music
- peek, peek4
- peek1, peek2 (1.0)
- pix
- pmem
- poke, poke4
- poke1, poke2 (1.0)
- rect & rectb
- reset
- sfx
- spr
- sync
- ttri (1.0)
- time
- trace
- tri & trib (0.90)
- tstamp (0.80)
- vbank (1.0)