Compare commits
No commits in common. "5196b3eb6e4fa086fb791f7cb677f0aeb17e728f" and "49e2030c06281d4ecdffcaa9a2e92286dfd13dad" have entirely different histories.
5196b3eb6e
...
49e2030c06
|
|
@ -30,7 +30,6 @@ var velocity_controller :VelocityController = VelocityController.new()
|
||||||
#var sim_velocity = Vector2(0,0)
|
#var sim_velocity = Vector2(0,0)
|
||||||
var physics_delta:float
|
var physics_delta:float
|
||||||
var process_delta:float
|
var process_delta:float
|
||||||
var state_duration:float = 0.0 ## Tracks how long we've been in state
|
|
||||||
|
|
||||||
var modifier: StateModifierMovement
|
var modifier: StateModifierMovement
|
||||||
|
|
||||||
|
|
@ -134,8 +133,6 @@ func get_climb_shape_location() -> Vector2:
|
||||||
return Vector2(-1,-1)
|
return Vector2(-1,-1)
|
||||||
|
|
||||||
func _on_state_change(old_state_name:String, new_state :State):
|
func _on_state_change(old_state_name:String, new_state :State):
|
||||||
## Reset State Duration Counter
|
|
||||||
state_duration = 0.0
|
|
||||||
###### State machine
|
###### State machine
|
||||||
if new_state is StateAnimatedActor: #Testing this. Update: It works
|
if new_state is StateAnimatedActor: #Testing this. Update: It works
|
||||||
## Confirmed that I do neet to update the current_state with the passed state.
|
## Confirmed that I do neet to update the current_state with the passed state.
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@ var player_number: int = 1
|
||||||
|
|
||||||
onready var pew_machine = $"%PewMachine"
|
onready var pew_machine = $"%PewMachine"
|
||||||
onready var stamina_component = $"%Stamina_Component"
|
onready var stamina_component = $"%Stamina_Component"
|
||||||
onready var ladder_detector = $"%LadderDetector"
|
|
||||||
|
|
||||||
|
|
||||||
var state_stamina_cost :Dictionary
|
var state_stamina_cost :Dictionary
|
||||||
|
|
||||||
|
|
@ -60,10 +58,8 @@ var _wants_crouch :bool
|
||||||
func wants_crouch() -> bool:
|
func wants_crouch() -> bool:
|
||||||
if Input.is_action_pressed("crouch_" + str(player_number)):
|
if Input.is_action_pressed("crouch_" + str(player_number)):
|
||||||
_wants_crouch = true
|
_wants_crouch = true
|
||||||
ladder_detector.position.y = 2
|
|
||||||
return true
|
return true
|
||||||
else:
|
else:
|
||||||
ladder_detector.position.y = 0
|
|
||||||
_wants_crouch = false
|
_wants_crouch = false
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
@ -337,11 +333,6 @@ func _state_process_physics_fall():
|
||||||
var foo = $"%LedgeDetector".is_colliding()
|
var foo = $"%LedgeDetector".is_colliding()
|
||||||
var bar = $"%WallDetector".is_colliding()
|
var bar = $"%WallDetector".is_colliding()
|
||||||
|
|
||||||
#parent.get_node("CollisionShape2D").set_deferred("disabled", false)
|
|
||||||
state_duration += physics_delta
|
|
||||||
if (state_duration > .25):
|
|
||||||
parent.set_collision_mask_bit(9,true)
|
|
||||||
|
|
||||||
if $"%LedgeDetector".is_colliding() and !$"%WallDetector".is_colliding():
|
if $"%LedgeDetector".is_colliding() and !$"%WallDetector".is_colliding():
|
||||||
#print("it touched me!")
|
#print("it touched me!")
|
||||||
if debug_component:
|
if debug_component:
|
||||||
|
|
@ -451,6 +442,8 @@ func get_climb_shape_location() -> Vector2:
|
||||||
|
|
||||||
|
|
||||||
func _state_process_physics_climb():
|
func _state_process_physics_climb():
|
||||||
|
#$"../LadderDetector".set_enabled(false)
|
||||||
|
|
||||||
var ladder_location = get_climb_shape_location()
|
var ladder_location = get_climb_shape_location()
|
||||||
if ladder_location != Vector2(-1,-1):
|
if ladder_location != Vector2(-1,-1):
|
||||||
#UiManager.debug_text = str(ladder_location) + '\n' + str(ladder_location - parent.global_position) #+ '\n' + str(parent.global_position.distance_to(ladder_location))
|
#UiManager.debug_text = str(ladder_location) + '\n' + str(ladder_location - parent.global_position) #+ '\n' + str(parent.global_position.distance_to(ladder_location))
|
||||||
|
|
@ -470,7 +463,7 @@ func _state_process_physics_climb():
|
||||||
return request_state_change.call_func('idle')
|
return request_state_change.call_func('idle')
|
||||||
|
|
||||||
|
|
||||||
if _wants_jump:
|
if _wants_crouch:
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -532,12 +525,6 @@ func _state_process_physics_crouch():
|
||||||
request_state_change.call_func('idle')
|
request_state_change.call_func('idle')
|
||||||
return
|
return
|
||||||
|
|
||||||
if _wants_jump == true:
|
|
||||||
##TODO: Done to drop through one-way floors
|
|
||||||
#parent.get_node("CollisionShape2D").set_deferred("disabled", true)
|
|
||||||
parent.set_collision_mask_bit(9,false)
|
|
||||||
return
|
|
||||||
|
|
||||||
if !parent.is_on_floor():
|
if !parent.is_on_floor():
|
||||||
request_state_change.call_func('fall')
|
request_state_change.call_func('fall')
|
||||||
return
|
return
|
||||||
|
|
@ -549,10 +536,6 @@ func _state_process_physics_crouch():
|
||||||
request_state_change.call_func('move')
|
request_state_change.call_func('move')
|
||||||
return
|
return
|
||||||
|
|
||||||
if $"%LadderDetector".is_colliding():
|
|
||||||
request_state_change.call_func('climb')
|
|
||||||
return
|
|
||||||
|
|
||||||
apply_movement_to_parent(
|
apply_movement_to_parent(
|
||||||
velocity_controller.calculate_velocity(
|
velocity_controller.calculate_velocity(
|
||||||
physics_delta ,
|
physics_delta ,
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ min_acceleration = Vector2( 0, 0 )
|
||||||
acceleration = Vector2( 0, 280 )
|
acceleration = Vector2( 0, 280 )
|
||||||
max_acceleration = Vector2( 0, 0 )
|
max_acceleration = Vector2( 0, 0 )
|
||||||
jerk_factor = Vector2( 1, 1 )
|
jerk_factor = Vector2( 1, 1 )
|
||||||
horizontal_speed = 50.0
|
horizontal_speed = 20.0
|
||||||
horizontal_acceleration = 0.0
|
horizontal_acceleration = 0.0
|
||||||
horizontal_speed_offset = 0.0
|
horizontal_speed_offset = 0.0
|
||||||
horizontal_speed_offset_acceleration = 0.0
|
horizontal_speed_offset_acceleration = 0.0
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
[sub_resource type="RectangleShape2D" id=2]
|
[sub_resource type="RectangleShape2D" id=2]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=3]
|
[sub_resource type="RectangleShape2D" id=3]
|
||||||
extents = Vector2( 8, 40 )
|
extents = Vector2( 8, 48 )
|
||||||
|
|
||||||
[node name="TC_05" groups=["world"] instance=ExtResource( 1 )]
|
[node name="TC_05" groups=["world"] instance=ExtResource( 1 )]
|
||||||
|
|
||||||
|
|
@ -92,9 +92,9 @@ collision_layer = 1024
|
||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Ladders" index="0"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Ladders" index="0"]
|
||||||
position = Vector2( 136, 88 )
|
position = Vector2( 136, 96 )
|
||||||
shape = SubResource( 3 )
|
shape = SubResource( 3 )
|
||||||
|
|
||||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Ladders" index="1"]
|
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Ladders" index="1"]
|
||||||
position = Vector2( 200, 88 )
|
position = Vector2( 200, 96 )
|
||||||
shape = SubResource( 3 )
|
shape = SubResource( 3 )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user