commit 62487c61ed1be3047b20a677e67bf5d3fac6c262 Author: veclavtalica Date: Sun Jan 26 23:16:13 2025 +0300 steak dancers diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e973e57 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.21) + +project(anbap LANGUAGES C) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug) +endif() + +add_subdirectory($ENV{TWNROOT}/apps/twnlua ${CMAKE_CURRENT_BINARY_DIR}/twnlua) diff --git a/data/art/creatures/meathead/dance-0.png b/data/art/creatures/meathead/dance-0.png new file mode 100644 index 0000000..8492401 Binary files /dev/null and b/data/art/creatures/meathead/dance-0.png differ diff --git a/data/art/creatures/meathead/dance-1.png b/data/art/creatures/meathead/dance-1.png new file mode 100644 index 0000000..91221de Binary files /dev/null and b/data/art/creatures/meathead/dance-1.png differ diff --git a/data/art/creatures/meathead/dance-2.png b/data/art/creatures/meathead/dance-2.png new file mode 100644 index 0000000..cc1e37a Binary files /dev/null and b/data/art/creatures/meathead/dance-2.png differ diff --git a/data/baron-walk.png b/data/baron-walk.png new file mode 100644 index 0000000..2571da3 Binary files /dev/null and b/data/baron-walk.png differ diff --git a/data/scripts/game.lua b/data/scripts/game.lua new file mode 100644 index 0000000..20537cb --- /dev/null +++ b/data/scripts/game.lua @@ -0,0 +1,48 @@ +local traxx = require "traxx" +require "utils" +require "string" +require "math" + +function start_blasting(track) + local blast = table.shallow_copy(traxx[track]) + blast.channel = "blast" + ctx.udata.blast = blast + ctx.udata.last_beat = ctx.udata.time + 60 / blast.bpm + audio_play(ctx.udata.blast) +end + +function game_tick() + if ctx.initialization_needed then + ctx.udata = { + time = 0, + beat = 0 + } + start_blasting("mod22") + end + + local state = ctx.udata + + draw_rectangle { + rect = { w = 960, h = 540 }, + color = { r = 125, a = 255 } + } + + state.time = state.time + ctx.frame_duration + if state.time - state.last_beat > 60 / state.blast.bpm then + state.last_beat = state.last_beat + 60 / state.blast.bpm + state.beat = state.beat + 1 + -- draw_rectangle { + -- rect = { w = 64, h = 64 }, + -- color = { r = 255, a = 255 } + -- } + end + + local wobble = sinease(12, state.time - state.beat * (60 / state.blast.bpm) , (60 / state.blast.bpm) / 1.5, 0) + + for i = 0,10 do + draw_sprite { + 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 } + } + end +end diff --git a/data/scripts/traxx.lua b/data/scripts/traxx.lua new file mode 100644 index 0000000..a49591f --- /dev/null +++ b/data/scripts/traxx.lua @@ -0,0 +1,14 @@ +-- listing of all traxx to blast +return { + mod4 = { + audio = "traxx/mod4.xm", + bpm = 101.5, + loops = true, + }, + + mod22 = { + audio = "traxx/mod22.xm", + bpm = 177 / 2, + loops = true, + }, +} diff --git a/data/scripts/utils.lua b/data/scripts/utils.lua new file mode 100644 index 0000000..2d57ad1 --- /dev/null +++ b/data/scripts/utils.lua @@ -0,0 +1,30 @@ +require "math" + +function table.shallow_copy(t) + local t2 = {} + for k,v in pairs(t) do + t2[k] = v + end + return t2 +end + +function thisorthat(c, a, b) + if c then return a else return b end +end + +function pingpong(at, over) + local c = (over - 1) * 2 + if math.fmod(at, c) >= over then + return c - math.fmod(at, c) + else + return math.fmod(at, c) + end +end + +function linease(c, t, d, b) + return c * t / d + b +end + +function sinease(c, t, d, b) + return -c*math.cos(t/d*(math.pi/2)) + c + b +end diff --git a/data/traxx/mod22.xm b/data/traxx/mod22.xm new file mode 100755 index 0000000..049d57c Binary files /dev/null and b/data/traxx/mod22.xm differ diff --git a/data/traxx/mod4.xm b/data/traxx/mod4.xm new file mode 100755 index 0000000..1e2de8f Binary files /dev/null and b/data/traxx/mod4.xm differ diff --git a/data/twn.toml b/data/twn.toml new file mode 100644 index 0000000..d3a8016 --- /dev/null +++ b/data/twn.toml @@ -0,0 +1,26 @@ +# This file contains everything about the engine and your game that can be +# configured before it runs. +# +# Optional settings are commented out, with their default values shown. +# Invalid values in these settings will be ignored. + +# Data about your game as an application +[about] +title = "aintnothingbutapeanut" +developer = "veclavtalica" +app_id = "anbap" +dev_id = "veclavtalica" + +# Game runtime details +[game] +resolution = [ 960, 540 ] +#debug = true + +# Engine tweaks. You probably don't need to change these +[engine] +ticks_per_second = 60 # minimum of 8 +#keybind_slots = 3 # minimum of 1 +#texture_atlas_size = 2048 # minimum of 32 +#font_texture_size = 2048 # minimum of 1024 +#font_oversampling = 4 # minimum of 0 +#font_filtering = "linear" # possible values: "nearest", "linear"