Slow Update

So the growth speeds were actually much easier to make than I thought. I added in two variables that I need to rename, basically max growth number and current growth counter (max and cur for this post). By default in the base plant Node2D, max is 2, and the reworked growth logic increases cur by 1 every time the grow button is clicked. So the base plant needs two clicks, then is ready for harvest.

Additionally, inheritance was also thankfully straightforward, with a bit of trickery with the default variables. If anyone wants to know how to change a parent variable basically at start:

  1. First, put your two variables into (realistically probably your func _init) or your func _ready, such that your method looks like func _ready(_max = 2, _cur = 0) -> void: and you're assigning _max and _cur to your variables in the base / parent.
  2. Second, in your child / extended node, right click on the node in scene and select "Extend Script" instead of just add script, and you should have something like extends "res://path/to/script.gd" at the top of your new script.
  3. Third, in the extended script, you can make a similar method func _ready(_max = 4, _cur = 0) -> void: and then just call super(_max, _cur) to let it set the parent variables to your values.

With the slow version of the plant node, it takes 4 clicks to get to harvest. In theory this would actually be days to grow, I just don't have a day / night cycle yet. However, now everything has potential minor variations and I could expand on the basics to make a variety of crops.

I still don't have images or icons or anything for different plants / stages, kind of thinking that's my next goal and extending the base plant to have like, Corn or Tomato nodes. Not sure if that's too much for the proof of concept, or if I should basically call the demo done and move to a proper project.

EDIT: I didn't like how I wrote the directions, so here's the two code blocks for the process I described above.

Parent Code:

extends Node2D


var max: int
var cur: int


func _ready(_max = 2, _cur = 0) -> void:
    max = _max
    cur = _cur


...

Child Code:

extends "res://path/to/parent_script.gd"


func _ready(_max = 4, _cur = 0) -> void:
    super(_max, _cur)


...