• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM [SOLVED] Saving a moving objects coordinate as a constant

S

ShuDiZo

Guest
Hi, the problem im having at the currenr moment is. As you've read from the title, saving a moving objects x and y coordinate in that moment as a constant.

I plan to save this coordinate as the enemy objects next location, as it dashes toward that point.

E.g.
Step 1: find player if player exists and player location is in its view but not attack range.
Else step:
If distance is inside the enemy objects attack range, charge = true.

Step 2: if charge is true, enemy saves players location as xx and yy. Then, sets chosen_cord to true and alarm counts down.

Step 3: if alarm <= 0 and charge is true, point_direction(x, y, xx, yy);

If you would help with this, you have my thanks and gratitude.
 
S

ShuDiZo

Guest
To be blunt, i just need help with an alternate method of saving the players coordinate x and y in thst moment.
 

YoSniper

Member
Just to understand, are you asking for code? Or D&D sequence?

It sounds like you have the right approach, so I'm just trying to figure out what you need us for.


Reading your second post, what I would do is in your enemy object:
Create Event
Code:
target_x = x;
target_y = y;
Step Event
Code:
//...
//Steps 1 and 2:
if instance_exists(obj_player) and charge and not chosen_cord {
    target_x = obj_player.x;
    target_y = obj_player.y;
}
 
Top