asteroid.gd 532 B

123456789101112131415161718192021222324252627282930
  1. extends RigidBody2D
  2. var hp = 1
  3. var stealth = 0
  4. var faction = Factions.NEUTRAL
  5. var icon
  6. func destroyed():
  7. icon.queue_free()
  8. func _disable():
  9. get_node("/root/Main").objects.reamove(self)
  10. destroyed()
  11. func damage(pos,type,dmg,disable,heat):
  12. pass
  13. func get_lv():
  14. return get_linear_velocity()
  15. func _ready():
  16. get_node("/root/Main").objects.push_back(self)
  17. var ii = Sprite.new()
  18. ii.set_texture(load("res://images/icons/icon_asteroid.png"))
  19. ii.set_name(get_name())
  20. HUD.get_node("Map/Map").add_child(ii)
  21. ii.hide()
  22. icon = ii