L
Luxxum
Guest
Hello!
I'm working on making a pushable block using the following code:
This is a script that would run after a colllision script on the player character. I'm basically just using my collision script to deal with all interactions with the block other than when the character is on the ground and directly next to the block.
As far as I can tell, the Instance_position function isn't working. I've added a
to the character's draw, and nothing shows up (but other things in the draw event do).
Any Idea what I might be doing wrong?
I'm working on making a pushable block using the following code:
Code:
if place_meeting(x+sign(hsp_precollision),y,pushblock_obj) and grounded = 1
{
pushblockid = instance_position(x+sign(hsp_precollision),y,pushblock_obj)
global.movex = hsp_precollision
with (pushblockid)
{
if place_meeting(x+global.movex,y,moving_block_parent)
{
for (n = 0; n<= abs(global.movex); n = n + 1)
{
if place_meeting(x+(n+1)*sign(global.movex),y,moving_block_parent)
{
character.hsp_final = n*sign(global.movex)
x = x + n*sign(global.movex)
break
}
}
}
else
{
global.movex = 2*sign(global.movex)
x = x + global.movex
character.hsp_final = 2*sign(global.movex)
break
}
}
}
As far as I can tell, the Instance_position function isn't working. I've added a
Code:
draw_text(x-32,y-160,pushblockid)
Any Idea what I might be doing wrong?