User Tag List

Results 1 to 2 of 2

Thread: NPC XY Coordinates

  1. #1
    theGoronKing
    Guest

    NPC XY Coordinates

    I believe it is possible to change the XY coordinates of an NPC, all I ask is what is the variable called, and is it possible to manipulate it?

    EDIT: Never mind, but is there a way to retrieve the NPC's direction/distance from Link?

  2. #2
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,433
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.1%

    Re: NPC XY Coordinates

    There's no built-in function for that. Here's the distance function, though, in case you don't know it:
    Code:
    float Distance(float x1, float y1, float x2, float y2)
    {
      return Sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    }
    Then the distance is just Distance(Link->X, Link->Y, NPCPtr->X, NPCPtr->Y).
    As for the direction... Well, there are a few different ways you could find that, depending on what you're trying to accomplish. If you just need up/down/left/right, the easiest way is just to compare the X and Y values. If you need a precise angle, though, you'll probably have to bring trigonometry into it.
    Hm... I'm pretty sure there's no arctangent function at the moment, though.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social