Reply To: Test Game

HOME Forums Fan Fiction, Games & Art Test Game Reply To: Test Game

#27189
Unknown,Unknown
Participant

You need to move along a line so you will have to end up using some form of a linear equation. All of the standard line equations will always end up giving you rational numbers. This is a problem since you need to specify pixel cooridinates with integers only. If you want to use y = mx + b then you would always end up with at least a few rationals in between the endpoints. You could just round up or down with those cases, but that would make for very jerky line movement, especially when the slope is really close to 0 or undefined.

I think what you need to check out is something called “Bresenhams line drawing algorithm”. I am pretty sure it’s even what Ken used back when he made the first Sierra interpreter. You can find plenty of stuff on Google about it. It’s kind of difficult to understand at first, or at least it was for me anyway. All it does is gives a programmer a way to draw a line on the screen, or move an object along a line path, with only using integer numbers. It is pretty much the standard i think. i hope you find this helpful. let me know if you have any questions about it. good luck.