Attaching a Sprite to another Sprite

So I’m building a top-down shooter, but I want the top of the sprite to be connected to another one. This is so the entire sprite doesn’t hit a wall and only the bottom half.


To do that I want it to follow the position of the bottom and stay above it. The thing is I don’t know how to do that and I want to keep it in blocks. Any help?

2 Likes

forever loop
spriteA.x = spriteB.x ( + xOffset )
spriteA.y = spriteB.y ( + yOffset )

This situation kind of depends on how you are using the sprite! My solution would be to have a forever block that sets the top sprite’s position to just above the bottom one’s, but depending on how you want the two pieces to behave, that might not work.

you could use set x and y blocks
heres a example of how you could do this

So I used your code and it worked but it would glitch back and forth when you hit a wall.
Untitled video - Made with Clipchamp

Any idea for what happening here?

no sorry, could you send a link to the game i could try find out

1 Like

got it fixed. I just had the position set to 0,0 on a loop.

ohh okay good job, sorry i was offline and did not see the link so i couldn’t help

I don’t think you fixed it properly. I walked under a tile that was lower than the robot. Then the robot got kinda squished
It’s kinda hard to see on the picture

Just test it for yourself