loot drop in a top-down-left-right game

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

Hi, I have a problem, I have a tree in my game and if the player enters the tree on the left or right then he can cut it down. as soon as it is felled, 3 wood items should be dropped.How do you do that? Does anyone know what I mean and how to do it?Thanks in advance

:bust_in_silhouette: Reply From: Firty

First you need something to identify the start of the cut, in a 2D game using tilemap, an InputEvent function on the TileMap, reading information like the tool used, the distance between the player and the tree and of course if that tile is a tree, would be enough to start a cutting animation. When the cut is finished, you will need to change the tree tile to something like a trunk and call a function that will generate these woods on the floor. I’ve seen something similar on this site, it’s simple but it opened my mind to the idea.

GitHub - oiblank/godot-farming-prototype: 2D Farming prototype using TileMaps.