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 love = love
local sound local sound
local beat = { local state = {
t = 0,
dt = 0, isGameStarted = false,
}
local wave = { 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 }, 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 }, 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 }, 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, AddImpulse = function( th, size ) end,
ImpactPoint = function( xi, yi, xf, yf ) 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 return impact
end, end,
Update = function( dt ) 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() local function NewGame()
beat.t = love.timer.getTime() state.beat = {}
beat.dt = 0 state.wave.Reset()
end end
local function OnImpact() local beat = { }
--Update beat timer. local function IsOnBeat( t )
local t = love.timer.getTime() if not beat.t then
beat.dt = t - beat.t
beat.t = t 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. --Handle sound.
love.audio.play(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