Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.
How do I use the created scripts?ram876Hello! I have a problem understanding the assignment. In the challenges, you prompt to create a script and write the logic of a new weapon there. I have 2 questions.
1) If I'm only writing a script with new logic, how do I use it when shooting? In this case, do I need to create an exported variable for the weapon, first removing it from the player's scene, and then, when selecting pickups, load this script using load/preload?
2) Judging by your examples of solving challenges, you have created not only a script, but a whole scene with your script. Did you mean that in the challenges?20Jan. 06, 2025
Accessing nodes elsewherePaulI decided to spice up the automatic shooting weapon by making it fire really fast but have a heat build-up mechanic. I got this to work but I think I've either forgotten an important lesson or I've not fully understood accessing/getting references to nodes elsewhere in the scene tree.
Here's a short demo of what I mean: [https://youtu.be/Tc7qLQdVm4g?si=plzQ8L76fkHdBHau](https://youtu.be/Tc7qLQdVm4g?si=plzQ8L76fkHdBHau)
So, it works. I want the 'heat' `ProgressBar` node part of the Player, alongside the health bar in my node structure, but I want to handle the overheating mechanics in the weapon with the rest of the weapon code, nested deeper down in the Player scene. I was struggling to work out the best way to do this - it seems like a simple thing but for some reason I'm puzzled by it. I got it to work using:
```gdscript
@onready var heat_bar: ProgressBar = get_node("../../../HeatBar")
```
to get a reference to the heat bar from the weapon (up several levels, then across). Would this be the best way to achieve this? By using a relative path rather than absolute, it certainly seems less prone to breaking later on, but I'm still not sure if this would be the recommended method.20Dec. 31, 2024
An error in the bullet spread scriptKetanI noticed that in the "shotgun" version of the weapon wasn't playing any sound when shooting and I did some research, apparently the `shoot_audio` var was always null
Turns out you can't access export variables from an extended scene, I tried to load it at runtime but Godot at the moment doesn't support loading .wav files at runtime
The only solution I found was to add a new @onready var in the shotgun weapon scene with a new AudioStreamPlayer node, I'm curious if the there're any other ways I could solve this?20Dec. 24, 2024
Charging Ice ParticlesMarcJI've added the charging particles for the ice fist but when I looked at your version of the code I see you used an AnimationPlayer to start the particles.
I assumed that you used it to intensify the particles as you charge but when I tried it I found that the particles restarted if you changed any of the values and from a bit of reading it seems that's the expected behavior.
So I'm just curious to know what you are doing with the AnimationPlayer?40Dec. 22, 2024
Lesson Q&A
Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.