Updated cultist jump state

This commit is contained in:
2026-02-13 01:21:11 +03:00
parent ebc0133a82
commit aa7b392edc
4 changed files with 8 additions and 22 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ extends CharacterBody2D
const MAX_WALK_SPEED = 85
const MAX_CHASE_SPEED = 170
const ACCELERATION = 600.0
const JUMP_VELOCITY = 333.0
const JUMP_VELOCITY = 222.0
const JUMP_GRAVITY_FACTOR = 1.0
const FALL_GRAVITY_FACTOR = 1.5
@@ -143,12 +143,12 @@ jump_state = NodePath("../JumpRightState")
fall_state = NodePath("../FallState")
cultist = NodePath("../..")
[node name="JumpLeftState" parent="CultistStateMachine" unique_id=739226464 node_paths=PackedStringArray("fall_state", "cultist") instance=ExtResource("5_tu2pi")]
[node name="JumpLeftState" parent="CultistStateMachine" unique_id=739226464 node_paths=PackedStringArray("chase_state", "cultist") instance=ExtResource("5_tu2pi")]
script = ExtResource("14_42ivi")
fall_state = NodePath("../FallLeftState")
chase_state = NodePath("../ChaseLeftState")
cultist = NodePath("../..")
[node name="JumpRightState" parent="CultistStateMachine" unique_id=756126836 node_paths=PackedStringArray("fall_state", "cultist") instance=ExtResource("5_tu2pi")]
[node name="JumpRightState" parent="CultistStateMachine" unique_id=756126836 node_paths=PackedStringArray("chase_state", "cultist") instance=ExtResource("5_tu2pi")]
script = ExtResource("15_cqp7f")
fall_state = NodePath("../FallRightState")
chase_state = NodePath("../ChaseRightState")
cultist = NodePath("../..")
@@ -3,7 +3,7 @@ class_name CultistJumpState
extends CultistState
@export var fall_state: CultistState
@export var chase_state: CultistState
var _direction := 0
@@ -14,8 +14,8 @@ func enter() -> void:
func physics_process(delta: float) -> void:
if cultist.velocity.y > 0:
switch_state.emit(fall_state)
if cultist.is_on_floor():
switch_state.emit(chase_state)
else:
cultist.velocity += cultist.get_gravity() * cultist.get_gravity_factor() * delta
cultist.update_x_velocity(_direction, cultist.MAX_WALK_SPEED, delta)