R
rmcdra
Guest
Trying to make a block that you can push. It moves a set number of points (16 points) and then stops, until you push it again. tried using the move_towards_point function but because the point I want it to move to is variable, it doesn't stop moving when it reaches the point. I've included my code attempts so far:
In this code the object doesn't move
In this code the object moves but doesn't stop moving
Any help would be welcome
In this code the object doesn't move
Code:
if (sprite_index == spr_walking_left)
{
for (l = 0; l < 17; l++)
{
obj_move_block.hspeed = (1/16)*l - 1;
}
}
Code:
if (sprite_index == spr_walking_left)
{
obj_move_block.x -= 1;
obj_move_block.hspeed = -1;
if (obj_move_block.x % 16 = 0)
{
obj_move_block.hspeed = 0;
}
}