Area2D in overworld not triggered
I'm recently building an overworld for my game, it has a kinematic2D "pointer" that is used to enter levels a la Final Fantasy, the levels themselves are nodes containing an Area2D that, when the Kinematic 2D enters it, its supposed to emit a message to test collision, the problem is, it doesn't. I tried changing the Node2D for a pure Area2D node but it doesn't work either, it's gotta be a simple solution, but so far i haven't found it, which is why i'm asking for some help, if you have a better approach for an overworld i'm all ears as well.
Here's my "Level node" configuration: -Node2D(Level ---Sprite ---Area2D(CollisionArea) -------CollisionShape2D(CollisionHitbox)
Here's the code:
extends Node2D #I tried extending Area2D as well, doesn't work var nodetype = "Level" func _ready(): $CollisionArea.connect("area_entered", self, "_on_area_entered") $CollisionArea.connect("body_entered", self, "_on_body_entered") func _on_body_entered(body): print("Working") func _on_area_entered(area): print("Working")
Here's the Player pointer configuration:
And here's it's code as well:
extends KinematicBody2D var nodetype = "Player" var velocity = Vector2(0,0) var speed = 30 func get_input(delta): var right = Input.is_action_pressed('ui_right') var left = Input.is_action_pressed('ui_left') var up = Input.is_action_pressed('ui_up') var down = Input.is_action_pressed('ui_down') var accept = Input.is_action_just_pressed('ui_accept') if up: velocity.y = -speed if down: velocity.y = speed if left: velocity.x = -speed if right: velocity.x = speed if !up and !down: velocity.y = 0 if !left and !right: velocity.x = 0 func _physics_process(delta): get_input(delta) velocity = move_and_slide(velocity,Vector2(0, -1))