Vore_Sandbox_Remaster/scripts/pusher.gd

34 lines
828 B
GDScript

extends Area2D
class_name Pusher
enum asssasss {fsefse,fesfrhfythg,ddss}
export var force = Vector2.ZERO
export var on_floor:bool = false
export(String) var on_key:String = ""
var touching = []
# Called when the node enters the scene tree for the first time.
func _ready():
connect("body_entered",self,"_body_entered")
connect("body_exited",self,"_body_exited")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
for i in touching:
if i is Prey:
if (not on_floor or i.is_on_floor()) and (on_key.empty() or Input.is_action_pressed(on_key)) :
i.velocity += force
i.walk = 0
i.launched = true
func _body_entered(body):
#print_debug("enter ",body)
touching.append(body)
func _body_exited(body):
#print_debug("exit ", body)
touching.erase(body)