Please pin this fix, Those who having problem that the meteors isn't spawning, just toggle/on the auto start in the timer inspector, that's it you are good to go. Love from India.
I was struggling a lot on the 10:50 exercise, for the speed I figured that one out rather easily, although I executed it slightly different, the big first hurdle was the rotation, which I used rotate(-0.2, 0.2) for, which worked I guess, but to find that took a really long time and none of the other methods I tried worked. Then finding a way to set the angle of the meteors had me completely stumped, I tried looking for something similar to rotate, but nothing worked, I would've never guessed to set the x value on the Vector2 there. Same for the image one, I knew how I would want to do both of these logically, but not finding the correct code to do it was really frustrating.
For randomising the texture, I didn't use the concatenation trick you did. Instead, I loaded the 5 sprites into variables, put them each into a list and had _ready() choose a random index from that list. I considered your method, but the docs for the load() method seem to suggest that it's preferable to call it as few times as possible, e.g. not in _ready() or _process().
This one was a great challenge, but I did misinterpret one part of the exercise, randomizing the meteor direction. Without continuing the video, I figured out how to get meteors travelling through the scene from every direction, not just from the top down. Which was awesome, but when I continued the video, it became apparent that I over-complicated it a little. Then trying to get the rotation working helped me learn about how each meteor is updated. Evolving from meteors that have their vectors updating constantly, looking like meteor microbes spreading across the screen is some strange unison, to working as intended. A really neat way to learn, and it reminds me of how much I really enjoy problem-solving. I only have one question regarding 'CollisionShape2D'. I ended up finding a way, after prompting 'ChatGPT' a few times, and troubleshooting, to get the collision shape updating to a 'CircleShape2D' given the greatest (x, y) value of the imported texture. It was a neat thing to learn, but did I miss something in the video in regard to the collision shape size, or do all the meteors, regardless of size, share the same 'CollisionShape2D' in this video? Is this something discussed in a later video? I am moving quite slowly through the tutorials to squeeze the most out of the rabbit holes I am finding myself in, so I apologize if this is answered later on. Thought I would share my learning experience, and mention how much I am enjoying the experience so far. Cheers
Was totally stumped on the random texture exercise lol. I got the rotation, speed, and direction right but I put the variables for them underneath the process function instead and that was causing them to always go to the max value, even though I was printing the values beforehand and it seemed like they were random. So, I'm not sure exactly what went wrong there, but now I know that I should definitely be setting variables for that sort of thing outside of the process function and then actually using them in the process function. I didn't know you could overwrite variables from other parts of the script (and I'm coming from an engine where all variables are global so it's a bit of an adjustment).
14:00 I wrote: direction_x = randf_range(-1, 1) instead direction_x = rng.randf_range(-1, 1) Its also works, but Godot colored "randf_range" on violet instead of blue What is the diferent?
Hello. I am following your tutorial closely. I have a problem, meteors do not fall from the beginning of the x axis, i.e. from 0, but from half the screen. I used print to check if the random number generator does not generate small numbers, but everything is fine. I made a fullscreen and then I saw that large values fall outside the game screen. Do you have any idea what is causing this? I have the screen set to 1280 x 720
I had the same problem and it appears that my meteor scene had the meteor at some offset. I went in to the meteor scene and set its position to 0,0 and that seems to have fixed my problem. I also had to change the CollisionShape2d to 0,0. I am curious if it works for you
I'm in Godot 4.3 When I use your rotation code for the meteors, it seems as if it's rotating the whole meteor scene because my meteors start turning and curving rather than traveling straight with rotation. I fixed this in my code by adding $Sprite2d.rotation_degrees += MeteorRotationSpeed * delta. $Sprite2D refers to the Sprite2D node in the meteor scene. This will rotate the sprite itself rather than the entire meteor scene so that it doesn't change directions midflight.
My meteors aren't rotating independently, they slowly rotate and the trajectory it is following changes to whatever it is pointing at. Causes meteors to swirl around the screen really fast.
I have a question concerning the meteor rotation. When the lines for rotation are active, my meteors not only rotate at varied speeds, but they also turn towards the rotation. With the rotation lines removed, the meteors function correctly aside from not rotating. When the rotation speed is raised to a point, the faster meteors will travel onto the screen, then fly in circles. Where should I look for documentation as to what I've done incorrectly? Also, thank you very much for sharing your knowledge!
I didn't have the assets pack, so for me I had different size meteors. So I instead had an array of loaded packed scenes (each meteor type being a scene) which I then randomly selected to instantiate.
I suck at this, I am getting an error at 18:24 despite following your instructions. Only difference is I made my own textures since I can't find your file containing them. They are still .png files however. Here is the error: Invalid assignment of property or key 'texture' with value of type 'CompressedTexture2D' on a base object of type 'null instance'. I don't know what I done wrong, I checked, I don't have any CompressedTexture2D's? Please help...
Have a problem with the randomization of the meteors...when i remove (the randomization steps they appear) but when i put them in the code...i just have the player
at 18:06 when I add the path, it isn't spawning anything (yes I have the timer on auto start), not sure why it's doing that, as I've done everything the same way...
@@KyTheCrusader Nope, I just left it how it was tbh, I tried researching but couldn't find out why, I even tried renaming the files to what he had and still didn't work... I ended up stopping after that, and moved on to something else lol, I apologize for not finding the solution though!
Great tutorial! The assets for the game include meteors of varying sizes, which would affect collision detection as the collision area of the big ones is...well bigger than the small. I'm curious: How can we handle this? It's obviously not truly needed here as there are varying meteors of the same size, but my brain is curious!
if your still curious I wanted to implement the same thing and this is how I ended up doing it: under the ready func update_collision_shape($Sprite2D.texture) and this as a separate func: func update_collision_shape(texture): # get the dimensions of the texture var texture_size = texture.get_size() var shape = CircleShape2D.new() shape.radius = min(texture_size.x, texture_size.y) / 2 $CollisionShape2D.shape = shape
Because of this part i had to redo everything 4 time because tscn one didn’t work Edit1: 6 times why it break bro am so tried i have been trying for 6 hours i did nothing wrong and it break Edit2: i just can’t get the meteor spawn/clone it self it doesn’t even show and i turned on autostart Edit3: now i can’t move Edit4: i got meteors to work the issue was the width in var random_x = rng.randi_range(0, width) break it so i changed it to 1280 but i can’t move my character any help?
I know this sounds weird but my meteor statt spawning from the top but then they start spawning halfway down and finally they stop spawning and i am not sure why i have rng(-150,-50) even if i set 0 it still doesn't change
You would need to add the following to the script "var random_scale = rng.randf_range(0.25 , 2.00)" AND "scale = Vector2(random_scale, random_scale)" REMOVE THE QUOTATION MARKS
Your vids are amazing, right amount of info, the exercises are challenging but not out of the context you're teaching, really good stuff, congrats
I really appreciate that! :) thanks for watching
Please pin this fix,
Those who having problem that the meteors isn't spawning, just toggle/on the auto start in the timer inspector, that's it you are good to go.
Love from India.
these are really great tutorials/introduction to the engine! thank you!!!
Awesome, thanks! :)
I was struggling a lot on the 10:50 exercise, for the speed I figured that one out rather easily, although I executed it slightly different, the big first hurdle was the rotation, which I used rotate(-0.2, 0.2) for, which worked I guess, but to find that took a really long time and none of the other methods I tried worked.
Then finding a way to set the angle of the meteors had me completely stumped, I tried looking for something similar to rotate, but nothing worked, I would've never guessed to set the x value on the Vector2 there.
Same for the image one, I knew how I would want to do both of these logically, but not finding the correct code to do it was really frustrating.
For randomising the texture, I didn't use the concatenation trick you did. Instead, I loaded the 5 sprites into variables, put them each into a list and had _ready() choose a random index from that list. I considered your method, but the docs for the load() method seem to suggest that it's preferable to call it as few times as possible, e.g. not in _ready() or _process().
i will not shave until netninja uploads an updated flutter tutorial
Currently working on it :)
Good teacher : print and test every step !!! ♥
Ty so much for the beginner and intermediate help. You are teaching me so much
This one was a great challenge, but I did misinterpret one part of the exercise, randomizing the meteor direction. Without continuing the video, I figured out how to get meteors travelling through the scene from every direction, not just from the top down. Which was awesome, but when I continued the video, it became apparent that I over-complicated it a little.
Then trying to get the rotation working helped me learn about how each meteor is updated. Evolving from meteors that have their vectors updating constantly, looking like meteor microbes spreading across the screen is some strange unison, to working as intended. A really neat way to learn, and it reminds me of how much I really enjoy problem-solving.
I only have one question regarding 'CollisionShape2D'. I ended up finding a way, after prompting 'ChatGPT' a few times, and troubleshooting, to get the collision shape updating to a 'CircleShape2D' given the greatest (x, y) value of the imported texture. It was a neat thing to learn, but did I miss something in the video in regard to the collision shape size, or do all the meteors, regardless of size, share the same 'CollisionShape2D' in this video? Is this something discussed in a later video?
I am moving quite slowly through the tutorials to squeeze the most out of the rabbit holes I am finding myself in, so I apologize if this is answered later on. Thought I would share my learning experience, and mention how much I am enjoying the experience so far.
Cheers
You should create your RNG as a property of the meteor script, rather than recreating a new one every time you spawn in a new meteor.
why?
For the graphic I had created a huge if statment but this path solution is much better! Thanks for the great tutorials!
Was totally stumped on the random texture exercise lol. I got the rotation, speed, and direction right but I put the variables for them underneath the process function instead and that was causing them to always go to the max value, even though I was printing the values beforehand and it seemed like they were random. So, I'm not sure exactly what went wrong there, but now I know that I should definitely be setting variables for that sort of thing outside of the process function and then actually using them in the process function. I didn't know you could overwrite variables from other parts of the script (and I'm coming from an engine where all variables are global so it's a bit of an adjustment).
14:00 I wrote:
direction_x = randf_range(-1, 1)
instead
direction_x = rng.randf_range(-1, 1)
Its also works, but Godot colored "randf_range" on violet instead of blue
What is the diferent?
bro where did you got that signals i couldn't find it
Hello. I am following your tutorial closely. I have a problem, meteors do not fall from the beginning of the x axis, i.e. from 0, but from half the screen. I used print to check if the random number generator does not generate small numbers, but everything is fine. I made a fullscreen and then I saw that large values fall outside the game screen. Do you have any idea what is causing this? I have the screen set to 1280 x 720
I set randi range (-1000, width) and now meteors are falling from the begining of the screen. Just game is counting X = 0 as middle of the screen.
I had the same problem and it appears that my meteor scene had the meteor at some offset. I went in to the meteor scene and set its position to 0,0 and that seems to have fixed my problem. I also had to change the CollisionShape2d to 0,0. I am curious if it works for you
@@ChrisTilleyCA I was puzzled over this one. Thanks for the solution
To get a random image i used an array to store each image and generated a random index from 0 to len(arr) - 1
I'm in Godot 4.3
When I use your rotation code for the meteors, it seems as if it's rotating the whole meteor scene because my meteors start turning and curving rather than traveling straight with rotation.
I fixed this in my code by adding $Sprite2d.rotation_degrees += MeteorRotationSpeed * delta.
$Sprite2D refers to the Sprite2D node in the meteor scene. This will rotate the sprite itself rather than the entire meteor scene so that it doesn't change directions midflight.
Thanks so much I was wondering why that was happening
That said it is funny as heck and has it's uses.
My meteors aren't rotating independently, they slowly rotate and the trajectory it is following changes to whatever it is pointing at.
Causes meteors to swirl around the screen really fast.
I have a question concerning the meteor rotation. When the lines for rotation are active, my meteors not only rotate at varied speeds, but they also turn towards the rotation. With the rotation lines removed, the meteors function correctly aside from not rotating. When the rotation speed is raised to a point, the faster meteors will travel onto the screen, then fly in circles. Where should I look for documentation as to what I've done incorrectly?
Also, thank you very much for sharing your knowledge!
I didn't have the assets pack, so for me I had different size meteors. So I instead had an array of loaded packed scenes (each meteor type being a scene) which I then randomly selected to instantiate.
I suck at this, I am getting an error at 18:24 despite following your instructions.
Only difference is I made my own textures since I can't find your file containing them. They are still .png files however.
Here is the error:
Invalid assignment of property or key 'texture' with value of type 'CompressedTexture2D' on a base object of type 'null instance'.
I don't know what I done wrong, I checked, I don't have any CompressedTexture2D's?
Please help...
Have a problem with the randomization of the meteors...when i remove (the randomization steps they appear) but when i put them in the code...i just have the player
at 18:06 when I add the path, it isn't spawning anything (yes I have the timer on auto start), not sure why it's doing that, as I've done everything the same way...
I'm having the exact same issue😭 I'll update if I figure it out
@@Elena-ed8eo Im having the same issue that both of you are. Where you guys able to find a fix?
@@KyTheCrusader Nope, I just left it how it was tbh, I tried researching but couldn't find out why, I even tried renaming the files to what he had and still didn't work... I ended up stopping after that, and moved on to something else lol, I apologize for not finding the solution though!
@@RoninSamurai No worries! Thanks for filling me in though!
Thanks a lot for these great tutorials!!!
That means a lot :) thanks William
Great tutorial! The assets for the game include meteors of varying sizes, which would affect collision detection as the collision area of the big ones is...well bigger than the small. I'm curious: How can we handle this? It's obviously not truly needed here as there are varying meteors of the same size, but my brain is curious!
if your still curious I wanted to implement the same thing and this is how I ended up doing it:
under the ready func
update_collision_shape($Sprite2D.texture)
and this as a separate func:
func update_collision_shape(texture):
# get the dimensions of the texture
var texture_size = texture.get_size()
var shape = CircleShape2D.new()
shape.radius = min(texture_size.x, texture_size.y) / 2
$CollisionShape2D.shape = shape
What if all graphics have different shapes i dont think only one collison shape 2d can work.
Please tell me iam having this problem.
The method Instantiate for a packed scene What does it do? like does it loads meteor each time the timer finishes into the level scene?
I have errors doing the part with "var width = get_viewport..." in meteor script. Im following your steps 1:1 everything exactly the same
Thank you bro👍
No problem! 👍
Thank Dear.... Wonderful Explanation like always😄
Because of this part i had to redo everything 4 time because tscn one didn’t work
Edit1: 6 times why it break bro am so tried i have been trying for 6 hours i did nothing wrong and it break
Edit2: i just can’t get the meteor spawn/clone it self it doesn’t even show and i turned on autostart
Edit3: now i can’t move
Edit4: i got meteors to work the issue was the width in var random_x = rng.randi_range(0, width) break it so i changed it to 1280 but i can’t move my character any help?
The spawn point on my meteors seems to be moving down, the lasers are also only offset. Any idea what might be causing it?
I fixed the lasers, but the meteor spawn is still falling.
@@Im_a_Chill_PandaInsert the code
I know this sounds weird but my meteor statt spawning from the top but then they start spawning halfway down and finally they stop spawning and i am not sure why i have rng(-150,-50) even if i set 0 it still doesn't change
Never mind thanks to @legosteam comment he worked out that I need to $meteor as in 4.4 you move the entire scene if you don't add meteor
How do you add randomized scaling for meteors to this? I have tried it myself but i could not get it to not crash on me.
You would need to add the following to the script "var random_scale = rng.randf_range(0.25 , 2.00)" AND "scale = Vector2(random_scale, random_scale)" REMOVE THE QUOTATION MARKS
you are the guy from clear code right?
What's clear code? is that a channel, lol
great video
Here is how to do it, oh wait that's the wrong way do it like this???? Otherwise decent tutorial.
insane!
U g.o.a.t