Search Unity

How to implement this simple(IRL) puzzle?

Discussion in 'Scripting' started by jiraphatK, Mar 13, 2020.

  1. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    298

    I am completely stuck. please nudge me in the right direction.

    I had tried using spline path and projected world position on it. I can let the player move along the path but if they drag the handle too fast or perpendicular to the path direction, the handle will skip to another nearest point on path entirely. I also can't create a spline that split into intersection.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,686
    Might be best implemented as a grid, kind of like how PacMan was originally implemented. There's tons of discussions of that... maybe just look for pacman-like motion. The main constraint is your slots have to be full squares in a grid, and motion becomes an iterative movement along an axis, one cell at a time, and if the user attempts to move it really fast, you just "snag" the object as far along as it can go.

    This one is more specially about the ghost AI but it's an interesting read so I include it, even if it isn't directly applicable to your problem:

    https://gameinternals.com/understanding-pac-man-ghost-behavior