I Wanna Community
Fangames => Game Design => Programming Questions => Topic started by: N3ON on December 18, 2016, 02:21:09 PM
-
Okay, before i begin, i wanna say that i understand a fair amount of programming, when it comes to game maker: studio, with around 332 hours in the program, but I have no idea how i would get this to work.
Basically, i want to make an object that moves towards the player, but instead of instantly changing it's direction to always move towards the player, i want the object to overshoot if the player dodges, and turn around to try again, like sonic from IWBTB, or this example i found:
(httpss://i.gyazo.com/034556f7caba91379463de776f4d1afd.gif)
As I said, I have no idea where to start with something like this, so any help will be appreciated.
-
You could use the built in gravity_direction to have the desired behaviour.
Set the gravity in the create event, and in the step event have the line:
with(objPlayer)
other.gravity_direction=point_direction(other.x,other.y,x,y);
So that the acceleration of your object is always pointing towards the player.
If you don't want said object to get too far away from the player I suggest also putting a cap on its speed.
-
You could use the built in gravity_direction to have the desired behaviour.
Set the gravity in the create event, and in the step event have the line:
with(objPlayer)
other.gravity_direction=point_direction(other.x,other.y,x,y);
So that the acceleration of your object is always pointing towards the player.
If you don't want said object to get too far away from the player I suggest also putting a cap on its speed.
This worked surprisingly well! Thanks! :atkHappy: