E
Edeyz
Guest
[SOLVED]
The solution had to with with the fact that the road was created from a distorted one pixel texture. The issue was fixed by enableing precise collision checking.
I am having some strange behavior with placing "Roads". When the road is on an angle, its "Pixel perfect collision" seams to be in a square around it.
See the attached gif for example.
If you need more information please ask.
Thank you
-Edeyz
The solution had to with with the fact that the road was created from a distorted one pixel texture. The issue was fixed by enableing precise collision checking.
I am having some strange behavior with placing "Roads". When the road is on an angle, its "Pixel perfect collision" seams to be in a square around it.
See the attached gif for example.
If you need more information please ask.
Code:
///Creates the road start
if global.textboxOpen == false
{
if selected == true //&& global.mouseOverMap == true;
{
createingRoad = true;
//Checks if something is near
//Intersection
colIntersection = collision_point(mouse_x, mouse_y, obj_intersection, true, true)
if colIntersection
{
roadID = instance_create(colIntersection.x, colIntersection.y, obj_road).id;
with roadID
{
startPointX = other.colIntersection.x;
startPointY = other.colIntersection.y;
}
}
else
{
//Road
colRoad = collision_point(mouse_x, mouse_y, obj_road, true, true)
if colRoad
{
//Checks if its near the end of the road
if point_distance(mouse_x, mouse_y, colRoad.x, colRoad.y) < 15
{
colIntersection = instance_create(colRoad.x, colRoad.y, obj_intersection);
}
else if point_distance(mouse_x, mouse_y, colRoad.endPointX, colRoad.endPointY) < 15
{
colIntersection = instance_create(colRoad.endPointX, colRoad.endPointY, obj_intersection);
}
//Not near any end
else
{
colIntersection = instance_create(mouse_x, mouse_y, obj_intersection);
//Resets the first road
with(colRoad)
{
other.tempEndPointX = endPointX;
other.tempEndPointY = endPointY;
script_execute(scr_resetRoad);
}
//Creates the second road
with(instance_create(mouse_x, mouse_y, obj_road))
{
startPointX = mouse_x;
startPointY = mouse_y;
endPointX = other.tempEndPointX;
endPointY = other.tempEndPointY;
image_angle = point_direction(startPointX,startPointY,endPointX,endPointY);
image_xscale = point_distance(startPointX,startPointY,endPointX,endPointY) / sprite_get_height(sprite_index);
}
}
roadID = instance_create(colIntersection.x, colIntersection.y, obj_road).id;
with roadID
{
startPointX = other.colIntersection.x;
startPointY = other.colIntersection.y;
}
}
else
{
//Not near road or intersection
colIntersection = instance_create(mouse_x, mouse_y, obj_intersection);
roadID = instance_create(mouse_x, mouse_y, obj_road).id;
with roadID
{
startPointX = mouse_x;
startPointY = mouse_y;
}
}
}
}
}
Thank you
-Edeyz
Last edited by a moderator: