diff --git a/.DS_Store b/.DS_Store index 4598eca..88d1c81 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/alsoft.conf b/alsoft.conf deleted file mode 100644 index 499fa4d..0000000 --- a/alsoft.conf +++ /dev/null @@ -1 +0,0 @@ -hrtf = false diff --git a/audio/.DS_Store b/audio/.DS_Store index 8043bae..99ce10b 100644 Binary files a/audio/.DS_Store and b/audio/.DS_Store differ diff --git a/audio/enemies/.DS_Store b/audio/enemies/.DS_Store index 5d77cc4..bb28478 100644 Binary files a/audio/enemies/.DS_Store and b/audio/enemies/.DS_Store differ diff --git a/audio/enemies/1/.DS_Store b/audio/enemies/1/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/audio/enemies/1/.DS_Store differ diff --git a/audio/enemies/1/oloop.flac b/audio/enemies/1/oloop.flac deleted file mode 100644 index 9d53ff0..0000000 Binary files a/audio/enemies/1/oloop.flac and /dev/null differ diff --git a/audio/radar.flac b/audio/radar.flac new file mode 100644 index 0000000..8c130e7 Binary files /dev/null and b/audio/radar.flac differ diff --git a/enemies/basic.lua b/enemies/basic.lua index 38dc6f7..393511d 100644 --- a/enemies/basic.lua +++ b/enemies/basic.lua @@ -5,5 +5,4 @@ sounds=group("audio/enemies/1") sounds.loop:setLooping(true) enemyBasic.super.new(self,x,y,sounds) sounds.loop:play() - end \ No newline at end of file diff --git a/enemy.lua b/enemy.lua index fa9b827..fc3c352 100644 --- a/enemy.lua +++ b/enemy.lua @@ -1,12 +1,18 @@ enemy=object:extend() -function enemy:new(x,y,sounds) +function enemy:new(x,y,sounds,hp) self.x=x self.y=y self.dx=0 self.dy=-1 +self.hp=hp or 10 self.sounds=sounds; sounds.loop:setPosition(x,y,0) +for k,v in pairs(sounds) do +if v:typeOf("Source") then +v:setAttenuationDistances(110,game.field.height) +end +end self.lastMoveTick=0 self.rate=game.currentTrack.info.beatDivisions end -- new @@ -21,5 +27,16 @@ function enemy:move() self.lastMoveTick=game.ticker.ticks self.x=self.x+self.dx self.y=self.y+self.dy -self.sounds.loop:setPosition(self.x,self.y,0) -end \ No newline at end of file +utils.setSourcePosition(self.sounds.loop, self.x,self.y) +if(self.y<=0) then self:land() end +end + +function enemy:land() +tts.say("landed") +for k,v in pairs(self.sounds) do +if v:typeOf("Source") then +if v:isLooping() then v:stop() end +end +end -- stop all loops +self.destroy=true +end -- land \ No newline at end of file diff --git a/field.lua b/field.lua index 4bcbfc3..47744f5 100644 --- a/field.lua +++ b/field.lua @@ -9,5 +9,6 @@ end -- new function field:update(dt) for k,v in pairs(self.contents) do v:update(dt) +if v.destroy then game.field.contents[k]=nil end end -- for field end \ No newline at end of file diff --git a/game.lua b/game.lua index 23874c8..224b9bb 100644 --- a/game.lua +++ b/game.lua @@ -1,7 +1,7 @@ require "field" game={} -game.field=field(40,20) +game.field=field(40,30) game.player=player game.ticker=ticker(0.125) game.currentTrack={} @@ -31,7 +31,8 @@ game.trackRunning=false end -- loadtrack function game.init() -table.insert(game.field.contents, enemyBasic(5,20)) +game.meh=enemyBasic(6,game.field.height) +table.insert(game.field.contents, game.meh) function game.ticker:tick() for k,event in pairs(game.events) do local adjustedTicks=game.ticker.ticks-1+(event.shift or 0) @@ -48,12 +49,17 @@ end -- if fire one-shot event end -- if recurring end -- for events end -local click={ -i=2, +local radar={ +i=1, recurring=true, func=function() +for k,v in pairs(game.field.contents) do +if v.x==player.x then aud.meh:stop() aud.meh:play() +return +end +end end } local beep={ @@ -64,6 +70,6 @@ aud.beep:stop() aud.beep:play() end } --- game.events.click=click +game.events.radar=radar -- game.events.beep=beep end \ No newline at end of file diff --git a/main.lua b/main.lua index c151088..30500b1 100644 --- a/main.lua +++ b/main.lua @@ -18,7 +18,9 @@ require "player" require "game" require "enemy" require "enemies/basic" +love.audio.setDistanceModel("exponent") aud=group("audio") +aud.meh:setRelative(true) c=require "tracks/gourmet" love.timer.sleep(1) game.loadTrack(c) @@ -39,8 +41,7 @@ player.direction=-1 elseif key=="c" then tts.say(player.x) elseif key=="d" then -print(love.audio.getOrientation()) -love.audio.setPosition(100,0,30) +tts.say(game.meh.y) end end -- keyPressed diff --git a/player.lua b/player.lua index 912fca8..134e4fa 100644 --- a/player.lua +++ b/player.lua @@ -20,6 +20,6 @@ if dx<0 or dx>game.field.width then -- boundary shit goes here else player.x=dx -love.audio.setPosition(player.x, player.y, 0) +love.audio.setPosition(player.x, player.y, 3) end -- if boundary end \ No newline at end of file diff --git a/soundgroups.lua b/soundgroups.lua index 83d405c..a4fa5be 100644 --- a/soundgroups.lua +++ b/soundgroups.lua @@ -9,9 +9,9 @@ function group:addDirectory(directory) files=fs.getDirectoryItems(directory) sound=love.audio.newSource(fullpath, "static") if sound:typeOf("Source") then --print("Loaded " .. nameOnly) - if sound:getChannelCount()==1 then sound:setRelative(true) end + -- if sound:getChannelCount()==1 then sound:setRelative(true) end self[nameOnly]=sound - self.sounds[nameOnly] =sound + -- self.sounds[nameOnly] =sound end --if is a sound end --if it's a file end -- if it's not a dot @@ -20,7 +20,7 @@ function group:addDirectory(directory) files=fs.getDirectoryItems(directory) end --addDirectory function group:new(directory) - self.sounds={} + -- self.sounds={} self:addDirectory(directory) end @@ -42,7 +42,3 @@ end --setEffect function -t={ -a=2, -b=3 -} \ No newline at end of file diff --git a/tracks/gourmet.lua b/tracks/gourmet.lua index 003a39f..8233bbd 100644 --- a/tracks/gourmet.lua +++ b/tracks/gourmet.lua @@ -1,9 +1,9 @@ local t={ path="audio/tracks/gourmet.mp3", bpm=160, -startTime=0.05, +startTime=0.02, beatDivisions=4, -volumeBase=0 +volumeBase=0.02 } return track(t) \ No newline at end of file diff --git a/utils.lua b/utils.lua index a4d448a..2bc019d 100644 --- a/utils.lua +++ b/utils.lua @@ -9,4 +9,10 @@ local closest=math.min(math.abs(time-prevDivTime), math.abs(time-nextDivTime)) local halfDivision=beatDivisions/2*game.ticker.tickTime -- print(math.abs(time-nextDivTime),"to next beat, ",math.abs(time-prevDivTime)," to previous beat. Half division is ",halfDivision,". Closest is ",closest,". The current time is ",time,", and the next division is at ", nextDivTime,", last tick happened at ",game.ticker.lastTickTime," and is tick number ",game.ticker.ticks) return (halfDivision-closest)/halfDivision -- Math is hard +end + +local volumeScale=0.0029 +function utils.setSourcePosition(source, x, y) +source:setPosition(x,8,0) +source:setVolume(volumeScale*game.field.height-volumeScale*math.abs(player.y-y)) end \ No newline at end of file