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

170
main.lua
View File

@ -1,70 +1,118 @@
local love = love local love = love
local sound local sound
local beat = { local state = {
t = 0,
dt = 0,
}
local 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 },
X = function(th) end,
DX = function(th) end,
DDX = function(th) end,
Draw = function() end,
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 }
return impact
end,
Update = function( dt ) end,
}
--Set up all the game state I need. 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 },
X = function(th) end,
DX = function(th) end,
DDX = function(th) end,
Draw = function() end,
AddImpulse = function( th, size ) end,
ImpactPoint = function( xi, yi, xf, yf )
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,
},
}
--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
--Handle sound.
love.audio.play(sound)
end
local function OnVictory() if not beat.dt then
end
function love.draw()
love.graphics.setColor(1.0, 1.0, 1.0)
love.graphics.print("Hello World!", 400, 300)
love.graphics.print( beat.t, 0, 0 )
love.graphics.print( beat.dt, 0, 100 )
love.graphics.setColor(0, 0.4, 0.4)
--love.graphics.circle("fill", 0, 0, 10)
end
function love.load()
sound = love.audio.newSource("soundTest.ogg", "static")
return NewGame()
end
function love.update( dt )
end
function love.keypressed( key, code, isRepeat ) local WEIGHT = 0.25
if key == "escape" then return love.event.quit() end beat.mu = ( 1.0 - WEIGHT ) * beat.mu + WEIGHT * dt
if key == "w" then return OnImpact( ) end
if key == "enter" then return NewGame() end
end 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)
end
local function OnVictory()
end
function love.draw()
love.graphics.setColor(1.0, 1.0, 1.0)
love.graphics.print("Hello World!", 400, 300)
love.graphics.print( beat.t, 0, 0 )
love.graphics.print( beat.dt, 0, 100 )
love.graphics.setColor(0, 0.4, 0.4)
--love.graphics.circle("fill", 0, 0, 10)
end
function love.load()
sound = love.audio.newSource("soundTest.ogg", "static")
return NewGame()
end
function love.update( dt )
end
function love.keypressed( key, code, isRepeat )
if key == "escape" then return love.event.quit() end
if key == "w" then return OnImpact( ) end
if key == "enter" then return NewGame() end
end

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