Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | dm73994 |
i have a kinematickBody2D node, and a staticBody2D, an the staticBody2D hace a grup call “cajaSorpresa”, so i want to make something when the kinematickBody2D collide whit the group “cajaSorpresa”, for the moment i just want to print something in the console to see that is working correctly. this is the code:
extends KinematicBody2D
export (int) var walk_speed = 200;
export (int) var jump_speed = -420;
export (int) var gravedad = 1200;
var velocidad = Vector2();
var jumping = false;
func get_input():
#here is the funtion to move the character but idont think that is necesary
#i just use de Input.is_action_pressed and no more
func _physics_process(delta):
get_input();
#here there is a funtion to jump, no necesary put here to the question i think
velocidad = move_and_slide(velocidad,Vector2(0,-1));
#this its the funtion that i can't get it, the game doesn't show any
#problem when is runing, but either do anything
func _procesar_colision():
var collision = move_and_collide(Vector2(0,0));
if collision.is_in_group("cajaSorpresa"):
var collidedObject = collision.get_collider()
print("is colliding whit cajaSorpresa");