Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Ok I'm pretty flummoxed how do you do that bouncing ball thing on the intro screen ? It's not tile based movement and there is no trail or flickering mighty impressive :)

Thank you.  It's an OVER 1, PLOT statement to draw and erase it.

The (horrible, uncommented) code that is doing that bit is -

66 OVER 1:LET e=48: LET f=138:LET ea=1:LET fa=2:FOR x=1 to 156:PLOT e,f:LET eo=e:LET fo=f:LET e=e+ea:LET f=f+fa:LET fa=fa-0.1
67 IF f<16 THEN LET fa=-fa*0.8:LET f=16
68 LET i$=INKEY$: if i$="" THEN PLOT eo,fo: NEXT x:GOTO 66

e,f are the co-ordinates it's PLOTted at, and in each step of the loop ea and fa are the acceleration added to e and f respectively.  Each step fa is reduced (due to 'gravity).

if the height is less than 16, fa (vertical acceleration) is reversed, and reduced to 80% of it's previous value.

if nothing is pressed then the the old position of ball is erased (eo, fa) and the we loop around.


This is (essentially) the same 'physics' done in game, but with some fixed parameters.

The gravity part I understand no problem (physics teacher), the trick is the OVER 1 but how do you not leave a trail on the intro screen I don't see in the code below where you erase the trail.

It's my PLOT eo,fo in line 68 which is at the same co-ordinates as the PLOT e,f was a couple of lines earlier.  Because of OVER 1 it's removing that pixel (OVER 1 meaning plotting is toggling the state of the pixel when it PLOTs).

P.S. Physic degree here.  (High five for gravity).

F=mg ftw :)