GML:
function ColliderMove(_xAmount,_yAmount) {
///Variables
Remainder.x += _xAmount;
Remainder.y += _yAmount;
var _xMove = round(Remainder.x);
var _yMove = round(Remainder.y);
///Apply Movement
if (_xMove != 0 || _yMove != 0) {
///Disable Collision
Collidable = false;
///Create Riding Actors List
iListActor = ds_list_create();
ds_list_clear(iListActor);
with (pActor) {
if(IsRiding(other.id)) ds_list_add(other.iListActor,id);
}
///Horizontal Movement
if (_xMove != 0) {
Remainder.x -= _xMove;
x += _xMove;
if (_xMove > 0) {
with (pActor) {
if (place_meeting(x,y,other.id)) {
xMove(other.bbox_right - bbox_left + sign(_xMove),Squish);
} else if (ds_list_find_index(other.iListActor,id) != -1) {
xMove(_xMove);
}
}
} else {
with (pActor) {
if (place_meeting(x,y,other.id)) {
xMove(other.bbox_left - bbox_right + sign(_xMove),Squish);
} else if (ds_list_find_index(other.iListActor,id) != -1) {
xMove(_xMove);
}
}
}
}
///Vertical Movement
if (_yMove != 0) {
Remainder.y -= _yMove;
y += _yMove;
if (_yMove > 0) {
with (pActor) {
if (place_meeting(x,y,other.id)) {
yMove(other.bbox_bottom - bbox_top + sign(_yMove),Squish);
} else if (ds_list_find_index(other.iListActor,id) != -1) {
yMove(_yMove);
}
}
} else {
with (pActor) {
if (place_meeting(x,y,other.id)) {
yMove(other.bbox_top - bbox_bottom + sign(_yMove),Squish);
} else if (ds_list_find_index(other.iListActor,id) != -1) {
yMove(_yMove);
}
}
}
}
///Enable Collision
Collidable = true;
///Destroy List
ds_list_destroy(iListActor);
}
}