Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

Swapping an objects exact position

edited February 2018 in How To
I am trying to create a sliding puzzle game and this involves swapping a puzzle piece with a blank space (in this case an invisible object) I am using extractors to determine the position of each piece then destroying them and spawning them at each others position, however they aren't spawning at the correct position. I believe this is because the extractor is giving me pixel coordinates as opposed to grid coordinates. this is making the pieces not to swap with each other but to move to different spaces. The swap is activated by clicking the blue square

There are only two pieces on the game board at the moment as I am trying to get the concept correct before finishing the board. At the moment the blank space is represented by the Red square and the puzzle piece by the blue square. The green square is a sort of control centre (my attempt to keep things neat and tidy) hopefully my code isn't difficult to understand but I'm happy to explain any questions you may have.
any help is appreciated

Game Link:


  • @qwerty12345 - It looks like one of your "x" extractors isn't set properly inside the green block.
  • @grazer Thanks, that seems to have done the trick for now. not sure how i missed that but that you for pointing that out, i'd been trying to figure it out for hours
Sign In or Register to comment.

| make games in your browser
@ 2017, All rights reserved.

Contact us

Get In Touch