Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Noob_Maker | |
Old Version | Published before Godot 3 was released. |
I’m making a mechanic in my game where you can interact with certain objects by left clicking. I have the code without any errors for the object that I want to test it on but the problem is that for some weird reason I cannot actually left click the object.
I think the problem is that I didn’t setup the input for the mouse correctly but it might be something else.
Here’s the code for the object that I’m testing the interaction feature:
extends RigidBody2D
var pos = Vector2()
var offset = Vector2()
var Click = Input.is_action_pressed("Interaction")
func _ready():
set_gravity_scale(3)
func _fixed_process(delta):
Click = Input.is_action_pressed("Interaction")
if Click == true:
set_global_pos(pos + offset)