infiniteyield
Member
Okay, so I'm trying to be able to pull blocks. I have a pull state for the player character that can only trigger if they're in collision with the object that I want to pull. I have the player moving freely but all push/pull objects move along a grid. When I push the blocks, they move along the grid and have a delay before they move (which is what I want) that I've accomplished through timers. At first I tried to use alarms, but it was far too annoying having to manage a bunch of tiny events , so, yeah, timers.
this is the collision I have with the par_pushblock. (I want it to be able to have many different sprites which is why it's a parent object)
I'm assuming that the collision with the block from above it is overriding whatever the pulling does. I tried disabling collisions with the player when they enter the pull state but then it just keeps the pull state and the collision can't check because of the collision being disabled.
This is really stumping me
this is the collision I have with the par_pushblock. (I want it to be able to have many different sprites which is why it's a parent object)
and this is the script the timers are triggering.var timer_frames = 31;
if (place_meeting(x+1, y, par_pushblock)) && right {
with (other) {
timerR -=1
if timerR <=0 {
MoveBlock(directions.right);
}
if timerR <=-1 {
timerR +=timer_frames
}
}
}
if (place_meeting(x-1, y, par_pushblock)) && left {
with (other) {
timerL -=1
if timerL <=0 {
MoveBlock(directions.left);
}
if timerL <=-1 {
timerL +=timer_frames
}
}
}
if (place_meeting(x, y+1, par_pushblock)) && down{
with (other) {
timerD -=1
if timerD <=0 {
MoveBlock(directions.down);
}
if timerD <=-1 {
timerD +=timer_frames
}
}
}
if (place_meeting(x, y-1, par_pushblock)) && up {
with (other) {
timerU -=1
if timerU <=0 {
MoveBlock(directions.up);
}
if timerU <=-1 {
timerU +=timer_frames
}
}
}
Anyways, long story short: the problem I have is that when I write code that checks for a collision with the player while the sprite index is the pulling sprite, neither the block nor the player move. I tried using show_debug_message(timerU) for the pulling but it doesn't even appear.var dir = argument0;
var components = global.components[dir];
var dx = components[0];
var dy = components[1];
if (state == states.still) {
x_from = x_pos;
y_from = y_pos;
x_to = x_pos + dx;
y_to = y_pos + dy;
x_pos = x_to;
y_pos = y_to;
state = states.pushed;
}
I'm assuming that the collision with the block from above it is overriding whatever the pulling does. I tried disabling collisions with the player when they enter the pull state but then it just keeps the pull state and the collision can't check because of the collision being disabled.
This is really stumping me