diff options
| author | Ribbon <ambiguousmachine@gmail.com> | 2022-02-26 23:40:32 -0800 |
|---|---|---|
| committer | Ribbon <ambiguousmachine@gmail.com> | 2022-02-26 23:40:32 -0800 |
| commit | 8d67710e19c0755659633109c45ec90e92b88042 (patch) | |
| tree | d223cf18fa4f5883f5ada670eb045bee09a7ffeb /toxicinvaders_misc/musicplayer/objects_music.lua | |
| parent | 41d9dcc9ab65724858d75a3be45134e527d09108 (diff) | |
file organization
Diffstat (limited to 'toxicinvaders_misc/musicplayer/objects_music.lua')
| -rw-r--r-- | toxicinvaders_misc/musicplayer/objects_music.lua | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/toxicinvaders_misc/musicplayer/objects_music.lua b/toxicinvaders_misc/musicplayer/objects_music.lua new file mode 100644 index 0000000..3c12f48 --- /dev/null +++ b/toxicinvaders_misc/musicplayer/objects_music.lua @@ -0,0 +1,69 @@ +obj = {} +gt = 0 -- game time +ft = 1/60 --frametime +scrollspeed = 0 +menushipscroll = 0 +acidcounter = 0 +hideui = false +autoplay = false +autoplaytimer = 90 +tracknumber = 0 +currentsong = -1 +fadeouttimer = 1 +tracktitleposition = -200 +newtracktitleposition = 0 + +function playsong(song, fade) + fade = fade or 0 + if song ~= currentsong then + music(song, fade) + currentsong = song + end +end + +function fadeoutsong() + fadeouttimer = 1 + playsong(-1,1000) --fades out currentsong +end + +function selectmusic() + if tracknumber == -1 then + tracknumber = 0 + elseif tracknumber == 0 then + playsong(29) + elseif tracknumber == 1 then + playsong(0) + elseif tracknumber == 2 then + playsong(8) + elseif tracknumber == 3 then + playsong(17) + elseif tracknumber == 4 then + playsong(35) + end +end + +function updatetracktitlepos() + if tracknumber == 0 then + newtracktitleposition = -4 + elseif tracknumber == 1 then + newtracktitleposition = 164 + elseif tracknumber == 2 then + newtracktitleposition = 336 + elseif tracknumber == 3 then + newtracktitleposition = 517 + elseif tracknumber == 4 then + newtracktitleposition = 700 + end +end + +function updateobjs() + foreach(obj, function(obj) obj:update() end) +end + +function drawobjs() + foreach(obj, function(obj) obj:draw() end) +end + +function lerp(start, destination, amount) + return start + amount * (destination - start); +end
\ No newline at end of file |
