is_colliding() problem

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nick888

I dont know really what happen with GoDot3.1. When i search the method " is_colliding()" in Search Help the method is there but in the code i take this error:

Method :“is_colliding” is not declared in the current class.

I would be gratefull with any help.

Thank you.

**extends KinematicBody2D
var speed=200
var vel=Vector2()
var bounce_coefficent=1.0
var reflect=true
func _ready():
randomize()
vel=(get_global_mouse_position()-get_position()).normalized()*speed
_fixed_process(true)
pass

func _fixed_process(delta):
var motion=move_and_collide(vel*delta)
if is_colliding():
var n=get_collision_normal()
motion=n.reflect(motion)
vel=n.reflect(vel)bounce_coefficent
move_and_collide(motion)
*

The problem solved with this way:

if KinematicBody2D.is_Colliding
var n=KinematicBody2D.get_collision_normal() …

but now i have these errors:

W 0:00:00:0422 The class variable ‘reflect’ is declared but never used in the script.
W 0:00:00:0422 The function ‘move_and_collide()’ returns a value, but this value is never used.

Nick888 | 2019-04-30 10:42

:bust_in_silhouette: Reply From: kidscancode

You appear to be using Godot 2.x code. _fixed_process() is named _physics_process() as of 3.0.

KInematicBody does not have an is_colliding() method. See Using CharacterBody2D/3D — Godot Engine (latest) documentation in English for examples of how to use this node.

Finally, those last messages are not errors, they are warnings. Read what they say and decide if this is an issue for you or not.

Thanks for your apply.I think that this link you posted will help me.

Nick888 | 2019-04-30 14:53