working on items and inventory
This commit is contained in:
		@@ -6,7 +6,6 @@ extends RigidBody2D
 | 
			
		||||
@export var push_strength:int = 20
 | 
			
		||||
	
 | 
			
		||||
@onready var last_velocity:Vector2 = Vector2(0,0)
 | 
			
		||||
@onready var current_player:CharacterBody2D = null
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
func _physics_process(delta):
 | 
			
		||||
@@ -23,10 +22,9 @@ func _physics_process(delta):
 | 
			
		||||
func _on_body_entered(body):
 | 
			
		||||
	if body.is_in_group("player"):
 | 
			
		||||
		if last_velocity.length() > damage_speed:
 | 
			
		||||
			current_player = body
 | 
			
		||||
			current_player.player_hit.is_player_hit = true
 | 
			
		||||
			current_player.player_hit.hit_velocity = last_velocity.normalized() * push_strength
 | 
			
		||||
			current_player.health_changed_func(-1)
 | 
			
		||||
			body.player_hit.is_player_hit = true
 | 
			
		||||
			body.player_hit.hit_velocity = last_velocity.normalized() * push_strength
 | 
			
		||||
			body.health_changed_func(-1)
 | 
			
		||||
#			set_freeze_enabled(true)
 | 
			
		||||
#			await get_tree().create_timer(0.5).timeout
 | 
			
		||||
			set_sleeping(true)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user