Some minor cleanup.
This commit is contained in:
@@ -10,21 +10,21 @@ class Projectile:
|
||||
self.damage = 5 # All projectiles do same damage for now
|
||||
self.range = 12 # Maximum travel distance in tiles
|
||||
self.start_x = start_x
|
||||
|
||||
|
||||
def update(self):
|
||||
"""Update projectile position and check if it should still exist"""
|
||||
if not self.isActive:
|
||||
return False
|
||||
|
||||
|
||||
self.x += self.direction * self.speed
|
||||
|
||||
|
||||
# Check if projectile has gone too far
|
||||
if abs(self.x - self.start_x) > self.range:
|
||||
self.isActive = False
|
||||
return False
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def hit_enemy(self, enemy):
|
||||
"""Handle hitting an enemy"""
|
||||
enemy.take_damage(self.damage)
|
||||
|
Reference in New Issue
Block a user