Forum rules - please read before posting.

Fake 360 room in 2D game


Hi All, I was wondering if anyone has a better solution to faking being able to walk in a circle around a room.

In the vid you can see i'm using a hit area and teleport to move the player from one side of the room to the other but that means that other hit area's are un-selectable depending on which side you are walking to / from. And you get that point where the player ends up standing still after teleport. It works but it's not seemless and I worry that once hit/area's characters / puzzles etc are added that i'll cuase other awkward things to happen.

I'm by no means a Unity expert so if there's some obvious unity thing i've missed please point it out!!

You can tell which side you're on from the floating book - ignore the hit area names they're just from an earlier scene I duplicated for this test.

THANKS!!

Comments

  • Would help if video wasn't set to private, right :D .
    Done
  • Welcome to the community, @DutchyB.

    Interesting problem, though not one that's too easily solved - you're right to assume problems when you add other characters and puzzles.

    I would start by ensuring that no Hotspot or NPC is large enough that it can be viewed from both the left and right sides of the screen.  Since you can then assume that a Hotspot will only be on-screen at one point, you can then look into teleporting your Hotspots in the same way that you do your Player.

    Some custom scripting will definitely be required, though I would think the difficulty would be in the approach, rather than the implementation - since it's probably not going to amount to much more than teleporting things around and offsetting vectors, but when these things are doing are what's key.

    I would actually recommend removing Hotspots / puzzles etc for now, and just get the navigation and player-teleporting working correctly first.  Teleporting the player is a good idea, but you also need to update where the player is walking towards - since the area that they clicked on will also need to be teleported.

    Let's say the background is 10 units wide.  If the player walks off the right side, you can call:

    Vector3 playerPosition = AC.KickStarter.player.transform.position;
    playerPosition.x -= 10f;
    AC.KickStarter.player.transform.position = playerPosition;

    to shift the player 10 units to the left.  But to shift his destination, you'll need:

    Vector3 playerDestination = AC.KickStarter.player.GetTargetPosition ();
    playerDestination.x -= 10f;
    AC.KickStarter.player.MoveToPoint (playerDestination);

    This code can be moved to a custom script function and invoked using the Object: Call event Action in your right-hand-side Trigger.  Be sure to set the Trigger to Run In Background, so that the cursor doesn't flicker away while it runs.
  • Thanks I'll give that a crack, in the mean time using the action list creator and some precise placement of markers I've managed to get a nice smooth transition (with the player not being able to interrupt the walking during that transition).

    It looks smooth so as a backup it'll work I'll just need to place something in scene that makes sense to the player as a reason for the player character not stoping at that point - e.g. some stairs / bridge / etc.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.