peanut code

This commit is contained in:
veclavtalica 2025-01-28 21:17:48 +03:00
parent 23c6822191
commit 6060139386

View File

@ -17,8 +17,11 @@ function process_player(state)
input_action { name = "down", control = "S" } input_action { name = "down", control = "S" }
input_action { name = "right", control = "D" } input_action { name = "right", control = "D" }
local right = vec3_norm(vec3_cross(state.player.camera_direction, { x=0, y=1, z=0 })) -- local right = vec3_norm(vec3_cross(state.player.camera_direction, { x=0, y=1, z=0 }))
local up = { x = right.z, y = right.y, z = -right.x } -- local up = { x = right.z, y = right.y, z = -right.x }
local right = { x=-1, y=0, z=0 }
local up = { x=0, y=0, z=1 }
local direction = { x = 0, y = 0 , z = 0 } local direction = { x = 0, y = 0 , z = 0 }
@ -40,6 +43,14 @@ function process_player(state)
end end
state.player.position = vec3_add(state.player.position, vec3_scale(direction, state.player.speed / (60 / state.blast.bpm))) state.player.position = vec3_add(state.player.position, vec3_scale(direction, state.player.speed / (60 / state.blast.bpm)))
local wobble = sinease(24, state.time - state.beat * (60 / state.blast.bpm) , (60 / state.blast.bpm) / 1.5, 0)
draw_billboard {
texture = "art/creatures/peanut/" .. string.format("dance-%s.png", pingpong(state.beat, 3)),
position = { x = state.player.position.x, y = wobble / 64, z = state.player.position.z },
size = { x = 1, y = (64 + wobble) / 64 },
}
end end
function game_tick() function game_tick()
@ -53,7 +64,7 @@ function game_tick()
camera_direction = { x=-math.sin(math.pi / 4), y=-1, z=math.cos(math.pi / 4) }, camera_direction = { x=-math.sin(math.pi / 4), y=-1, z=math.cos(math.pi / 4) },
} }
} }
start_blasting("mod171") start_blasting("mod22")
end end
local state = ctx.udata local state = ctx.udata