How do you make a variable change when the player collides with a specific object

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

Im making a adventure game and I want to have the player’s life decrease when it touches a monster. Im using v3.0.6

You need to supply more information. What type of object is the player? The monster?

Also, out of curiosity, why are you using such an old version of Godot?

kidscancode | 2020-04-21 15:18

The player is a KinematicBody2D and the monster is a Staticbody2D

JohnPrattAllen | 2020-04-21 18:00

:bust_in_silhouette: Reply From: kidscancode

When you move a KinematicBody2D, you use one of its movement methods, and if there’s a collision you get back a KinematicCollision2D object. This object contains all the information about the collision. See here for details: Using KinematicBody2D

Thank you for the info

JohnPrattAllen | 2020-04-21 18:11