bullet recoil
This commit is contained in:
parent
ba00a4b8dd
commit
11a4fe9826
1 changed files with 3 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ local function initGame()
|
|||
radius = 30,
|
||||
bullet = {
|
||||
radius = 5,
|
||||
recoil = -10,
|
||||
speed = 500,
|
||||
time = 4,
|
||||
sound = love.sound.newSoundData('resources/bullet.mp3'),
|
||||
|
|
@ -168,6 +169,8 @@ function love.gamepadpressed(joystick, button)
|
|||
}
|
||||
table.insert(state.bullets, bullet)
|
||||
bullet.sound:play()
|
||||
state.ship.speed.x = state.ship.speed.x + math.cos(state.ship.angle) * game.ship.bullet.recoil
|
||||
state.ship.speed.y = state.ship.speed.y + math.sin(state.ship.angle) * game.ship.bullet.recoil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue