hand to hand weapon
made a close range weapon that can kill the enemy.
This commit is contained in:
1 parent
7b15d90633
commit
569e225436
6 files changed
+106
-15
No files matched your search
+11
-2
@@ -4,6 +4,7 @@ extends CharacterBody2D
|
||||
var SPEED = Vector2(5, 0)
|
||||
const JUMP_VELOCITY = -400.0
|
||||
@onready var projectile: PackedScene = preload("res://scenes/projectile.tscn")
|
||||
var death_counter = 3
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +16,12 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if death_counter == 2:
|
||||
$ColorRect4.hide()
|
||||
if death_counter == 1:
|
||||
$ColorRect3.hide()
|
||||
if death_counter == 0:
|
||||
queue_free()
|
||||
velocity += get_gravity() * delta
|
||||
move_and_slide()
|
||||
patrol()
|
||||
@@ -30,8 +37,10 @@ func _on_timer_timeout() -> void:
|
||||
|
||||
|
||||
func _on_area_2d_area_entered(area: Area2D) -> void:
|
||||
queue_free()
|
||||
|
||||
if GloblaData.hurtable:
|
||||
death_counter -= 1
|
||||
elif GloblaData.weapon == 2:
|
||||
death_counter -= 1
|
||||
|
||||
func _on_area_2d_body_entered(body: Node2D) -> void:
|
||||
GloblaData.death_counter -= 1
|
||||
Reference in new issue
Block a user