Some safekeeping
This commit is contained in:
		
							parent
							
								
									b65d46b945
								
							
						
					
					
						commit
						02473f4d27
					
				
					 2 changed files with 15 additions and 15 deletions
				
			
		| 
						 | 
					@ -33,19 +33,26 @@ func _update_animations():
 | 
				
			||||||
	_update_condition("just_attacked")
 | 
						_update_condition("just_attacked")
 | 
				
			||||||
	_update_condition("just_respawned")
 | 
						_update_condition("just_respawned")
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	animation_tree["parameters/conditions/standing_still"] = velocity.is_zero_approx()
 | 
						_update_anim_state("parameters/conditions/standing_still", velocity.is_zero_approx())
 | 
				
			||||||
	animation_tree["parameters/conditions/falling"] = velocity.y < 0.0
 | 
						_update_anim_state("parameters/conditions/falling", velocity.y < 0.0)
 | 
				
			||||||
	animation_tree["parameters/conditions/on_floor"] = is_on_floor()
 | 
						_update_anim_state("parameters/conditions/on_floor", is_on_floor())
 | 
				
			||||||
	animation_tree["parameters/conditions/on_wall"] = is_on_wall()
 | 
						_update_anim_state("parameters/conditions/on_wall", is_on_wall())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func _update_anim_state(key: String, value):
 | 
				
			||||||
 | 
						if key in animation_tree:
 | 
				
			||||||
 | 
							animation_tree[key] = value
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func _update_blend(key: String):
 | 
					func _update_blend(key: String):
 | 
				
			||||||
	animation_tree["parameters/" + key + "/blend_position"] = 1.0 if looking_right else 0.0
 | 
						_update_anim_state("parameters/" + key + "/blend_position",
 | 
				
			||||||
 | 
							1.0 if looking_right else 0.0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Reflects animation state to animation tree, clears the state after a while
 | 
					## Reflects animation state to animation tree, clears the state after a while
 | 
				
			||||||
func _update_condition(key: String):
 | 
					func _update_condition(key: String):
 | 
				
			||||||
	animation_tree["parameters/conditions/" + key] = self["_" + key]
 | 
						if self["_" + key]:
 | 
				
			||||||
	# TODO does this really work????
 | 
							self["_" + key] = false
 | 
				
			||||||
	self["_" + key] = false
 | 
							_update_anim_state("parameters/conditions/" + key, true)
 | 
				
			||||||
 | 
							await get_tree().create_timer(0.2).timeout
 | 
				
			||||||
 | 
							_update_anim_state("parameters/conditions/" + key, false)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func current_state():
 | 
					func current_state():
 | 
				
			||||||
	return stm.state
 | 
						return stm.state
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,10 +7,3 @@ layer = 2
 | 
				
			||||||
follow_viewport_enabled = true
 | 
					follow_viewport_enabled = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[node name="Player" parent="." instance=ExtResource("1_whtvo")]
 | 
					[node name="Player" parent="." instance=ExtResource("1_whtvo")]
 | 
				
			||||||
double_jump_enabled = true
 | 
					 | 
				
			||||||
dash_enabled = true
 | 
					 | 
				
			||||||
wavedash_enabled = true
 | 
					 | 
				
			||||||
wallslide_enabled = true
 | 
					 | 
				
			||||||
dashjump_enabled = true
 | 
					 | 
				
			||||||
fade_time = 0.3
 | 
					 | 
				
			||||||
health = 5
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue