S
shrunkenmaster
Guest
I'm trying to figure out how I can drop an item and only have collision detected after I've moved off it, to avoid getting stuck on it.
At present, when the carried item (oCapPickup) is over the drop off point item (oCapGhost), the carried item returns to base and oCapDrop is created at the drop off point. The player (oRay) is getting stuck, which is not good. Any ideas?
oCapPickup object / collision event with oCapGhost:
Player oRay object / collision event with oCapDrop:
At present, when the carried item (oCapPickup) is over the drop off point item (oCapGhost), the carried item returns to base and oCapDrop is created at the drop off point. The player (oRay) is getting stuck, which is not good. Any ideas?
oCapPickup object / collision event with oCapGhost:
Code:
if (other.image_index =3) {
score +=250;
var _capdrop = instance_create_layer (other.x,other.y,"Pickup", oCapDrop);
with (_capdrop) {
image_index = oCapPickup.image_index;
image_speed = 0;
}
with (other) {
instance_destroy();
}
with (oRay) {
{
capcarrying = false;
}
whatcarrying();
}
with (oCapPickup) {
x = 213;
y = 336;
}
with (oGame) {
capsleft -=1;
oCapPickup.image_index = global.bincol;
if (capsleft <=0) {
instance_destroy(oCapPickup);
}
}
}
Code:
with (oRay) {
if (moveX !=0) {
if (place_meeting(x+moveX, y, oCapDrop)) {
repeat (abs (moveX)) {
if (!place_meeting(x+sign(moveX), y, oCapDrop)) {
x += sign(moveX);
}
else {
break;
}
}
moveX =0;
}
}
if (moveY !=0) {
if (place_meeting(x, y+moveY, oCapDrop)) {
repeat (abs (moveY)) {
if (!place_meeting(x, y+sign(moveY), oCapDrop)) {
y += sign(moveY);
}
else {
break;
}
}
moveY =0;
}
}
}