Thread: Diagonal directions?

Results 1 to 2 of 2
  1. #1 Diagonal directions? 
    Registered Member
    jordan641's Avatar
    Join Date
    Apr 2010
    Posts
    1,807
    Thanks given
    70
    Thanks received
    128
    Rep Power
    189
    Hey I had just added directional facing for my NPCs and I came across a problem, diagonal directions such as north-east and south-west,

    what im using right now is like:
    Code:
    					if(npcs[i].walkingType == 1) { //North
    						npcs[i].turnNpc(npcs[i].absX, npcs[i].absY-1);
    					}
    How can I edit this code in red for diagonal directions? Thanks.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Sep 2008
    Posts
    110
    Thanks given
    0
    Thanks received
    2
    Rep Power
    64
    X X X
    X N X
    X X X

    im assuming to turn the npc northwest you would do
    npcs[i].absX - 1, npcs[i].absY + 1
    then southeast would be like
    npcs[i].absX + 1, npcs[i].absY - 1
    etc
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. Diagonal Attacking?
    By craig903 in forum Help
    Replies: 2
    Last Post: 02-19-2012, 06:44 PM
  2. Best way of finding directions
    By Mrquarterx in forum Help
    Replies: 9
    Last Post: 01-10-2011, 10:08 PM
  3. No diagonal attacking
    By brkownzu in forum Snippets
    Replies: 21
    Last Post: 12-24-2010, 12:47 AM
  4. [PI] Diagonal attacking
    By Virtual in forum Help
    Replies: 0
    Last Post: 11-16-2010, 05:04 PM
  5. Google Maps Directions :)
    By Nathan in forum Chat
    Replies: 4
    Last Post: 11-13-2010, 12:29 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •