- Scrollin' Mountains mini-game (sidescrolling in TI-Basic)
- 20 Mar 2016 11:51:50 am
- Last edited by grosged on 14 Apr 2016 04:21:16 pm; edited 2 times in total
Hello there!
As I mentionned to Lirtosiast earlier, It's sometimes possible to write uncommon routines in TI-Basic.
By the way, here is a mini-demo of a sidescrolling game I totally wrote in TI-Basic.
(see original post : https://tiplanet.org/forum/viewtopic.php?f=11&t=17866 )
Actually the screen does not shift : using line( commands to draw/erase make the illusion
The aim is just to move this kind of "ufo" and avoid the mountains & valleys.
For now, the game 's during a few minutes and lives are infinites.
In order to have a more sensitive keyboard, I found a way :
when you run the game, you let the key [del] always pressed.
Then you just press another key to move up "a la flappy bird".
This program is 6mhz compatible (of course, you'll have better results on 15mhz calculators)
I propose to explain the trick required to sidescroll in Basic:
Imagine you draw a diagonal line like a slash /
Then , just on its left, you draw another one ,one more ...
Meanwhile, on the opposite-right side you erase with an anti-slash \, and you keep on erasing , going to the left too.
The result will be a mountain moving to the left!
/ \
Here are the sources ( http://www.cemetech.net/programs/index.php?mode=file&path=/83plus/basic/games/scrollingmountainsV5.zip )
SCROLLV5 (main program) :
Code:
SOUSPROG :
Code:
and finally, SPRG2 (explosion) :
Code:
As I mentionned to Lirtosiast earlier, It's sometimes possible to write uncommon routines in TI-Basic.
By the way, here is a mini-demo of a sidescrolling game I totally wrote in TI-Basic.
(see original post : https://tiplanet.org/forum/viewtopic.php?f=11&t=17866 )
Actually the screen does not shift : using line( commands to draw/erase make the illusion

The aim is just to move this kind of "ufo" and avoid the mountains & valleys.
For now, the game 's during a few minutes and lives are infinites.
In order to have a more sensitive keyboard, I found a way :
when you run the game, you let the key [del] always pressed.
Then you just press another key to move up "a la flappy bird".
This program is 6mhz compatible (of course, you'll have better results on 15mhz calculators)
I propose to explain the trick required to sidescroll in Basic:
Imagine you draw a diagonal line like a slash /
Then , just on its left, you draw another one ,one more ...
Meanwhile, on the opposite-right side you erase with an anti-slash \, and you keep on erasing , going to the left too.
The result will be a mountain moving to the left!
/ \

Here are the sources ( http://www.cemetech.net/programs/index.php?mode=file&path=/83plus/basic/games/scrollingmountainsV5.zip )
SCROLLV5 (main program) :
Code:
CoordOff
GridOff
AxesOff
LabelOff
ExprOff
0➜Xmin:0➜Ymin
.5➜ΔX:.5➜ΔY
ClrDraw
Text(0,5,"* SCROLLIN' MOUNTAINS *
48➜A:Ans➜E:Ans➜I:Ans➜M
DelVar BDelVar FDelVar JDelVar N
2randInt(1,7➜Y
48+Y➜C:Ans➜G:Ans➜K:Ans➜O
Ans➜L2(1
Y➜L3(1
Ans➜D:Ans➜H:Ans➜L:Ans➜P
1➜Q:1➜R:1➜S:1➜T
100➜dim(L2
Ans➜dim(L3
For(U,2,Ans
Repeat V and -V<Y and Y+V<23
2randInt(-7,7➜V
End
32+16U+abs(V➜L2(U
Y+V➜L3(U
Ans➜Y
End
1➜W
1➜θ
28➜Y
Repeat W>96
prgmSOUSPROG
θ+47➜A:P➜B
L2(W➜C:L3(W➜D
B<D➜Q
prgmSOUSPROG
θ+47➜E:D➜F
L2(W➜G:L3(W➜H
F<H➜R
prgmSOUSPROG
θ+47➜I:H➜J
L2(W➜K:L3(W➜L
J<L➜S
prgmSOUSPROG
θ+47➜M:L➜N
L2(W➜O:L3(W➜P
N<P➜T
End
SOUSPROG :
Code:
Y
For(θ,θ,θ+15
Line(A-θ,B,C-θ,D,Q
Line(E-θ,F,G-θ,H,R
Line(I-θ,J,K-θ,L,S
Line(M-θ,N,O-θ,P,T
If pxl-Test(64-2Ans,48:prgmSPRG2
Pt-Off(24,Ans,2
Ans-1+2not(getKey
Pt-On(24,Ans,2
End
Ans➜Y
W+1➜W
and finally, SPRG2 (explosion) :
Code:
Pt-Off(24,Ans,2
Line(A-θ,B-1,C-θ,D-1
Line(E-θ,F-1,G-θ,H-1
Line(I-θ,J-1,K-θ,L-1
Line(M-θ,N-1,O-θ,P-1
Pt-On(24.5,Ans-1.5+not(fPart(.5Ans
StorePic 0
For(U,0,9
Pt-On(24.5-rand,Ans+.5-rand,randInt(2,3
Pt-Off(24.5-rand,Ans+.5-rand,randInt(2,3
End
ClrDraw:RecallPic 0
Pt-On(23.5,Ans-1.5+not(fPart(.5Ans
θ-1➜θ:28