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,
|
radius = 30,
|
||||||
bullet = {
|
bullet = {
|
||||||
radius = 5,
|
radius = 5,
|
||||||
|
recoil = -10,
|
||||||
speed = 500,
|
speed = 500,
|
||||||
time = 4,
|
time = 4,
|
||||||
sound = love.sound.newSoundData('resources/bullet.mp3'),
|
sound = love.sound.newSoundData('resources/bullet.mp3'),
|
||||||
|
|
@ -168,6 +169,8 @@ function love.gamepadpressed(joystick, button)
|
||||||
}
|
}
|
||||||
table.insert(state.bullets, bullet)
|
table.insert(state.bullets, bullet)
|
||||||
bullet.sound:play()
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue