I’m struggling getting my score counter to go up only when pressed on the sprite that has collision over it not just anywhere on the screen.
If your sprite has a CollisionObject2D
, like Area2D
, CharacterBody2D
, RigidBody2D
or StaticBody2D
, you can override its _input_event()
method and put your score counter logic there.
Note: _input_event()
requires input_pickable
to be true and at least one collision_layer
bit to be set.