diff --git a/src/NPCs/bigooze.gd b/src/NPCs/bigooze.gd index dca1fbe..70a8275 100644 --- a/src/NPCs/bigooze.gd +++ b/src/NPCs/bigooze.gd @@ -10,12 +10,17 @@ const MOVEMENT_VECTORS = [ Vector2.LEFT ] +var directioncount = 0 +var direction = Vector2.ZERO + func _physics_process(_delta): if position != null: if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0: queue_free() - var movement = MOVEMENT_VECTORS[randi() % 4] - move_and_collide(movement * 2) + if directioncount == 0: + direction = MOVEMENT_VECTORS[randi() % 4] + directioncount = (directioncount + 1) % 5 + move_and_collide(direction * 2) func _on_Hurtbox_area_entered(_area): $Hurtbox/death.play() diff --git a/src/NPCs/femalegoblin.gd b/src/NPCs/femalegoblin.gd index 3d9a274..765c766 100644 --- a/src/NPCs/femalegoblin.gd +++ b/src/NPCs/femalegoblin.gd @@ -14,6 +14,9 @@ const MOVEMENT_VECTORS = [ Vector2.LEFT ] +var directioncount = 0 +var direction = Vector2.ZERO + func _physics_process(_delta): if crowd > 0: crowd -= 1 @@ -39,8 +42,10 @@ func _physics_process(_delta): rootnode.add_child(malechild) if pregnancy > 0: pregnancy = pregnancy + 1 - var movement = MOVEMENT_VECTORS[randi() % 4] - move_and_collide(movement * 2) + if directioncount == 0: + direction = MOVEMENT_VECTORS[randi() % 4] + directioncount = (directioncount + 1) % 5 + move_and_collide(direction * 2) func _on_Hurtbox_area_entered(_area): $Hurtbox/death.play() diff --git a/src/NPCs/malegoblin.gd b/src/NPCs/malegoblin.gd index c607340..8e3ecc4 100644 --- a/src/NPCs/malegoblin.gd +++ b/src/NPCs/malegoblin.gd @@ -11,6 +11,9 @@ const MOVEMENT_VECTORS = [ Vector2.LEFT ] +var directioncount = 0 +var direction = Vector2.ZERO + func _physics_process(_delta): if position != null: if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0: @@ -21,9 +24,11 @@ func _physics_process(_delta): queue_free() else: age = age + 1 - - var movement = MOVEMENT_VECTORS[randi() % 4] - move_and_collide(movement * 2) + + if directioncount == 0: + direction = MOVEMENT_VECTORS[randi() % 4] + directioncount = (directioncount + 1) % 5 + move_and_collide(direction * 2) func _on_Hurtbox_area_entered(_area): $Hurtbox/death.play() diff --git a/src/NPCs/ooze.gd b/src/NPCs/ooze.gd index bb3b1bc..526ebbe 100644 --- a/src/NPCs/ooze.gd +++ b/src/NPCs/ooze.gd @@ -11,14 +11,19 @@ const MOVEMENT_VECTORS = [ Vector2.LEFT ] +var directioncount = 0 +var direction = Vector2.ZERO + func _physics_process(_delta): if position != null: if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0: queue_free() if immunity > 0: immunity = immunity - 1 - var movement = MOVEMENT_VECTORS[randi() % 4] - move_and_collide(movement * 2) + if directioncount == 0: + direction = MOVEMENT_VECTORS[randi() % 4] + directioncount = (directioncount + 1) % 5 + move_and_collide(direction * 2) func _on_Hurtbox_area_entered(_area): if immunity == 0: diff --git a/src/NPCs/smallooze.gd b/src/NPCs/smallooze.gd index 406c5ef..b3ec275 100644 --- a/src/NPCs/smallooze.gd +++ b/src/NPCs/smallooze.gd @@ -10,15 +10,20 @@ const MOVEMENT_VECTORS = [ Vector2.DOWN, Vector2.LEFT ] - + +var directioncount = 0 +var direction = Vector2.ZERO + func _physics_process(_delta): if position != null: if tilesmap.get_cellv(tilesmap.world_to_map(position)) != 0: queue_free() if immunity > 0: immunity = immunity - 1 - var movement = MOVEMENT_VECTORS[randi() % 4] - move_and_collide(movement * 2) + if directioncount == 0: + direction = MOVEMENT_VECTORS[randi() % 4] + directioncount = (directioncount + 1) % 5 + move_and_collide(direction * 2) func _on_Hurtbox_area_entered(_area): if immunity == 0: