How do I make sprite move to empty space

0 favourites
  • 4 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • here is problem that i want solve:

    on click -> move object-> empty space next to object

    i want sprite move exactly as ''picture puzzle'' gadget on windows 7

    there is no behavior witch can make this simple and i don't have idea hot to do it.

  • There's a few ways you can do it.. it's not that simple.

    I'd set up some sort of invisible grid that underneath each puzzle tile. Number the grid so you can figure out which pieces are eligible for moving since the empty space will be different each time. Then you need to figure out which direction the piece has to move. Once you have all that then you need to move the piece --if you don't know how to do that I would suggest creating a test project just to figure out how to move a sprite from point A to point B - use Set Position or Bullet Behavior - you just need to figure out how/where to stop the sprite (again an invisible grid would work great here).

  • thanx for answer.

    im still struggling with that and need some help; in last 3 days i was try many options but none of them work.

    it should be more easyer if there is way to make movement like:

    "on click" -> "sprite1" = - "sprite1" set direction to "empty space"

    - "sprite1" move for 100px over 1 second

    so after that sprite1 will be on that empty space.

    bullet behavior making weird movement, when it finds angle (for example he need go 100 px up), it always move 1 px on left when going up.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If you're happy with having squares instantly swapping positions all you have to do is check if a square is a square length away. If it is just swap positions of the objects. All in all 1 event for the moving and another for randomly scrambling it yet still being solvable,

    https://dl.dropboxusercontent.com/u/542 ... 6tile.capx

    For a more caviar version here's one I did a while back.

    viewtopic.php?f=147&t=64493&p=551976&hilit=9tile#p551976

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)