Movement in CoSpaces

So if you’ve ever watched Squid Games you would know their is a game with a doll, and when she turns around and your moving, you die. I’m making this in CoSpaces and I’m wondering if theirs a way to make it so if the doll “sees” you moving the scene restarts. Thanks in advance!

3 Likes

Hi @Jurassic_P_Ark,

There will be a number of ways to make this work. Here’s one way - remix & look at the code in Scene 6:

You can see they’ve overridden the default WASD key movement to add in checks.

Another way to do it would be to constantly store your position & direction in variables, and compare the values to what they were x milliseconds ago, to determine whether you are moving or not.

Hope this helps! Let me know if you have any further questions about this. If this solves your problem, please mark this post as the Solution.

Many thanks,
Geoff @ TechLeap

4 Likes

Here’s another way to do it (for sure not as professional as @techleapnz answer) and just if you have premium coblocks.

You can attach a triangle to de doll eyes, set the opacity at 40 and make it red (for example).

The code would be (run parallel (when the triangle collides with the camera, restart the scene”) (always (turn doll 360° in 5 seconds)))

Do this option just in case you have troubles with code, is better work with variables.

Hope it helps!!

3 Likes

How would I code it so that it knows where I am, I don’t know what exact code blocks I should use. I remixed that game, and it was for computers, I’m using an iPad.

4 Likes

That would not work, because the doll is a lot taller than the camera, but thanks!

4 Likes

Good point, @Jurassic_P_Ark - I’m unsure whether the movement controls on tablet/mobile can be accessed. You could try changing the WASD keys in the event blocks to arrow keys, to see if that fixes the issue.

There is a way to figure out if something has line of sight, but it’s too complex for this situation.

3 Likes

I just made the camera stay in place, then I attached text that said move, and when you click it, you move forward, thank you for your help!

4 Likes

i am totally new to coSpace and im unsure how the codes works but here is a way i will attempt it.

  • i will attach a cylinder to me( player ) as a child object

  • make the cylinder very tall and transparent so camera can see through

  • attach a ray cast to face of the doll( a thin transparent cylinder rotated to point forward)

  • by default the cylinders will be disabled , so only when WASD or the Arrow keys are pressed the cylinders will be enabled

  • so now i will check for collision between the two cylinders

so its only when you MOVE ( press keys) that the cylinders will be enabled to collide

3 Likes


2 Likes

This is some code you can use if you don’t want to put a cylinder or any block of sorts, you can change it fit your needs. Hope this works.
By the way photos are backwards, the one at the top is the second photo.
Also I have the code for mobile, there’s a couple games you can remix on CoSpaces if that would be easier than just photos.

3 Likes