they are autistic

This commit is contained in:
Haze Weathers 2023-05-10 18:55:04 -04:00
parent 3ba9afd2be
commit 65e1d2f015
2 changed files with 181 additions and 8 deletions

View file

@ -24,7 +24,8 @@ export var jump_force: float = 150.0
export var jump_release_force: float = 0.25 export var jump_release_force: float = 0.25
## impulse added when double jumping ## impulse added when double jumping
export var double_jump_force: float = 122.0 export var double_jump_force: float = 122.0
## blinking time
export var blinking_time: float = 10.0
# velocity # velocity
var velocity: Vector2 = Vector2.ZERO var velocity: Vector2 = Vector2.ZERO
@ -112,6 +113,21 @@ func _on_Grounded_state_entered() -> void:
snap.y = 2.5 # snap when in grounded state snap.y = 2.5 # snap when in grounded state
velocity.y = 1.0 velocity.y = 1.0
func _on_Still_state_entered() -> void:
animation_player.play("idle")
func _on_Walking_state_entered() -> void:
animation_player.play("walk")
func _on_Blinking_state_entered() -> void:
if $"%Blinking".active:
animation_player.play("blink")
var blink_timer = get_tree().create_timer(rand_range(0.2, 1.0), false)
blink_timer.connect("timeout", self,"_on_Blinking_state_entered")
func _on_Stimming_state_entered() -> void:
animation_player.play("stim")
func _on_Pushing_state_entered() -> void: func _on_Pushing_state_entered() -> void:
animation_player.play("push") animation_player.play("push")
@ -216,9 +232,9 @@ func _process_horizontal_movement(delta: float) -> void:
## walk/idle state ## walk/idle state
func _process_can_walk(delta: float) -> void: func _process_can_walk(delta: float) -> void:
if sign(Input.get_axis("ui_left", "ui_right")) != 0.0: if sign(Input.get_axis("ui_left", "ui_right")) != 0.0:
animation_player.play("walk") state_chart.send_event("walk_start")
else: else:
animation_player.play("idle") state_chart.send_event("walk_stop")
## rubbing up against a wall or pushing an object ## rubbing up against a wall or pushing an object
func _process_pushing(delta: float) -> void: func _process_pushing(delta: float) -> void:

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=39 format=2] [gd_scene load_steps=43 format=2]
[ext_resource path="res://objects/player/player_scholar.gd" type="Script" id=1] [ext_resource path="res://objects/player/player_scholar.gd" type="Script" id=1]
[ext_resource path="res://graphics/player/pal_purplearmor.png" type="Texture" id=2] [ext_resource path="res://graphics/player/pal_purplearmor.png" type="Texture" id=2]
@ -21,6 +21,8 @@
[ext_resource path="res://graphics/player/sg_fall_scared.png" type="Texture" id=19] [ext_resource path="res://graphics/player/sg_fall_scared.png" type="Texture" id=19]
[ext_resource path="res://graphics/player/sg_fall.png" type="Texture" id=20] [ext_resource path="res://graphics/player/sg_fall.png" type="Texture" id=20]
[ext_resource path="res://graphics/player/sg_push.png" type="Texture" id=21] [ext_resource path="res://graphics/player/sg_push.png" type="Texture" id=21]
[ext_resource path="res://graphics/player/sg_blink.png" type="Texture" id=22]
[ext_resource path="res://graphics/player/sg_stim.png" type="Texture" id=23]
[sub_resource type="ShaderMaterial" id=1] [sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 3 ) shader = ExtResource( 3 )
@ -91,6 +93,58 @@ tracks/3/keys = {
"values": [ 0.0 ] "values": [ 0.0 ]
} }
[sub_resource type="Animation" id=18]
resource_name = "blink"
length = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath("Graphics/Sprite:texture")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 22 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Graphics/Sprite:hframes")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 2 ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Graphics/Sprite:frame")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ 1, 0 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Graphics/Sprite:rotation_degrees")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
[sub_resource type="Animation" id=9] [sub_resource type="Animation" id=9]
resource_name = "climb" resource_name = "climb"
length = 0.3 length = 0.3
@ -594,6 +648,60 @@ tracks/5/keys = {
} ] } ]
} }
[sub_resource type="Animation" id=19]
resource_name = "stim"
length = 0.3
loop = true
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Graphics/Sprite:texture")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 23 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Graphics/Sprite:hframes")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 2 ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Graphics/Sprite:frame")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.15 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ 0, 1 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Graphics/Sprite:rotation_degrees")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
[sub_resource type="Animation" id=7] [sub_resource type="Animation" id=7]
resource_name = "walk" resource_name = "walk"
length = 0.4 length = 0.4
@ -739,6 +847,7 @@ collide_with_bodies = false
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/RESET = SubResource( 5 ) anims/RESET = SubResource( 5 )
anims/blink = SubResource( 18 )
anims/climb = SubResource( 9 ) anims/climb = SubResource( 9 )
anims/double_jump = SubResource( 12 ) anims/double_jump = SubResource( 12 )
anims/fall = SubResource( 15 ) anims/fall = SubResource( 15 )
@ -748,6 +857,7 @@ anims/jump = SubResource( 8 )
anims/push = SubResource( 17 ) anims/push = SubResource( 17 )
anims/shoot_airborne = SubResource( 11 ) anims/shoot_airborne = SubResource( 11 )
anims/shoot_grounded = SubResource( 10 ) anims/shoot_grounded = SubResource( 10 )
anims/stim = SubResource( 19 )
anims/walk = SubResource( 7 ) anims/walk = SubResource( 7 )
[node name="StateChart" type="Node" parent="."] [node name="StateChart" type="Node" parent="."]
@ -799,10 +909,11 @@ to = NodePath("../../Climbing")
event = "ladder_touched" event = "ladder_touched"
[node name="CanWalk" type="Node" parent="StateChart/Root/Movement/Grounded"] [node name="CanWalk" type="Node" parent="StateChart/Root/Movement/Grounded"]
script = ExtResource( 11 ) script = ExtResource( 9 )
__meta__ = { __meta__ = {
"_editor_description_": "can walk by moving left and right" "_editor_description_": "can walk by moving left and right"
} }
initial_state = NodePath("Still")
[node name="On Shoot" type="Node" parent="StateChart/Root/Movement/Grounded/CanWalk"] [node name="On Shoot" type="Node" parent="StateChart/Root/Movement/Grounded/CanWalk"]
script = ExtResource( 10 ) script = ExtResource( 10 )
@ -815,6 +926,49 @@ script = ExtResource( 10 )
to = NodePath("../../Pushing") to = NodePath("../../Pushing")
event = "push_start" event = "push_start"
[node name="Still" type="Node" parent="StateChart/Root/Movement/Grounded/CanWalk"]
script = ExtResource( 11 )
[node name="On WalkStart" type="Node" parent="StateChart/Root/Movement/Grounded/CanWalk/Still"]
script = ExtResource( 10 )
to = NodePath("../../Walking")
event = "walk_start"
[node name="On Timeout" type="Node" parent="StateChart/Root/Movement/Grounded/CanWalk/Still"]
script = ExtResource( 10 )
to = NodePath("../../Blinking")
delay = 10.0
[node name="Walking" type="Node" parent="StateChart/Root/Movement/Grounded/CanWalk"]
script = ExtResource( 11 )
[node name="On WalkStop" type="Node" parent="StateChart/Root/Movement/Grounded/CanWalk/Walking"]
script = ExtResource( 10 )
to = NodePath("../../Still")
event = "walk_stop"
[node name="Blinking" type="Node" parent="StateChart/Root/Movement/Grounded/CanWalk"]
unique_name_in_owner = true
script = ExtResource( 11 )
[node name="On Timeout" type="Node" parent="StateChart/Root/Movement/Grounded/CanWalk/Blinking"]
script = ExtResource( 10 )
to = NodePath("../../Stimming")
delay = 10.0
[node name="On WalkStart" type="Node" parent="StateChart/Root/Movement/Grounded/CanWalk/Blinking"]
script = ExtResource( 10 )
to = NodePath("../../Walking")
event = "walk_start"
[node name="Stimming" type="Node" parent="StateChart/Root/Movement/Grounded/CanWalk"]
script = ExtResource( 11 )
[node name="On WalkStart" type="Node" parent="StateChart/Root/Movement/Grounded/CanWalk/Stimming"]
script = ExtResource( 10 )
to = NodePath("../../Walking")
event = "walk_start"
[node name="Shooting" type="Node" parent="StateChart/Root/Movement/Grounded"] [node name="Shooting" type="Node" parent="StateChart/Root/Movement/Grounded"]
script = ExtResource( 11 ) script = ExtResource( 11 )
consumed_events = [ "jump" ] consumed_events = [ "jump" ]
@ -989,7 +1143,6 @@ guard_expression = "can_respawn"
layer = 128 layer = 128
[node name="StateChartDebug" type="Tree" parent="StateDebugLayer"] [node name="StateChartDebug" type="Tree" parent="StateDebugLayer"]
visible = false
anchor_left = 1.0 anchor_left = 1.0
anchor_right = 1.0 anchor_right = 1.0
margin_left = -147.0 margin_left = -147.0
@ -1002,15 +1155,19 @@ script = ExtResource( 8 )
[connection signal="state_physics_processing" from="StateChart/Root/Movement" to="." method="_process_movement"] [connection signal="state_physics_processing" from="StateChart/Root/Movement" to="." method="_process_movement"]
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded" to="." method="_on_Grounded_state_entered"] [connection signal="state_entered" from="StateChart/Root/Movement/Grounded" to="." method="_on_Grounded_state_entered"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded" to="." method="_process_grounded"] [connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded" to="." method="_process_grounded"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_horizontal_movement"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_can_walk"] [connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_can_walk"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/CanWalk" to="." method="_process_horizontal_movement"]
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Still" to="." method="_on_Still_state_entered"]
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Walking" to="." method="_on_Walking_state_entered"]
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Blinking" to="." method="_on_Blinking_state_entered"]
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/CanWalk/Stimming" to="." method="_on_Stimming_state_entered"]
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/Shooting" to="." method="_on_Shooting_state_entered"] [connection signal="state_entered" from="StateChart/Root/Movement/Grounded/Shooting" to="." method="_on_Shooting_state_entered"]
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded/Pushing" to="." method="_on_Pushing_state_entered"] [connection signal="state_entered" from="StateChart/Root/Movement/Grounded/Pushing" to="." method="_on_Pushing_state_entered"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/Pushing" to="." method="_process_pushing"] [connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/Pushing" to="." method="_process_pushing"]
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne" to="." method="_on_Airborne_state_entered"] [connection signal="state_entered" from="StateChart/Root/Movement/Airborne" to="." method="_on_Airborne_state_entered"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne" to="." method="_process_gravity"] [connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne" to="." method="_process_gravity"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_jump"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_horizontal_movement"] [connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_horizontal_movement"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_jump"]
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Jump/NormalJump" to="." method="_on_NormalJump_state_entered"] [connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Jump/NormalJump" to="." method="_on_NormalJump_state_entered"]
[connection signal="state_exited" from="StateChart/Root/Movement/Airborne/Jump/NormalJump" to="." method="_on_NormalJump_state_exited"] [connection signal="state_exited" from="StateChart/Root/Movement/Airborne/Jump/NormalJump" to="." method="_on_NormalJump_state_exited"]
[connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Jump/LadderJump" to="." method="_on_LadderJump_state_entered"] [connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Jump/LadderJump" to="." method="_on_LadderJump_state_entered"]