The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

so I have been following a tutorial on building a farm sim,(
I followed his directions to a T and despite his working mine is not as I keep getting a non-existant func "initialize" despite the func being called in a child script. I am fairly new to coding and have tried every which way to solve this issue to no avail. here is the error "Invalid call. Nonexistent function 'initialize' in base 'StaticBody2D'."
I will also attach the script bellow the first two being from the Base Scene and the last from the scene I am trying to instance.
Thank you in advance to anyone that can help!

  • var cropdata = {"pk": 1,
    days": [1,2,2,2,INF],
    "currentphase": 0,
    ofcurrentphase": 0,
    "crop_age": 0}

  • func input(event):
    var crop
    path = "res://DrugLordSim proj/Crops/Weed.tscn"
    var crop = load(croppath).instance()
    position = tileposinfrontofplayer * 32

    • func initialize(cropdata):
      phasedays = _cropdata.get("phase_days")
in Engine by (12 points)
reshown by

initialize() is called in several places of your code here. Which one is failing?

it is the line:

Woo I managed to fix it now thanks for a quick reply

You should add the solution to this question so that any other user who encounters a similar problem in future can get a solution here :)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.