Add Komodo enemy class and enhance enemy spawning logic
- Introduce Komodo class with high health and attack mechanics. - Modify Enemy class to accept type parameter during initialization. - Update EnemyAI to set speed based on enemy type. - Implement random spawning of enemies in boss rooms. - Adjust health bar calculations to use max health.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
require_relative 'base'
|
||||
|
||||
class Komodo < Enemy
|
||||
load 'assets/images/komodo.png', 31, 48, 1.7
|
||||
|
||||
def initialize(x, y)
|
||||
super(x, y, :komodo, 1000)
|
||||
|
||||
$bus.on(:attack) do |attack_x, attack_y, range, damage|
|
||||
if Math.hypot(@x - attack_x, @y - attack_y) <= range
|
||||
take_damage(damage)
|
||||
next true
|
||||
end
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user