Compare commits
5 Commits
66bcc4d2d8
...
main
Author | SHA1 | Date | |
---|---|---|---|
6edbb30f1c | |||
6060139386 | |||
23c6822191 | |||
efed1e8cc3 | |||
af468fe6a4 |
BIN
data/art/creatures/peanut/dance-0.png
Normal file
BIN
data/art/creatures/peanut/dance-0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
data/art/creatures/peanut/dance-1.png
Normal file
BIN
data/art/creatures/peanut/dance-1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
data/art/creatures/peanut/dance-2.png
Normal file
BIN
data/art/creatures/peanut/dance-2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -11,23 +11,73 @@ function start_blasting(track)
|
|||||||
audio_play(ctx.udata.blast)
|
audio_play(ctx.udata.blast)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function process_player(state)
|
||||||
|
input_action { name = "up", control = "W" }
|
||||||
|
input_action { name = "left", control = "A" }
|
||||||
|
input_action { name = "down", control = "S" }
|
||||||
|
input_action { name = "right", control = "D" }
|
||||||
|
|
||||||
|
-- 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 right = { x=-1, y=0, z=0 }
|
||||||
|
local up = { x=0, y=0, z=1 }
|
||||||
|
|
||||||
|
local direction = { x = 0, y = 0 , z = 0 }
|
||||||
|
|
||||||
|
if input_action_pressed { name = "up" } then
|
||||||
|
direction = vec3_add(direction, up)
|
||||||
|
end
|
||||||
|
if input_action_pressed { name = "down" } then
|
||||||
|
direction = vec3_sub(direction, up)
|
||||||
|
end
|
||||||
|
if input_action_pressed { name = "right" } then
|
||||||
|
direction = vec3_add(direction, right)
|
||||||
|
end
|
||||||
|
if input_action_pressed { name = "left" } then
|
||||||
|
direction = vec3_sub(direction, right)
|
||||||
|
end
|
||||||
|
|
||||||
|
if vec3_length(direction) > 0 then
|
||||||
|
direction = vec3_norm(direction)
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
function game_tick()
|
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,
|
||||||
|
player = {
|
||||||
|
position = { x=3, y=0, z=0 },
|
||||||
|
speed = 0.06, -- tiles per beat
|
||||||
|
camera_direction = { x=-math.sin(math.pi / 4), y=-1, z=math.cos(math.pi / 4) },
|
||||||
|
}
|
||||||
}
|
}
|
||||||
start_blasting("mod22")
|
start_blasting("mod22")
|
||||||
end
|
end
|
||||||
|
|
||||||
local state = ctx.udata
|
local state = ctx.udata
|
||||||
|
|
||||||
|
process_player(state)
|
||||||
|
|
||||||
draw_camera {
|
draw_camera {
|
||||||
position = { x=10, y=10, z=10 },
|
position = state.player.position,
|
||||||
direction = { x=-1, y=-1, z=-1 },
|
direction = state.player.camera_direction,
|
||||||
|
-- direction = { x=-math.sin(ctx.frame_number / 100), y=-1, z=math.cos(ctx.frame_number / 100) },
|
||||||
up = { x=0, y=1, z=0 },
|
up = { x=0, y=1, z=0 },
|
||||||
fov = 0,
|
fov = 0,
|
||||||
zoom = 0.25 + math.sin(ctx.frame_number / 100) / 10,
|
zoom = 0.15 + math.sin(ctx.frame_number / 100) / 20,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- draw_rectangle {
|
-- draw_rectangle {
|
||||||
@ -51,10 +101,16 @@ function game_tick()
|
|||||||
draw_quad {
|
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)),
|
||||||
texture_region = { w = 32, h = 32 },
|
texture_region = { w = 32, h = 32 },
|
||||||
v0 = { x = 0 + i/2, y = (64 + wobble) / 64, z = 0 },
|
v0 = { x = 0, y = (64 + wobble) / 64, z = 0 + i/2 },
|
||||||
v1 = { x = 0 + i/2, y = 0, z = 0 },
|
v1 = { x = 0, y = 0, z = 0 + i/2 },
|
||||||
v2 = { x = 0 + i/2 + 1, y = 0, z = 0 },
|
v2 = { x = 0, y = 0, z = 0 + i/2 + 1 },
|
||||||
v3 = { x = 0 + i/2 + 1, y = (64 + wobble) / 64, z = 0 },
|
v3 = { x = 0, y = (64 + wobble) / 64, z = 0 + i/2 + 1 },
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_billboard {
|
||||||
|
texture = "art/creatures/meathead/" .. string.format("dance-%s.png", pingpong(state.beat, 3)),
|
||||||
|
position = { x = i, y = wobble / 64, z = 0 },
|
||||||
|
size = { x = 1, y = (64 + wobble) / 64 },
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -11,4 +11,10 @@ return {
|
|||||||
bpm = 177 / 2,
|
bpm = 177 / 2,
|
||||||
loops = true,
|
loops = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mod171 = {
|
||||||
|
audio = "traxx/mod171.xm",
|
||||||
|
bpm = 125,
|
||||||
|
loops = true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -28,3 +28,39 @@ end
|
|||||||
function sinease(c, t, d, b)
|
function sinease(c, t, d, b)
|
||||||
return -c*math.cos(t/d*(math.pi/2)) + c + b
|
return -c*math.cos(t/d*(math.pi/2)) + c + b
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function vec3_cross(a, b)
|
||||||
|
return {
|
||||||
|
x = a.y * b.z - a.z * b.y,
|
||||||
|
y = a.z * b.x - a.x * b.z,
|
||||||
|
z = a.x * b.y - a.y * b.x,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function vec3_dot(a, b)
|
||||||
|
return a.x * b.x + a.y * b.y + a.z * b.z
|
||||||
|
end
|
||||||
|
|
||||||
|
function vec3_scale(a, s)
|
||||||
|
return {
|
||||||
|
x = a.x * s,
|
||||||
|
y = a.y * s,
|
||||||
|
z = a.z * s,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function vec3_norm(a)
|
||||||
|
return vec3_scale(a, 1.0 / math.sqrt(vec3_dot(a, a)))
|
||||||
|
end
|
||||||
|
|
||||||
|
function vec3_add(a, b)
|
||||||
|
return { x = a.x + b.x, y = a.y + b.y, z = a.z + b.z }
|
||||||
|
end
|
||||||
|
|
||||||
|
function vec3_sub(a, b)
|
||||||
|
return { x = a.x - b.x, y = a.y - b.y, z = a.z - b.z }
|
||||||
|
end
|
||||||
|
|
||||||
|
function vec3_length(a)
|
||||||
|
return math.sqrt(a.x * a.x + a.y * a.y + a.z * a.z)
|
||||||
|
end
|
||||||
|
BIN
data/traxx/mod171.xm
Executable file
BIN
data/traxx/mod171.xm
Executable file
Binary file not shown.
@ -15,10 +15,12 @@ dev_id = "veclavtalica"
|
|||||||
[game]
|
[game]
|
||||||
resolution = [ 960, 540 ]
|
resolution = [ 960, 540 ]
|
||||||
#debug = true
|
#debug = true
|
||||||
|
background_color = [ 125, 0, 0, 255 ]
|
||||||
|
|
||||||
# Engine tweaks. You probably don't need to change these
|
# Engine tweaks. You probably don't need to change these
|
||||||
[engine]
|
[engine]
|
||||||
ticks_per_second = 60 # minimum of 8
|
ticks_per_second = 60 # minimum of 8
|
||||||
|
cull_faces = false
|
||||||
#keybind_slots = 3 # minimum of 1
|
#keybind_slots = 3 # minimum of 1
|
||||||
#texture_atlas_size = 2048 # minimum of 32
|
#texture_atlas_size = 2048 # minimum of 32
|
||||||
#font_texture_size = 2048 # minimum of 1024
|
#font_texture_size = 2048 # minimum of 1024
|
||||||
|
Reference in New Issue
Block a user