- #1
Dave2041
- 2
- 0
Homework Statement
in checkers you jump over the enemys piece and land on a square after that.
i'm making this game in c++ using sdl~
i just want to know how to get the square i have jumped over using the end square and start square locations
Homework Equations
The Attempt at a Solution
where sx, sy = start x,y and ex, ey and the end position x,y
disty = ey - sy;
distx = ex - sx;
sx+distx/2 - should be the x val of the square i jumped over
sy+disty/2 - should be the y val of the square i jumped over
is this correct? i tryed it on paper and it seems to work one way but not another, jumping upwards for example gives me a negative number for example, any ideas appreciated :(
should be simple, perhaps i have been looking at this for too long lol.
thanks in advance