How do I move case by case?

0 favourites
  • 5 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
  • hi, in my app i moev my sprite in a map where i have 9 squares

    the sprite is allways centerd (pin to) every square

    for the movement i use a score, every time i move, 1 point is removed when the score is at 0 the player cant move.

    the problem is, i can move to anywhere in those 9 squares, HOW to move allways from the current position to only the next square close to the actual position?

    i use the mouse object for clicked objects

  • What do you mean, so you are in the middle of a 3x3 grid and you can only move to one of the 8 squares around you at a time and to do this you click on it then you move to that square?

  • no this is an example, if i have a map with 10x10 squares and my variables for "moves" is 6 then i can move 6 times, so i want to move only from case to case 1x1 if im clear, and not for exampel if im at teh case 1 and i click on the case 6 the character move to directly

  • Yeah similar thing, the important factor is it's only possible to move to one of the 8 squares surrounding you, that's what I wanted to confirm. There's a few ways to do it I guess but I setup this kind of detection for when I had to stamp down rides in a roller coaster tycoon type thing. I had the centre object have a square attached that is slightly bigger than the square it is on. This then overlaps the 8 surrounding squares slightly. Then you put in events to say that the squares it is overlapping are 'clickable', you could change the opacity of the clickable squares for debug purposes to see what is clickable. Then you have a check for when clickable square is clicked, move player to here. That should just work. You'd obviously have to put in some checks so that the middle square cannot be accepted too and fix some other minor bugs around it during gameplay.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • imothep85 did you give it a go? or find a different method?

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