Hit detection, or collision detection is a technique used by TI-Basic programmers to prevent one or more pixels from moving through another pixel or set of pixels.

Hit detection is possible both on the Homescreen and Graph screen.

Home ScreenEdit

  :              :
  : :::::::::::: :
  : :          : :       // this is actually 1 entire line
  : : :::::::: : :       // its shown this way just to show how the screen would look
  : : :::::::::: :
  : :            :
:Repeat A=5 and B=13  
:Repeat Ans
:Output(A,B," ​           //  one space after the "
:A+Ans(" "=sub(Str1,16(A-1+Ans)+B,1→A
:B+Ans(" "=sub(Str1,16A-16+B+Ans,1→B

This program draws a maze on the Homescreen and uses hit detection to stop you from moving through the walls.

Graph ScreenEdit

:Horizontal Ymin
:Horizontal Ymax
:Vertical Xmin
:Vertical Xmax
:Repeat not(pxl-Test(Y,X)) and not(pxl-Test(Y+1,X)) and not(pxl-Test(Y,X+1)) and not(pxl-Test(Y+1,X+1
:Repeat not(pxl-Test(Y,X
:While K≠105
:Repeat K
:If Z=5500
:Y-(Ans=25 and not(pxl-Test(Y-1,X)))+(Ans=34 and not(pxl-Test(Y+1,X→Y
:X-(K=24 and not(pxl-Test(Y,X-1)))+(K=26 and not(pxl-Test(Y,X+1→X

First the program draws a border around your screen.

Second it uses hit detection to draw 20 boxes that do not overlap.

Third it places a controllable dot on the screen that will not move through any of the boxes.

Thanks to hit detection you cannot move through any of the boxes or the outside border of the screen. You can end the program manually by simply pressing the Enter key.

Also, if you stop doing anything long enough the program will end on its own.

No need to worry if you leave it running =)

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.