Tron
This example is simple tron/snake styled game where the players must control the dot without it crossing over the trail it leaves behind. The game uses line intersection to suss out the potential collisions
Related To:
Snake Game (http://www.underwaredesign.com/forums/index.php?topic=3133.0)
Challenge #16 - Snake Game (http://www.underwaredesign.com/forums/index.php?topic=2914.0)
Download
Attached bellow.
Is line intersection faster/better than reading a pixel from the screen (using POINT() or FASTPOINT()) seeing as the background is just RGB(0,0,0) anyway?
Yeah, the normal approach seems to be plot the line and peek points back. But If you're working in pixels, pulling pixels them from the back buffer is awfully slow, and it introduces possibility of leap frog errors. Where the fast moving player can miss (step over) a segment. Obviously, stepping through the points solves that. But that not really the point the example.
why 61.7 fps?
little improvment input
if LeftKey() and Player.Direction<>Direction_Right then Direction=Direction_Left
if rightKey()and Player.Direction<>Direction_Left then Direction=Direction_Right
if upKey() and Player.Direction<>Direction_Down then Direction=Direction_Up
if downKey() and Player.Direction<>Direction_UP then Direction=Direction_Down