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.
Issue with second weaponkazaHi!
I'm getting little confused on creating a second weapon. Here is the thing:
- I've created the second scene, a copy of weapon scene and I keep the main node (Node2D) with two sprites (of hands), I put a Timer, but I attached a new script on the root node that extends of Weapon and inside it i've coded only the _*physics*_proccess.
What happens is that regardless i don't instantiate the second weapon, same way the engine is calling _*physics*_process of the secondary weapon.
I'm doing something wrong? What i miss? Tks in advance.30Feb. 23, 2025
Why divide the max_spread_angle by 2?silent-meerkatwhy did you do randf_range(-max_spread_angle / 2.0, max_spread_angle / 2.0)
instead of setting the max_spread_angle to PI/6 ?10Feb. 17, 2025
What is a good way of creating ice bulletsperiodic-spoonbillPersonally I created a new node with the same system as the 'normal' bullets (but with different sprites and sounds) and then I attached the same script as the 'normal' bullets to it.
It seems a bit makeshift, so not sure if that's a good way to do it or if I should have just made bullet more generalised.30Feb. 06, 2025
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?60Jan. 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.