Coded myself into a corner

W

Wild_West

Guest
I can't figure out how to add a condition that works to this collision.

Symbol Object Collision with Board zone object

if(other.is_symbol_zone)
{
x = other.x;
y = other.y;
selected = false;
}

It's a simple setup, I just grab an object and place it on a space of the board that has the is_symbol_zone variable set to true, which is demonstrated by an animation playing when the object I grab is selected.
It snaps to the x and y of the board space but it of course doesn't check for if a symbol object is already there, which is what I'm trying to add now.
I've tried checking for the other variable the board spaces holds called holds_symbol, but that gets set to true if the symbol object is meeting the board space, so that condition only works if I look for a space with the variable set to true, which is exactly the same problem as not using it.
I tried animation speed but same as before since that sets to 0 when the board space meets a symbol object too.

So all I need is a condition to check for that doesn't allow 2 symbol objects to occupy the same space on the board.
I also already tried if not place_meeting(x,y, symbol_parent_obj) with no result.
I can't do a place_empty or free because of the board space object already being there, and it not being solid obviously.
 
M

Me Myself and I

Guest
I think you need to set up your game as a background image, not an object. Then you can use a grid to check and see if a space is empty or not.

I don't know of a tutorial specific to what you're doing, but you should be able to figure it out from this one:

optimized tile collisions: https://forum.yoyogames.com/index.php?threads/optimized-collision-with-tiles.236/



Failing that, this one will give you an idea of the concept:
grid-based movement tutorials:
 
Last edited by a moderator:
W

Wild_West

Guest
I already saw that video actually, but I tried a rid setup before and realized it wouldn't work since my game board pieces have to check for meeting either a symbol or another piece when they move.
 
Top