Skip to content

Scene enemy code structure

ZachNalepa edited this page Nov 8, 2023 · 2 revisions

Node Structure

Scene Enemy

Variables

  • var speed : int
    • adjustable speed of an enemy instance
  • var enemy_id : int
    • unique id identifying each enemy instance
  • var health : int
    • heath of an individual enemy instance
  • var screen_size : int
    • integer representing the current screen viewport size, used in movement calculations

Methods

  • start(position, int)
    • given a position and an int for the enemy_id, the enemy is instantiated
    • the given id must be unique
  • update_health()
    • updates the healthbar of the enemy based on remaining health
  • _on_enemy_hitbox_body_entered(body)
    • handles collision with player bullets to damage the enemy and reduce health

Clone this wiki locally