Enemy
made a basic enemy that can harm/kill the player.
This commit is contained in:
1 parent
2315add8ec
commit
bb9682cd16
6 files changed
+117
-4
No files matched your search
@@ -138,7 +138,7 @@ var gravityActive: bool = true
|
||||
var dashing: bool = false
|
||||
var dashCount: int
|
||||
var rolling: bool = false
|
||||
|
||||
var death_counter = 3
|
||||
var twoWayDashHorizontal
|
||||
var twoWayDashVertical
|
||||
var eightWayDash
|
||||
@@ -254,6 +254,8 @@ func _updateData():
|
||||
func _process(_delta):
|
||||
#INFO animations
|
||||
#directions
|
||||
if death_counter == 0:
|
||||
get_tree().quit()
|
||||
if is_on_wall() and !is_on_floor() and latch and wallLatching and ((wallLatchingModifer and latchHold) or !wallLatchingModifer):
|
||||
latched = true
|
||||
else:
|
||||
@@ -325,6 +327,10 @@ func _process(_delta):
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
if death_counter == 2:
|
||||
$health/ColorRect3.hide()
|
||||
elif death_counter == 1:
|
||||
$health/ColorRect2.hide()
|
||||
if !dset:
|
||||
gdelta = delta
|
||||
dset = true
|
||||
@@ -674,3 +680,7 @@ func _endGroundPound():
|
||||
|
||||
func _placeHolder():
|
||||
print("")
|
||||
|
||||
|
||||
func _on_area_2d_body_entered(body: Node2D) -> void:
|
||||
death_counter -= 1
|
||||
@@ -0,0 +1,26 @@
|
||||
extends CharacterBody2D
|
||||
|
||||
|
||||
var SPEED = Vector2(5, 0)
|
||||
const JUMP_VELOCITY = -400.0
|
||||
|
||||
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$Timer.start()
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
velocity += get_gravity() * delta
|
||||
move_and_slide()
|
||||
patrol()
|
||||
|
||||
|
||||
func patrol():
|
||||
position += SPEED
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
SPEED = -SPEED
|
||||
$Timer.start()
|
||||
@@ -0,0 +1 @@
|
||||
uid://2jmspsmp5wpm
|
||||
Reference in new issue
Block a user