Interesting! I wonder why after I released the evade key the npc is still fleeing when I'm moving in the same direction. I'm using WASD to control my character and if I'm multipling the player velocity by a big number. The NPC would always trying to move to the location that's far away from the player even if I'm right behind him.😅
Working in a top down setting, I'm guessing if you wanted to change an enemies sprite based on direction, you'd compare the current velocity to future position too? Then that versus angles based on the current x/y?
It depends, what I'm doing here is just getting the velocity angle, but it some cases it could be simpler (for example many top down games such as Nuclear Throne just flip the x axis) or more complicated (for example you want it to orient towards the direction it wants to even if some other force is pushing it in a different direction).
You mention at 3:30 that in this demonstration, you're referencing the Seeker object directly, but that you shouldn't do that in a real game. Could you explain a bit more about why?
Sure. I'm referencing an instance of an object through the object id instead of the instance id. This works in GameMaker so long as there is one and only one instance of that object at any given time. So this wouldn't work if I had more than one seeker. And in general for that reasons it's also a bad practice to use an object id instead of an instance id. The exception are manager type objects where you know with certainty that there will be one, and only one instance of it ever existing at any given time.
Thank you very much!
Your tutorials are REALLY great! How could I found your channel this late? Will definitely consider joining the patreon
Thanks for your effort, really helpful!
This is my favourite GMS series of all time! Awesome work Sam.
Thank you again!😀
Interesting! I wonder why after I released the evade key the npc is still fleeing when I'm moving in the same direction. I'm using WASD to control my character and if I'm multipling the player velocity by a big number. The NPC would always trying to move to the location that's far away from the player even if I'm right behind him.😅
Working in a top down setting, I'm guessing if you wanted to change an enemies sprite based on direction, you'd compare the current velocity to future position too? Then that versus angles based on the current x/y?
It depends, what I'm doing here is just getting the velocity angle, but it some cases it could be simpler (for example many top down games such as Nuclear Throne just flip the x axis) or more complicated (for example you want it to orient towards the direction it wants to even if some other force is pushing it in a different direction).
You mention at 3:30 that in this demonstration, you're referencing the Seeker object directly, but that you shouldn't do that in a real game. Could you explain a bit more about why?
Sure. I'm referencing an instance of an object through the object id instead of the instance id. This works in GameMaker so long as there is one and only one instance of that object at any given time. So this wouldn't work if I had more than one seeker. And in general for that reasons it's also a bad practice to use an object id instead of an instance id. The exception are manager type objects where you know with certainty that there will be one, and only one instance of it ever existing at any given time.