X,Y to XX,YY Location Countdown Problem [SOLVED]
Posted: Fri Nov 09, 2007 1:00 am
Trying to make a smooth calculator to figure points along a line so I can shoot what I want and make a 20 (or whatever FPS I want) point target line:
It is a maths thing. Any help would be appreciated. 
Code: Select all
;
targetx = 24 ; end location
targety = 14
shootx = 157 ; start location
shooty = 104
; this works great with the following values:
;targetx = 24 ; end location
;targety = 14
;shootx = 157 ; start location
;shooty = 104
; or any values where the target is smaller than the shooter
; but not the other way around...
;what If the values were reversed... I cannot figure out
;how To create an even path no matter what the values are
Steps = 20 ; number of steps required to go from shoot to target
Dim spotx(21) ; array to hold x position
Dim spoty(21) ; array to hold y position
xx = shootx / Steps
yy = shooty / Steps
Debug "Starting"
For number = 0 To Steps ; stepladder was set to 10 initially... I wanted to be able to change this value later
hopx = number * xx ; variable to subtract from shooter
hopy = number * yy
placex = shootx - hopx
placey = shooty - hopy
spotx(number) = placex
spoty(number) = placey
Debug placex
Debug placey
Next
End
;