Fixed enemy movement
This commit is contained in:
1 parent
84d09120b2
commit
e325412c84
6 files changed
+63
-25
No files matched your search
@@ -25,7 +25,7 @@ var current_level = 0
|
||||
# Save/load
|
||||
var stash_data : Dictionary = {}
|
||||
# Timers
|
||||
var timers = [10, 15, 20]
|
||||
var timers = [30, 30, 30]
|
||||
var time_available : int = 0
|
||||
var timer = Timer.new()
|
||||
# Characters
|
||||
|
||||
+11
-10
@@ -1,25 +1,26 @@
|
||||
class_name Slimer
|
||||
extends Area2D
|
||||
|
||||
signal player_slimed(body, slime)
|
||||
|
||||
@export var speed : int = 50
|
||||
|
||||
var direction : int = 1
|
||||
|
||||
@onready var right_cast: RayCast2D = $RightCast
|
||||
@onready var left_cast: RayCast2D = $LeftCast
|
||||
@onready var right_down_cast: RayCast2D = $RightDownCast
|
||||
@onready var left_down_cast: RayCast2D = $LeftDownCast
|
||||
@onready var slime_sprite: AnimatedSprite2D = $SlimeSprite
|
||||
|
||||
var speed : int = 25
|
||||
var direction : int = 1
|
||||
|
||||
signal player_slimed(body, slime)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if not right_down_cast.is_colliding():
|
||||
if not right_down_cast.is_colliding() or right_cast.is_colliding():
|
||||
direction = -1
|
||||
slime_sprite.flip_h = true
|
||||
#if not left_down_cast.is_colliding():
|
||||
#direction = 1
|
||||
#slime_sprite.flip_h = false
|
||||
#if not right_cast.is_colliding():
|
||||
elif not left_down_cast.is_colliding() or left_cast.is_colliding():
|
||||
direction = 1
|
||||
slime_sprite.flip_h = false
|
||||
|
||||
#direction = -1
|
||||
#slime_sprite.flip_h = true
|
||||
#if not left_cast.is_colliding():
|
||||
|
||||
Reference in new issue
Block a user