M
mcglubski
Guest
So I've made a simple grid movement for my game where you can move to squares with 3 actions (1 movement equals an action), I am having difficulty figuring out a good way to let the player move back to previous squares and regaining their actions. I was able to figure out a really poor "Press Backspace Method" but honestly it would be much more beneficial to have them just be able to move there with their actual movements. I tried setting each square they were previously on and checking whether they are moving to that square and act accordingly (add action points back to player and erase the third actions xy coordinates) , but no matter what I do I can't seem to do it without using a huge amount of code. Does anyone have a simple solution for me?
Here is the current code I have to keep the player moving on the grid
Any ideas or suggestions?
Here is the current code I have to keep the player moving on the grid
GML:
//Combat Grid Width/Height
xMove = 44;
yMove = 26;
//Keys begin disabled
keyLeft = false;
keyRight = false;
keyUp = false;
keyDown = false;
//Coordinates
y1 = 130;
y2 = (y1 + yMove);
y3 = (y2 + yMove);
y4 = (y3 + yMove);
x1 = 44;
x2 = (x1 + xMove);
x3 = (x2 + xMove);
x4 = (x3 + xMove);
//Move Left
if keyboard_check_pressed(vk_left) || keyboard_check_pressed(ord("A"))
&& !place_meeting(x - xMove, y, ob_parentcol)
&& !place_meeting(x - xMove/2, y, ob_thincol)
&& action_points > 0
{
keyLeft = true;
}
else keyLeft = false;
//Move Left
if x <= x4
&& x > x1
{
if keyLeft = true
{
keyUp = false;
keyDown = false;
x -= xMove;
action_points -= 1;
}
}
Any ideas or suggestions?