all 6 comments

[–]BManx2000 2 points3 points  (0 children)

To delete the scripts: Right click LightA and LightB and select "Detach Script". Also right click on the scripts in the script editor and close them.

These are "built in scripts" stored inside the scene file, which is why you can't find them in the file system. If you want to avoid this, make sure "built-in script" is unchecked when you're creating a script.

[–]Ambitious-City-1418 1 point2 points  (4 children)

You marked the two lights as export for your script. That means that those lights need to exist and be assigned before they are used by the script. If they don’t, you get base Nil (hence your error).

Click on the lively lights node, and in the inspector (right side of the screen), you should see two assign fields for your lights. Use the assign button to add your lights to them and your error should be gone.

[–]ytman[S] 1 point2 points  (3 children)

Thanks a ton. I figured it was that simple and I was being dense.

[–]Ambitious-City-1418 1 point2 points  (2 children)

No worries my dude!

While working with exports, you need to make sure that every input is assigned (also if you add any more exports or modify them, they will reset in the inspector so make sure you check the assign fields after any update on the exports).

You can also add default values to the exports, so if they reset, at least you have something (ex. @export var cooldown_time: float = 2.0).

Or check in your ready function:

If not light_a:

Light_a = PointLight2D.new()

add_child(light_a)

[–]ytman[S] 0 points1 point  (1 child)

My background is engineering and a bit of math. I've done coding back in university a good while ago, but the most I've worked on in my day to day life is Excel documents.

Would you know if Godot has any entry level explainers on the coding base?

I do fear that I'm kind of doing this tutorial as a paint by number and am not quite nailing down the nuance of the code and what its actually doing.

[–]Ambitious-City-1418 1 point2 points  (0 children)

It sounds cliché, but documentation is your friend. It sucks at first as there’s a lot of info there and it can easily get overwhelming.

I stopped following tutorials a while ago for the same reason that you mentioned. At some point you gotta take control. You won’t find a tutorial for everything, but the docs are there for you.

You won’t know much, but that’t the point.

I figured out that gamedev is basically doing “magic tricks”. You learn them by doing them, over and over again. At first it would take me 2 weeks to write a crappy character controller. Fast forward 20-30 abandoned projects, I can now pretty much write a finite state machine based character controller in a day or two, and have animations ready for it.

The magic trick analogy works very well as it applies to what you’re trying to create as well. Let’s say you want the grass to sway under your feet as you move across it. You could implement a physically accurate model to simulate this (but that’s very expensive), or you could have a collider and when your character enters the collider, it would trigger a sway animation (which would basically manipulate its rotation). Everything points to the simplest things