Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Enemy follow Player in Isometric game 2D

Discussion in 'Scripting' started by LTLeonardo, Jan 1, 2016.

  1. LTLeonardo

    LTLeonardo

    Joined:
    Nov 13, 2015
    Posts:
    20
    Hello!

    My game is 2D isometric (seen from top to bottom).

    I need the enemy follow the player only X and Y, the enemy cannot move diagonally.

    How do I?
     
  2. LTLeonardo

    LTLeonardo

    Joined:
    Nov 13, 2015
    Posts:
    20
    For those who did not understand my question, I want the enemy to follow the character without walking diagonally, ie move the X and Y plane
     
  3. apsdsm

    apsdsm

    Joined:
    Sep 26, 2013
    Posts:
    56
    There are many, many, many ways that you could achieve this, but we can't really tell you any of them if we don't see some of your code to see how far you've already come.

    Here's how I did something similar recently - though the example is in C++ and not for Unity, the logic is sound enough:

    https://github.com/apsdsm/AttackOfSlime/blob/master/Classes/Slime.cpp
     
  4. LTLeonardo

    LTLeonardo

    Joined:
    Nov 13, 2015
    Posts:
    20
    His answer did not help me, but this tutorial solved all my doubts: -D

    http://unity3d.com/pt/learn/tutorials/projects/2d-roguelike-tutorial
     
  5. apsdsm

    apsdsm

    Joined:
    Sep 26, 2013
    Posts:
    56