How do I move case by case?

Get help using Construct 2

Post » Sun Sep 18, 2016 8:40 pm

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
B
37
S
15
G
7
Posts: 1,680
Reputation: 9,612

Post » Sun Sep 18, 2016 10:01 pm

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?
B
46
S
16
G
74
Posts: 2,089
Reputation: 44,187

Post » Sun Sep 18, 2016 10:11 pm

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
B
37
S
15
G
7
Posts: 1,680
Reputation: 9,612

Post » Sun Sep 18, 2016 10:18 pm

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.
B
46
S
16
G
74
Posts: 2,089
Reputation: 44,187

Post » Mon Sep 19, 2016 11:32 pm

@imothep85 did you give it a go? or find a different method?
B
46
S
16
G
74
Posts: 2,089
Reputation: 44,187


Return to How do I....?

Who is online

Users browsing this forum: sean080, Yahoo [Bot] and 18 guests