mirror of
https://github.com/irmen/prog8.git
synced 2025-01-12 04:30:03 +00:00
tweaked tetriz speedup
This commit is contained in:
parent
0fc3071a21
commit
3af7d4c930
Binary file not shown.
BIN
examples/compiled/tehtriz.prg
Normal file
BIN
examples/compiled/tehtriz.prg
Normal file
Binary file not shown.
@ -14,13 +14,12 @@
|
|||||||
const ubyte boardHeight = 20
|
const ubyte boardHeight = 20
|
||||||
const ubyte startXpos = boardOffsetX + 3
|
const ubyte startXpos = boardOffsetX + 3
|
||||||
const ubyte startYpos = boardOffsetY - 2
|
const ubyte startYpos = boardOffsetY - 2
|
||||||
const ubyte startSpeedLevel = 30
|
|
||||||
uword lines
|
uword lines
|
||||||
uword score
|
uword score
|
||||||
ubyte xpos
|
ubyte xpos
|
||||||
ubyte ypos
|
ubyte ypos
|
||||||
ubyte nextBlock
|
ubyte nextBlock
|
||||||
ubyte speedlevel = startSpeedLevel
|
ubyte speedlevel = 1
|
||||||
|
|
||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
@ -36,7 +35,7 @@ newgame:
|
|||||||
spawnNextBlock()
|
spawnNextBlock()
|
||||||
|
|
||||||
waitkey:
|
waitkey:
|
||||||
if c64.TIME_LO>=speedlevel {
|
if c64.TIME_LO>=(60-4*speedlevel) {
|
||||||
c64.TIME_LO = 0
|
c64.TIME_LO = 0
|
||||||
|
|
||||||
drawBlock(xpos, ypos, 32) ; hide block
|
drawBlock(xpos, ypos, 32) ; hide block
|
||||||
@ -177,11 +176,7 @@ waitkey:
|
|||||||
lines += num_lines
|
lines += num_lines
|
||||||
uword[4] scores = [10, 25, 50, 100] ; can never clear more than 4 lines
|
uword[4] scores = [10, 25, 50, 100] ; can never clear more than 4 lines
|
||||||
score += scores[num_lines-1]
|
score += scores[num_lines-1]
|
||||||
word speed = startSpeedLevel-(lines as word)/10
|
speedlevel = 1+lsb(lines/10)
|
||||||
if speed>0
|
|
||||||
speedlevel = lsb(speed)
|
|
||||||
else
|
|
||||||
speedlevel = 0
|
|
||||||
drawScore()
|
drawScore()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -300,7 +295,7 @@ waitkey:
|
|||||||
c64scr.PLOT(30,15)
|
c64scr.PLOT(30,15)
|
||||||
c64scr.print_uw(score)
|
c64scr.print_uw(score)
|
||||||
c64scr.PLOT(9,22)
|
c64scr.PLOT(9,22)
|
||||||
c64scr.print_ub(startSpeedLevel+1-speedlevel)
|
c64scr.print_ub(speedlevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
sub drawNextBlock() {
|
sub drawNextBlock() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user