Skip to content

Commit 3af7d4c

Browse files
committed
tweaked tetriz speedup
1 parent 0fc3071 commit 3af7d4c

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

examples/compiled/examples.d64

0 Bytes
Binary file not shown.

examples/compiled/tehtriz.prg

5.06 KB
Binary file not shown.

examples/tehtriz.p8

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414
const ubyte boardHeight = 20
1515
const ubyte startXpos = boardOffsetX + 3
1616
const ubyte startYpos = boardOffsetY - 2
17-
const ubyte startSpeedLevel = 30
1817
uword lines
1918
uword score
2019
ubyte xpos
2120
ubyte ypos
2221
ubyte nextBlock
23-
ubyte speedlevel = startSpeedLevel
22+
ubyte speedlevel = 1
2423

2524

2625
sub start() {
@@ -36,7 +35,7 @@ newgame:
3635
spawnNextBlock()
3736

3837
waitkey:
39-
if c64.TIME_LO>=speedlevel {
38+
if c64.TIME_LO>=(60-4*speedlevel) {
4039
c64.TIME_LO = 0
4140

4241
drawBlock(xpos, ypos, 32) ; hide block
@@ -177,11 +176,7 @@ waitkey:
177176
lines += num_lines
178177
uword[4] scores = [10, 25, 50, 100] ; can never clear more than 4 lines
179178
score += scores[num_lines-1]
180-
word speed = startSpeedLevel-(lines as word)/10
181-
if speed>0
182-
speedlevel = lsb(speed)
183-
else
184-
speedlevel = 0
179+
speedlevel = 1+lsb(lines/10)
185180
drawScore()
186181
}
187182
}
@@ -300,7 +295,7 @@ waitkey:
300295
c64scr.PLOT(30,15)
301296
c64scr.print_uw(score)
302297
c64scr.PLOT(9,22)
303-
c64scr.print_ub(startSpeedLevel+1-speedlevel)
298+
c64scr.print_ub(speedlevel)
304299
}
305300

306301
sub drawNextBlock() {

0 commit comments

Comments
 (0)