bullet sound
This commit is contained in:
parent
d498c7c78a
commit
ba00a4b8dd
2 changed files with 6 additions and 2 deletions
|
|
@ -10,6 +10,7 @@ local function initGame()
|
||||||
radius = 5,
|
radius = 5,
|
||||||
speed = 500,
|
speed = 500,
|
||||||
time = 4,
|
time = 4,
|
||||||
|
sound = love.sound.newSoundData('resources/bullet.mp3'),
|
||||||
},
|
},
|
||||||
-- 99x75
|
-- 99x75
|
||||||
sprite = love.graphics.newImage('resources/ship.png'),
|
sprite = love.graphics.newImage('resources/ship.png'),
|
||||||
|
|
@ -158,12 +159,15 @@ function love.gamepadpressed(joystick, button)
|
||||||
end
|
end
|
||||||
if button == "b" then
|
if button == "b" then
|
||||||
-- debounce, perhaps
|
-- debounce, perhaps
|
||||||
table.insert(state.bullets, {
|
local bullet = {
|
||||||
x = state.ship.x + math.cos(state.ship.angle) * game.ship.radius,
|
x = state.ship.x + math.cos(state.ship.angle) * game.ship.radius,
|
||||||
y = state.ship.y + math.sin(state.ship.angle) * game.ship.radius,
|
y = state.ship.y + math.sin(state.ship.angle) * game.ship.radius,
|
||||||
angle = state.ship.angle,
|
angle = state.ship.angle,
|
||||||
timeLeft = game.ship.bullet.time,
|
timeLeft = game.ship.bullet.time,
|
||||||
})
|
sound = love.audio.newSource(game.ship.bullet.sound),
|
||||||
|
}
|
||||||
|
table.insert(state.bullets, bullet)
|
||||||
|
bullet.sound:play()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
BIN
asteroids/resources/bullet.mp3
Normal file
BIN
asteroids/resources/bullet.mp3
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue