-4

So, i have a problem

i found out that: if my position is [7][3] and the object is on [2][8] the sum of the x,y is the same for both of them. ex: 7+3 = 2+8 but i'm stuck on finding the same thing on the other side

if you don't understand what i mean i can try to explain again

  • Can you explain? Also what is your error and do you have code? – Denis Radinski Feb 11 '16 at 08:11
  • This doesn't really have anything to do with C++ or even arrays - it's to do with geometry. If you are at (x,y) and the object is at x-1,y+1, then indeed the sum of the coordinates is unchanged. Are you also interested in an object at (x-20,y+20)? If so,consider the difference between the coordinates. – Martin Bonner supports Monica Feb 11 '16 at 08:12
  • i know this, i'm trying to find the way of finding (x-1,y-1)(x-2,y-2) and so on – Martin Repa Feb 11 '16 at 08:14

1 Answers1

0

It is somewhat unclear what exactly you are looking for, but maybe this helps:

All 2D coordinates a,b which are diagonally offset from x,y meet the condition

abs(a-x) == abs(b-y)
mindriot
  • 5,413
  • 1
  • 25
  • 34