S
Steneub
Guest
I have discovered a quirk in how precise collision is determined with the collision_line() function.
Using a small sprite (8x8) with one color and several frames as a map* for collision, most of which are angled slopes and one frame as a solid block, I learned that this solid block does not behave as if Precise Collision is enabled.
The documentation clearly states:
The engine treats this frame as imprecise, so I must do two checks to be sure the player object is colliding with instances of this collision object.
I know this is 1.4 and not going to get fixed, but is there a way around this quirk other than doing this the way I'm doing it?
* For a little context, I have an object read the tile data and spawn corresponding objects referencing the appropriate shape.
Using a small sprite (8x8) with one color and several frames as a map* for collision, most of which are angled slopes and one frame as a solid block, I learned that this solid block does not behave as if Precise Collision is enabled.
The documentation clearly states:
Which the sprite does have Precise enabled, which is why the other tiles work the way they should. This quirk has been causing me to pull my hair out....for precise collisions to be enabled, the object or instance that you are checking for must also have precise collisions enabled for their sprite.
The engine treats this frame as imprecise, so I must do two checks to be sure the player object is colliding with instances of this collision object.
Code:
var c = collision_line( x1, y1, x2, y2, obj_collision, true, true );
if (c == noone) c = collision_line( x1, y1, x2, y2, obj_collision, false, true );
if (c != noone) {
collision_direction[i] = true;
}
* For a little context, I have an object read the tile data and spawn corresponding objects referencing the appropriate shape.