News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Tron

Started by kevin, May 22, 2011, 05:22:33 AM

Previous topic - Next topic

kevin

  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
  Challenge #16 - Snake Game


Download
 
    Attached bellow.

buggage

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?

kevin


   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.   
 

ATLUS

#3
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