wtf I don't know
This commit is contained in:
@@ -1 +0,0 @@
|
||||
hrtf = false
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,5 +5,4 @@ sounds=group("audio/enemies/1")
|
||||
sounds.loop:setLooping(true)
|
||||
enemyBasic.super.new(self,x,y,sounds)
|
||||
sounds.loop:play()
|
||||
|
||||
end
|
||||
@@ -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)
|
||||
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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
|
||||
+1
-1
@@ -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
|
||||
+3
-7
@@ -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
|
||||
}
|
||||
+2
-2
@@ -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)
|
||||
@@ -10,3 +10,9 @@ 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
|
||||
Reference in New Issue
Block a user