A bit stuck... trying to figure out a way of collecting materials. Help.

Hello there! Over the past few hours I have been trying to figure out how to create a way where the player can walk up to a tree/rock in the game and harvest the wood (which will show up at the top left of the screen). I understand that I need to do something involving colliders and probably tags but I need someone with experience using Unity 2D to see what the best solution is.

First of all I will need to explain what my game is. A resource management game, with an survival element and a “action point” system in place to give the player an extra mechanic to think about. Simply, I need the player to collect materials like wood or stone and I am struggling with it.

Here is what the idea is:

  • Player interacts with a tree/object then the player walks up to that tree and then collects the resources from it.
  • The “harvest” time should be around 3-5 seconds long and should collect 2-5 pieces of wood each second or so.

I am not asking for you to do the whole entire code as I don’t really learn anything, just point me in the right direction with a few boosts. Once again, your help will be greatly appreiciated!

If you haven’t already gone through some unity tutorials, I would recommend doing that. Simple ones that introduce you to the “pieces” and “ideas” you will use throughout so many, if not all, of your games. :slight_smile:

Interaction object could be a trigger collider area or distance check.
A coroutine might help with the harvesting time.
collection is an integer you add to your score (or resources*).