fix logo bounce, adjust music a bit
This commit is contained in:
parent
17dd2a23a3
commit
272e0bc615
7 changed files with 50 additions and 36 deletions
|
|
@ -76,10 +76,18 @@
|
|||
:logo (do
|
||||
(set logo-x (+ logo-x (* logo-dx dt)))
|
||||
(set logo-y (+ logo-y (* logo-dy dt)))
|
||||
(when (or (< logo-x 0) (> logo-x 512))
|
||||
(set logo-dx (- logo-dx)))
|
||||
(when (or (< logo-y 0) (> logo-y 296))
|
||||
(set logo-dy (- logo-dy))))
|
||||
(when (< logo-x 0)
|
||||
(set logo-x 0)
|
||||
(set logo-dx (math.abs logo-dx)))
|
||||
(when (> logo-x 512)
|
||||
(set logo-x 512)
|
||||
(set logo-dx (- (math.abs logo-dx))))
|
||||
(when (< logo-y 0)
|
||||
(set logo-y 0)
|
||||
(set logo-dy (math.abs logo-dy)))
|
||||
(when (> logo-y 296)
|
||||
(set logo-y 296)
|
||||
(set logo-dy (- (math.abs logo-dy)))))
|
||||
:worldgen (worldgen.update dt))
|
||||
|
||||
(music.update dt)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,27 @@
|
|||
;; ============================================================================
|
||||
;; Theme in A minor
|
||||
;; Key: Am | Tempo: 95 BPM | Time: 4/4
|
||||
;; ============================================================================
|
||||
;;
|
||||
;; Melody (Triangle, A4 range):
|
||||
;; Bar 1: A4~ .C5 | E5 D5 | C5 A4 | G4 A4 |
|
||||
;; Bar 2: A4~ .C5 | E5 G5 | F5 E5 | D5~~~~ |
|
||||
;; Bar 3: D5~ .E5 | F5 D5 | C5 A4 | G4 A4 |
|
||||
;; Bar 4: C5~ .D5 | E5 C5 | A4 G4 | A4~~~~ |
|
||||
;;
|
||||
;; Bass (Triangle, A2 range, octave jumps):
|
||||
;; | A2 A2 A3 A2 | A2 A3 A2 A3 | C3 C3 C4 C3 | C3 C4 C3 C4 |
|
||||
;; | D3 D3 D4 D3 | D3 D4 D3 D4 | A2 A2 A3 A2 | A2 A3 E3 A2 |
|
||||
;;
|
||||
;; Legend: ~ = held note, . = sixteenth rest before
|
||||
;; ============================================================================
|
||||
|
||||
(local pxl8 (require :pxl8))
|
||||
|
||||
(var time 0)
|
||||
(var step 0)
|
||||
(var ctx nil)
|
||||
(var melody-params nil)
|
||||
(var harmony-params nil)
|
||||
(var bass-params nil)
|
||||
(var playing false)
|
||||
|
||||
|
|
@ -13,7 +30,7 @@
|
|||
(local sixteenth (/ beat 4))
|
||||
(local eighth (/ beat 2))
|
||||
(local quarter beat)
|
||||
(local whole (* 4 beat))
|
||||
(local _whole (* 4 beat))
|
||||
|
||||
(local melody [[69 eighth] [0 sixteenth] [72 sixteenth]
|
||||
[76 eighth] [74 eighth]
|
||||
|
|
@ -35,11 +52,6 @@
|
|||
[69 eighth] [67 eighth]
|
||||
[69 quarter]])
|
||||
|
||||
(local harmony [[57 whole] ; A3
|
||||
[60 whole] ; C4
|
||||
[62 whole] ; D4
|
||||
[57 whole]]) ; A3
|
||||
|
||||
(local bass [[45 eighth] [45 eighth] [57 eighth] [45 eighth]
|
||||
[45 eighth] [57 eighth] [45 eighth] [57 eighth]
|
||||
[48 eighth] [48 eighth] [60 eighth] [48 eighth]
|
||||
|
|
@ -53,6 +65,14 @@
|
|||
|
||||
(fn init []
|
||||
(set ctx (pxl8.sfx_context_create))
|
||||
|
||||
(local reverb (pxl8.sfx_reverb_create
|
||||
{:room 0.5 :damping 0.4 :mix 0.35}))
|
||||
(local compressor (pxl8.sfx_compressor_create
|
||||
{:threshold -18 :ratio 6 :attack 3 :release 100}))
|
||||
(pxl8.sfx_context_append_node ctx reverb)
|
||||
(pxl8.sfx_context_append_node ctx compressor)
|
||||
|
||||
(pxl8.sfx_mixer_attach ctx)
|
||||
|
||||
(set melody-params (pxl8.sfx_voice_params
|
||||
|
|
@ -60,21 +80,14 @@
|
|||
:attack 0.02 :decay 0.15 :sustain 0.5 :release 0.15
|
||||
:filter_type pxl8.SFX_FILTER_LOWPASS
|
||||
:filter_cutoff 4000 :filter_resonance 0.0
|
||||
:fx_send 0.0}))
|
||||
|
||||
(set harmony-params (pxl8.sfx_voice_params
|
||||
{:waveform pxl8.SFX_WAVE_TRIANGLE
|
||||
:attack 0.05 :decay 0.2 :sustain 0.3 :release 0.2
|
||||
:filter_type pxl8.SFX_FILTER_LOWPASS
|
||||
:filter_cutoff 2500 :filter_resonance 0.0
|
||||
:fx_send 0.0}))
|
||||
:fx_send 0.4}))
|
||||
|
||||
(set bass-params (pxl8.sfx_voice_params
|
||||
{:waveform pxl8.SFX_WAVE_TRIANGLE
|
||||
:attack 0.015 :decay 0.1 :sustain 0.7 :release 0.1
|
||||
:filter_type pxl8.SFX_FILTER_LOWPASS
|
||||
:filter_cutoff 1200 :filter_resonance 0.0
|
||||
:fx_send 0.0})))
|
||||
:filter_cutoff 1800 :filter_resonance 0.0
|
||||
:fx_send 0.15})))
|
||||
|
||||
(fn start []
|
||||
(set playing true)
|
||||
|
|
@ -98,13 +111,6 @@
|
|||
(when (> melody-note 0)
|
||||
(pxl8.sfx_play_note ctx melody-note melody-params 0.45 melody-dur))
|
||||
|
||||
(local bar (math.floor (/ step 32)))
|
||||
(local harmony-idx (+ 1 (% bar (length harmony))))
|
||||
(local harmony-entry (. harmony harmony-idx))
|
||||
(local harmony-note (. harmony-entry 1))
|
||||
(when (= (% step 32) 0)
|
||||
(pxl8.sfx_play_note ctx harmony-note harmony-params 0.25 whole))
|
||||
|
||||
(local bass-step (math.floor (/ step 2)))
|
||||
(local bass-idx (+ 1 (% bass-step (length bass))))
|
||||
(local bass-entry (. bass bass-idx))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue