# Character not detecting position on square tile

Hi all and many thanks in advance for any help…

I am trying to make an interactive snakes and ladders game ( a class assignment and i’m the teacher) and cannot for the life of me get the character to co-operate. What i’d like them to do is if they stop on the coloured square or on the “box” then they follow the path. Stopping before or passing through does nothing. I have tried implementing it with an “If” statement but it never seems to trigger. Click on the person (me, I like red!) to make them move.

Looked online but no luck with finding similar problems.

Out to the brains trust and here is my simple test world. I have tried a heap of other things but no luck.

Many thanks

Chris

You could add the movement on path straight after the regular movement. That will chain actions:

Hope that helps.

The bit i’m struggling with is getting the person to detect landing on the yellow square but not using collision code. If i use collision then as soon as it hits the block it follows the path. i want the person to move the distance and when it lands on the square follow the path. Just like if you were to play the real Snakes and Ladders…

Still cracking on so if i come up with a solution i’ll post it here!

Chris

OK… update here.
Been messing around and it looks like an IF statement cannot detect an interaction. Ie person walking to the wall and stopping at it.
Back to the drawing board.

If statement checks the exact equality of the positions which is not easy to use. You could create a formula and calculate possible distance, but there is an easier way of doing it:

You can check when Person collides with Square. and when they collide, move on path:

Feel free to remix the space and explore it

Hello again Nickolay…

I did have that logic and it works fine. The problem is when i introduce a dice and have the person move the number it picks. Sometimes it will be more than the distance to the wall and if this is the case then the person continues on the initial track, passing right through the object.
ie… person starts on square1… wall at square 3. Initial roll is 1 so person moves one space. If a 2 or higher is rolled next the person move forwards to the correct number. But, if a 1 is rolled they land on the space where the ladder base is and proceeds up the path…

hope this helps to clear my flawed logic up!

Chris

You could turn off the collision blocks logic when the person is walking following the dice number.

Or you could slightly raise the person when he moves (to perform a jump) and land him on the end of the dice movement. So visually it will be clear, why he walks on the ladder only at the end. And onCollision block would not trigger.

Another approach is to make “trigger squares” lower when he walks.

Hmmm… i like the idea of lowering the squares or elevating the person. Will have a play with them. I did manage to do this but it works to detect the collision but if the person goes past the wall it still keeps the follow path logic going.

This is fun… normally work in C# and VB so is good to get back to blocks. I know CoSpaces works with script but putting myself in the students shoes!

Thanks for the help

1 Like