Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | XDman06 |
I am trying to get a Area2D to send a signal to a KinematicBody2D to move.
Here is the Area2D code:
extends Area2D
signal hit
func _ready():
pass
func _on_Area2D_area_shape_entered(area_id, area, area_shape, self_shape):
emit_signal("hit")
And here is the KinematicBodys code:
extends KinematicBody2D
var motion = Vector2(0, 0)
func _ready():
pass
func _on_Area2D_hit():
motion.y = -500
move_and_slide(motion)
This is my first time, so sorry if I sound like an idiot.
Are you connecting the player to the signal?
(source_node).connect((signal_name), (target_node), (target_function_name))
tastyshrimp | 2019-12-12 20:52