This commit is contained in:
veclavtalica 2025-01-27 03:43:35 +03:00
parent a44756b34f
commit 66bcc4d2d8

View File

@ -15,18 +15,26 @@ function game_tick()
if ctx.initialization_needed then if ctx.initialization_needed then
ctx.udata = { ctx.udata = {
time = 0, time = 0,
beat = 0 beat = 0,
} }
start_blasting("mod22") start_blasting("mod22")
end end
local state = ctx.udata local state = ctx.udata
draw_rectangle { draw_camera {
rect = { w = 960, h = 540 }, position = { x=10, y=10, z=10 },
color = { r = 125, a = 255 } direction = { x=-1, y=-1, z=-1 },
up = { x=0, y=1, z=0 },
fov = 0,
zoom = 0.25 + math.sin(ctx.frame_number / 100) / 10,
} }
-- draw_rectangle {
-- rect = { w = 960, h = 540 },
-- color = { r = 125, a = 255 }
-- }
state.time = state.time + ctx.frame_duration state.time = state.time + ctx.frame_duration
if state.time - state.last_beat > 60 / state.blast.bpm then if state.time - state.last_beat > 60 / state.blast.bpm then
state.last_beat = state.last_beat + 60 / state.blast.bpm state.last_beat = state.last_beat + 60 / state.blast.bpm
@ -39,10 +47,14 @@ function game_tick()
local wobble = sinease(12, state.time - state.beat * (60 / state.blast.bpm) , (60 / state.blast.bpm) / 1.5, 0) local wobble = sinease(12, state.time - state.beat * (60 / state.blast.bpm) , (60 / state.blast.bpm) / 1.5, 0)
for i = 0,10 do for i = -10,10 do
draw_sprite { draw_quad {
texture = "art/creatures/meathead/" .. string.format("dance-%s.png", pingpong(state.beat, 3)), texture = "art/creatures/meathead/" .. string.format("dance-%s.png", pingpong(state.beat, 3)),
rect = { w = 64, h = 64 + wobble, x = 300 + i * 32, y = 300 - wobble } texture_region = { w = 32, h = 32 },
v0 = { x = 0 + i/2, y = (64 + wobble) / 64, z = 0 },
v1 = { x = 0 + i/2, y = 0, z = 0 },
v2 = { x = 0 + i/2 + 1, y = 0, z = 0 },
v3 = { x = 0 + i/2 + 1, y = (64 + wobble) / 64, z = 0 },
} }
end end
end end