I think there is a small issue with the vector_random() function. The random() function will return a value from 0 to 360, a total of 361 numbers. I am pretty sure GMS will see a 361 as a 0 when used as a direction (not 100% on this) but it still means you are more likely to return the value 0 over any other. Great videos by the way, these vector functions are very valuable. They should be part of GMS2!
Thank you! For random, while irandom is inclusive, and includes the number given, random is exclusive. So irandom(360) would give you 361 numbers, 0-360 where 360 would be read as 0 again basically giving you two 0s. But random(360) will give you a number between 0-359.99999999 (to however many decimals random goes to). I'm not sure why there's a difference between the two, but I assume it is so you don't have to say confusing things like irandom(2) in order to get a 0 or 1. But can still say random(1) and never actually get the number 1.
Hello, I don't know if you still read comments from videos this old, but I wanted to ask why you don't get an error when typing your function vector_zero(): v̲e̲c̲t̲o̲r̲(̲)̲ constructor{ my vector_zero keeps marking the : v̲e̲c̲t̲o̲r̲(̲)̲ as an error?
vector_random or GameMaker's built-in random? For vector_random it is vec = new vector_random(); or vec = new vector_random(3); (where vec is the name of your new vector variable and you can include an argument that is a real number or not, and if you don't it defaults to a length of one).
@@SamSpadeGameDev I mean the random_vector(). I can't figure out how to apply it to other vectors, like if I wanted to do what Daniel Shiffman does at 6:30 in his video on random vectors ua-cam.com/video/jupjuq9Jl-M/v-deo.html
@@SamSpadeGameDev I figured it out! I still don't know the syntax for using child structs, I'll look that up later. But I was able to get the effect I wanted using the random_range(-1, 1) and then set_magnitude to lock the line to a specific length. Thank you so much for making these! it would've been a headache to write all the function math myself. I can't wait for you to get to the steering behavior stuff! Good luck on the game jam!
Extra thanks!😅
I think there is a small issue with the vector_random() function. The random() function will return a value from 0 to 360, a total of 361 numbers.
I am pretty sure GMS will see a 361 as a 0 when used as a direction (not 100% on this) but it still means you are more likely to return the value 0 over any other.
Great videos by the way, these vector functions are very valuable. They should be part of GMS2!
Thank you!
For random, while irandom is inclusive, and includes the number given, random is exclusive. So irandom(360) would give you 361 numbers, 0-360 where 360 would be read as 0 again basically giving you two 0s. But random(360) will give you a number between 0-359.99999999 (to however many decimals random goes to).
I'm not sure why there's a difference between the two, but I assume it is so you don't have to say confusing things like irandom(2) in order to get a 0 or 1. But can still say random(1) and never actually get the number 1.
@@SamSpadeGameDev Ahhhh. I see. I should have RTFM!
Hello, I don't know if you still read comments from videos this old, but I wanted to ask why you don't get an error when typing your function vector_zero(): v̲e̲c̲t̲o̲r̲(̲)̲ constructor{
my vector_zero keeps marking the : v̲e̲c̲t̲o̲r̲(̲)̲ as an error?
why are you not getting an error for not passing arguments to vector() in your inherited functions?
Hi, I think you can set defaults for arguments by doing this: function my_func(_myarg = 1)
What's the syntax for using the random function? I can't seem to get anything other than error messages.
vector_random or GameMaker's built-in random? For vector_random it is vec = new vector_random(); or vec = new vector_random(3); (where vec is the name of your new vector variable and you can include an argument that is a real number or not, and if you don't it defaults to a length of one).
@@SamSpadeGameDev I mean the random_vector(). I can't figure out how to apply it to other vectors, like if I wanted to do what Daniel Shiffman does at 6:30 in his video on random vectors ua-cam.com/video/jupjuq9Jl-M/v-deo.html
@@SamSpadeGameDev I figured it out! I still don't know the syntax for using child structs, I'll look that up later. But I was able to get the effect I wanted using the random_range(-1, 1) and then set_magnitude to lock the line to a specific length.
Thank you so much for making these! it would've been a headache to write all the function math myself. I can't wait for you to get to the steering behavior stuff! Good luck on the game jam!