From 0d1592bf0362b775f81b9bfb734e739f7354a54e Mon Sep 17 00:00:00 2001 From: Alex Clink Date: Wed, 17 Nov 2021 22:21:19 -0500 Subject: [PATCH] Fix undying bullets bug --- src/bullet.cr | 3 ++- src/lx_game/sprite/age.cr | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bullet.cr b/src/bullet.cr index 0040d45..eb3233a 100644 --- a/src/bullet.cr +++ b/src/bullet.cr @@ -4,11 +4,12 @@ class Bullet < Sprite include LxGame::SpriteAge def update(dt) + super update_position(dt) end 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_point(@position.x.to_i, @position.y.to_i) end diff --git a/src/lx_game/sprite/age.cr b/src/lx_game/sprite/age.cr index 4e1d0b0..c8ecba7 100644 --- a/src/lx_game/sprite/age.cr +++ b/src/lx_game/sprite/age.cr @@ -1,10 +1,9 @@ module LxGame module SpriteAge - getter age : Float64 = 0.0 + property age : Float64 = 0.0 def update(dt : Float64) - super - @age += dt + self.age += dt end end end