lib/traits/shooter.rb in gosu_extensions-0.1.18 vs lib/traits/shooter.rb in gosu_extensions-0.1.19
- old
+ new
@@ -27,11 +27,10 @@
end
def shooting_range
@shooting_range || @shooting_range = 300
end
-
def shooting_rate
@shooting_rate || @shooting_rate = (SUBSTEPS**2).to_f/2
end
module ClassMethods
@@ -88,10 +87,10 @@
end
def muzzle_rotation_func &rotation
@muzzle_rotation = rotation
end
def shoot? target = nil
- target.nil? ? true : target.distance_from(self) < self.range
+ target.nil? ? true : target.distance_from(self) <= self.shooting_range
end
def shoot target = nil
return unless shoot? target
sometimes :loading, self.shooting_rate do
\ No newline at end of file