-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path1386.bas
More file actions
179 lines (158 loc) · 3.79 KB
/
Copy path1386.bas
File metadata and controls
179 lines (158 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
rem shuffle v3.bas SmallBASIC 0.12.2 [B+=MGA] 2016-02-08 test new charging system for puck
rem Shuffleboard test by Johnno 2016-01-26
rem This is my modified 'friction on ice' program.
rem Very crude version of Shuffleboard - One Player.
rem Press and hold the SPACE key to release.
rem Press too long and you lose a life.
rem
rem 2016-01-26 [B+=MGA] testing on NOOK
rem 2016-01-27 modified to fit screen width
rem
rem 2016-01-27 {MGA fork} convert all Y dimensions in terms of text height
rem ''''''''''''''''''''' convert lives to 10 shots then game over (added with stripe)
rem ''''''''''''''''''''' add mouse support, trim down code
rem 2016-02-08 Modifying puck charging system modified pen on/off and delays
rem '''''''''''''''''''' better ending?
const yellow = rgb(255,255,0)
const darkyellow = rgb(220,220,80)
const magenta = rgb(255,0,255)
const cyan = rgb(0,255,255)
const red = rgb(255,0,0)
const grey = rgb(128,128,128)
const blue = rgb(0,0,255)
const darkblue = rgb(0,0,128)
const orange = rgb(255,128,0)
const black = rgb(0,0,0)
const green = rgb(0,255,0)
const white = rgb(255,255,255)
const limit = xmax*.980
const th=txth("By")
const spacebar="Tap/Click/Drag/SPACEBAR(PC)... not too long"
cls
posX = th
posY = 7*th
score = 0
lives = 10
shot = 0
XVel = 0
'Main ==================================================
pen on
while lives>0
updateStats
updateBoard
updatePlayer
updateScore
showpage
delay 15
wend
pen off
updateStats
Gameover
pause
sub center(lineNum,txt)
at xmax/2 - txtw(txt)/2,linenum*th : ? txt
end
sub stripe(tlXfracXmax)
rect xmax*tlXfracXmax,2*th,xmax*tlXfracXmax+.005*xmax,11*th filled
end
sub updateStats
cls
color yellow,black
center(14,"Score: " + str(score))
color green,black
center(16,"Shots Left: " + str(lives))
color white,black
center(18,spacebar)
end
sub updateBoard
rect 0,0,xmax,2*th,blue filled
rect .25*th,.25*th,xmax-.25*th,1.75*th,darkblue filled
rect 0,11*th,xmax,13*th,blue filled
rect .25*th,11.25*th,xmax-.25*th,12.75*th,darkblue filled
color white,black
stripe .2
at int(xmax*.25),3*th: print "10"
color grey,black
stripe .3
at int(xmax*.35),3*th: print "20"
color orange,black
stripe .4
at int(xmax*.45),3*th: print "30"
color blue,black
stripe .5
at int(xmax*.55),3*th: print "40"
color green,black
stripe .6
at int(xmax*.65),3*th: print "55"
color cyan,black
stripe .7
at int(xmax*.75),3*th: print "75"
color magenta,black
stripe .8
at int(xmax*.85),3*th: print "100"
color yellow,black
stripe .9
at int(xmax*.95),3*th: print "-25"
at int(xmax*.15),3*th: print "-25"
color red,black
center(21, "WARNING: Hit Red Stripe -50 !")
stripe .995
end
sub updatePlayer
k = inkey
if k=" " or pen(3)=1 and posX < xmax/2 then
XVel = XVel + 0.8
endif
XVel = XVel * 0.98
posX = posX + XVel
posX = int(posX)
posY = int(posY)
'pause
if posX > 2*th and XVel < 1 then XVel = 0
if posX >= limit then
color red,black
posX = limit
delay 1000
score-=50
lives-=1
if lives=0 then gameover
posX = th
XVel = 0
end if
circle posX,posY,th,1,yellow filled
circle posX,posY,.75*th,1,orange filled
end
sub updateScore
if XVel=0 and posX>th then
if posX>xmax*.9 and posX<limit-5 then
score-=25
elif posX>xmax*.8
score+=100
elif posX>xmax*.7
score+=75
elif posX>xmax*.6
score+=55
elif posX>xmax*.5
score+=40
elif posX>xmax*.4
score+=30
elif posX>xmax*.3
score+=20
elif posX>xmax*.2
score+=10
else
score-=25
end if
delay 1000
posX=th
lives-=1
'at posX-th,posY+th:? int(posX)
endif
end
sub Gameover
color 15,0
center(18,space(len(spacebar)+2))
center(18,"Game Over...")
showpage
delay 20
end