0 votes

So, i have this problem. I'm trying to make a StaticBody2D to detect a collision, and when it does so i want to play an animation, that's it. But it gives me this error (Invalid call. Nonexistent function 'is_colliding' in base 'CollisionShape2D')
Please help!!!

My code is the following :
extends StaticBody2D

func physicsprocess(delta):
if $CollisionShape2D.is_colliding():
$AnimationPlayer.play("Shit")
else:
$AnimationPlayer.play("Walk")

Godot version Godot 3.4.2-stable
in Engine by (12 points)

1 Answer

0 votes

$CollisionShape2D.is_colliding():
It has no such feature.

use StaticBody2D = for wall or floor or etc...

please see this
https://godottutorials.pro/how-to-make-games-godot/

by (650 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.