Adding some more hooks.

This commit is contained in:
yaw-man 2023-01-13 11:38:14 -04:00
parent 6c8c99651e
commit d9a0f5e23b
2 changed files with 229 additions and 61 deletions

View File

@ -1,10 +1,21 @@
local love = love
local sound
local beat = {
t = 0,
dt = 0,
}
local wave = {
local state = {
isGameStarted = false,
particle = {
x = 0.0,
y = 0.0,
dx = 0.0,
dy = 0.0,
ddx = 0.0,
ddy = 0.0,
Update = function() end,
Draw = function() end
},
wave = {
x = { 1.0, 0.0, -0.5, 0.2, 0.4, 0.8, 0.3, 0.9, -0.4, 0.8, 0.5, 0.1, -0.9 },
dx = { 1.0, 0.0, -0.5, 0.2, 0.4, 0.8, 0.3, 0.9, -0.4, 0.8, 0.5, 0.1, -0.9 },
ddx = { 1.0, 0.0, -0.5, 0.2, 0.4, 0.8, 0.3, 0.9, -0.4, 0.8, 0.5, 0.1, -0.9 },
@ -15,24 +26,61 @@ local wave = {
AddImpulse = function( th, size ) end,
ImpactPoint = function( xi, yi, xf, yf )
local impact = { r = 0, th = 0, x = 0, y = 0, dx = 0, dy = 0 }
local impact = { r = 0, th = 0, t = 0, x = 0, y = 0, dx = 0, dy = 0 }
return impact
end,
Update = function( dt ) end,
},
beat = {
t = nil,
dt = nil,
mu = nil,
score = 0,
},
}
--Set up all the game state I need.
--Reset game state.
local function NewGame()
beat.t = love.timer.getTime()
beat.dt = 0
state.beat = {}
state.wave.Reset()
end
local function OnImpact()
--Update beat timer.
local t = love.timer.getTime()
beat.dt = t - beat.t
local beat = { }
local function IsOnBeat( t )
if not beat.t then
beat.t = t
return true
end
if not beat.dt then
local WEIGHT = 0.25
beat.mu = ( 1.0 - WEIGHT ) * beat.mu + WEIGHT * dt
if beat.score >= 1.0 then
beat.score = 0
return true
end
return false
end
local function OnImpact( impact )
--Update beat timer.
if not beat then
beat = { mu =
end
local dt = impact.t - beat.t
beat.t = impact.t
--Handle sound.
love.audio.play(sound)

120
tok.txt Normal file
View File

@ -0,0 +1,120 @@
a
akesi
ala
alasa
ale
anpa
ante
anu
awen
e
en
esun
ijo
ike
ilo
insa
jaki
jan
jelo
jo
kala
kalama
kama
kasi
ken
kepeken
kili
kiwen
ko
kon
kule
kulupu
kute
la
lape
laso
lawa
len
lete
li
lili
linja
lipu
loje
lon
luka
lukin
lupa
ma
mama
mani
meli
mi
mije
moku
moli
monsi
mu
mun
musi
mute
nanpa
nasa
nasin
nena
ni
nimi
noka
o
olin
ona
open
pakala
pali
palisa
pan
pana
pi
pilin
pimeja
pini
pipi
poka
poki
pona
pu
sama
seli
selo
seme
sewi
sijelo
sike
sin
sina
sinpin
sitelen
sona
soweli
suli
suno
supa
suwi
tan
taso
tawa
telo
tenpo
toki
tomo
tu
unpa
uta
utala
walo
wan
waso
wawa
weka
wile