Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ROBOTOO007 |
here’s my code:
extends KinematicBody2D
var speed: = Vector2(300,300)
var direction: = Vector2(0,0)
func _physics_process(delta: float) → void:
direction = get_direction()
var velocity = speed * direction
velocity = move_and_slide(velocity)
var object_colliding = get_node(“RayCast2D”)
if object_colliding != null && object_colliding.is_in_group(“interractable_objects”) && Input.is_action_pressed(“interract”):
print(“cool”)
func get_direction() → Vector2:
return Vector2(Input.get_action_strength(“right”) - Input.get_action_strength(“left”),
Input.get_action_strength(“down”) - Input.get_action_strength(“up”))
i’ve tested all the other parameters of the if statement that prints out cool and the only one that doesn’t work is the one checking if the object is in the group. I’ve also tried printing it out and all i get is false
I don’t know what to do HELPP!!