D
dicktracy
Guest
Hi!
I have a problem with collision checking. I have a grid based game on which every grid cell can contain only one object. I have a player and enemies. Enemies by now are not moving and the player can move only one cell at once, either horizontally or vertically. My problem here is with collision detection. I tried every possible collision checking method (position_empty, position_meeting, place_meeting etc.). Unfortunately nothing is working for me, and the collision is not detected, so the player can be placed in the enemy cell.
I tried with precise collision checking marked and unmarked for both of objects (object_enemy and object_hero), I also tried to make them solid and set same depth. I checked many times if the coordinates are correct and they are. Both built-in vars x and y for both objects are the same in the collision checking x and y(i.e. x = 562, y = 712 are exactly the same for both objects). I have no more ideas why is this not working.
part of the code that I am using:
//object hero moves one cell horizontally to the right from hero_x to hero_x + 57(distance to next cell - and exactly x position of the enemy_x, hero_y does not change here and is exactly the same as enemy_y). Collision is still not detected.
and then I use:
to move a hero, but it always does not detect the collision. I tried also different variation and checking methods and always came to same result - no collision detection. What do I do wrong?
I have a problem with collision checking. I have a grid based game on which every grid cell can contain only one object. I have a player and enemies. Enemies by now are not moving and the player can move only one cell at once, either horizontally or vertically. My problem here is with collision detection. I tried every possible collision checking method (position_empty, position_meeting, place_meeting etc.). Unfortunately nothing is working for me, and the collision is not detected, so the player can be placed in the enemy cell.
I tried with precise collision checking marked and unmarked for both of objects (object_enemy and object_hero), I also tried to make them solid and set same depth. I checked many times if the coordinates are correct and they are. Both built-in vars x and y for both objects are the same in the collision checking x and y(i.e. x = 562, y = 712 are exactly the same for both objects). I have no more ideas why is this not working.
part of the code that I am using:
Code:
plusx = place_meeting(hero_x + 57, hero_y, o_enemy);
and then I use:
Code:
if (!plusx){
hero_x = hero_x + 57;
}