I've been trying to make collisions work for roughly 2 hours now and still haven't found a solution. (no errors)
extends CharacterBody2D
@export var speed = 100
@export var accel = 10
@onready var coll = $Area2D
@onready var itemC = load("res://scripts/Item.gd")
func _physics_process(_delta) -> void:
if Input.is_action_pressed("menu"):
get_tree().quit()
var direction: Vector2 = Input.get_vector("left", "right", "up", "down")
velocity.x = move_toward(velocity.x, speed * direction.x, accel)
velocity.y = move_toward(velocity.y, speed * direction.y, accel)
move_and_slide()
look_at(get_global_mouse_position())
func _on_ready():
coll.monitoring = true
coll.connect("area_shape_entered", hit)
func hit(body):
print("AAA")
if body.is_in_group("Item"):
print("item")