Help with point and click

Hey,

For my first real Unity project I’m trying to make a 2D point-and-click game similar to Curse of Monkey Island.
I’ve got some really basic movement but I’m wondering how I can make the player bigger the closer they get to the bottom of the screen? This is to give the illusion of depth. :slight_smile:

I also want to use Edge Colliders to limit were the player can go. Any idea how I’d implement that?

I have got some past game dev and programming experience but I’m completely new to Unity and C#…

Any ideas?
Cheers :slight_smile:

you can convert the players position into viewport point with WorldToViewportPoint

then you can change the size from the player depended on Y-value from the viewportpoint
something like:

void Update ()
    {
        Vector3 scrPos = Camera.main.WorldToViewportPoint(transform.position);
//the change-formel is depended on your game.
        transform.localScale = Vector3.one * (1 - scrPos.y);
    }

It would also be possible to create a nav-mesh, set the camera to orthographic, and angle it downward toward the nav-mesh. (for path-finding and collision detection) As to the character scaling, that is relatively easy. Just find an axis you can key to, and cook up a quickie script that has two float values, one for minimum scale and one for maximum scale. Then have the scaling of your character get updated based on its relative distance to the camera and the limits you defined in your script.

Can you use a NavMesh in a 2D game?

The NavMesh system is not rigged up by default to support 2D, but that doesn’t mean that it can’t be used. The sticking point some people run into is simply the default position of the camera for 2D games. NavMesh is designed to treat the scene as the Y axis being the “top-down” view, while the default 2D camera in Unity treats the Z axis as the “top-down” perspective. But this is just an arbitrary designation. There’s nothing stopping you from simply grabbing the 2D camera in the Unity scene and re-positioning it and rotating it to look down on a NavMesh. At that point you can set up your scene to bake a NavMesh with a pretty much 1 to 1 2D perspective. Ditto for any Sprites you create. Even if their default orientation has them facing the wrong way, that is easily addressed.

And that’s just one basic example. You could also just create a quickie class that translates NavMesh 3D coordinates to 2D coordinates, and then link your 2D sprites to 3D Empty objects that move around the NavMesh. That approach would work just fine, and wouldn’t require changing up the scene at all.

You don’t need to rotate scene or camera, you will brake colliders and physics
Rotate NavMesh instead.
GitHub - h8man/NavMeshPlus: Unity NavMesh 2D Pathfinding - here how its done
GitHub - h8man/RedHotSweetPepper: 2D Navigation Click-To-Move Top Down Run and Chase Game "RedHotSweetPeper" - and here is point and click demo