mirror of
https://github.com/SleepingInsomniac/asteroids
synced 2024-12-26 21:59:30 +01:00
Fix undying bullets bug
This commit is contained in:
parent
4f977a9cf1
commit
0d1592bf03
2 changed files with 4 additions and 4 deletions
|
@ -4,11 +4,12 @@ class Bullet < Sprite
|
||||||
include LxGame::SpriteAge
|
include LxGame::SpriteAge
|
||||||
|
|
||||||
def update(dt)
|
def update(dt)
|
||||||
|
super
|
||||||
update_position(dt)
|
update_position(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
def draw(renderer)
|
def draw(renderer)
|
||||||
brightness = ((4.0 - @age) / 4.0) * 255
|
brightness = ((4.0 - self.age) / 4.0) * 255
|
||||||
renderer.draw_color = SDL::Color[brightness, brightness, 0]
|
renderer.draw_color = SDL::Color[brightness, brightness, 0]
|
||||||
renderer.draw_point(@position.x.to_i, @position.y.to_i)
|
renderer.draw_point(@position.x.to_i, @position.y.to_i)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
module LxGame
|
module LxGame
|
||||||
module SpriteAge
|
module SpriteAge
|
||||||
getter age : Float64 = 0.0
|
property age : Float64 = 0.0
|
||||||
|
|
||||||
def update(dt : Float64)
|
def update(dt : Float64)
|
||||||
super
|
self.age += dt
|
||||||
@age += dt
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue