working on items and inventory
This commit is contained in:
25
PickupableObjects/NailGun/NailShot.gd
Normal file
25
PickupableObjects/NailGun/NailShot.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends RigidBody2D
|
||||
|
||||
@export var hit_power:int = 10
|
||||
@export var nail_velocity:int = 200
|
||||
@export var spawn_offset:int = 25
|
||||
@export var cleanup_time:float = 2.0
|
||||
|
||||
@onready var collision_shape = get_node("CollisionShape2D")
|
||||
@onready var facing_vector = Vector2(0, 0)
|
||||
@onready var controlling_player:CharacterBody2D
|
||||
@onready var hit_player:CharacterBody2D = null
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_body_entered(body):
|
||||
if body.is_in_group("moveable"):
|
||||
collision_shape.set_deferred("disabled", true)
|
||||
body.apply_central_impulse(facing_vector)
|
||||
elif body.is_in_group("player"):
|
||||
body.player_hit.is_player_hit = true
|
||||
#body.player_hit.hit_velocity = last_velocity.normalized() * push_strength
|
||||
body.health_changed_func(-1)
|
||||
hit_player = body
|
Reference in New Issue
Block a user