mirror of
https://github.com/irmen/prog8.git
synced 2024-06-28 20:29:36 +00:00
tehtriz example uses when statement
This commit is contained in:
parent
2a0c3377f9
commit
cc078503e3
|
@ -161,7 +161,7 @@
|
|||
else
|
||||
c64.SPRPTR[i] = $2000/64 ; small ball
|
||||
|
||||
c64.SPCOL[i] = spritecolors[zc>>13 as byte + 4] ; further away=darker color
|
||||
c64.SPCOL[i] = spritecolors[zc>>13 as byte + 4] ; further away=darker color TODO doesn't work anymore? ">>" seems broken.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,6 @@
|
|||
while multiple < len(sieve) {
|
||||
sieve[lsb(multiple)] = true
|
||||
multiple += candidate_prime
|
||||
; c64scr.print_uw(multiple) ; TODO
|
||||
; c4.CHROUT('\n') ; TODO
|
||||
}
|
||||
return candidate_prime
|
||||
}
|
||||
|
|
|
@ -75,33 +75,31 @@ waitkey:
|
|||
|
||||
}
|
||||
|
||||
sub keypress(ubyte key) {
|
||||
if key==157 or key==',' {
|
||||
; move left
|
||||
sub move_left() {
|
||||
drawBlock(xpos, ypos, 32)
|
||||
if blocklogic.noCollision(xpos-1, ypos) {
|
||||
xpos--
|
||||
}
|
||||
drawBlock(xpos, ypos, 160)
|
||||
}
|
||||
else if key==29 or key=='/' {
|
||||
; move right
|
||||
|
||||
sub move_right() {
|
||||
drawBlock(xpos, ypos, 32)
|
||||
if blocklogic.noCollision(xpos+1, ypos) {
|
||||
xpos++
|
||||
}
|
||||
drawBlock(xpos, ypos, 160)
|
||||
}
|
||||
else if key==17 or key=='.' {
|
||||
; move down faster
|
||||
|
||||
sub move_down_faster() {
|
||||
drawBlock(xpos, ypos, 32)
|
||||
if blocklogic.noCollision(xpos, ypos+1) {
|
||||
ypos++
|
||||
}
|
||||
drawBlock(xpos, ypos, 160)
|
||||
}
|
||||
else if key==145 or key==' ' {
|
||||
; drop down immediately
|
||||
|
||||
sub drop_down_immediately() {
|
||||
drawBlock(xpos, ypos, 32)
|
||||
ubyte dropypos
|
||||
for dropypos in ypos+1 to boardOffsetY+boardHeight-1 {
|
||||
|
@ -120,7 +118,19 @@ waitkey:
|
|||
drawScore()
|
||||
}
|
||||
}
|
||||
else if key=='z' { ; no joystick equivalent (there is only 1 fire button)
|
||||
|
||||
sub keypress(ubyte key) {
|
||||
when key {
|
||||
157 -> move_left()
|
||||
',' -> move_left()
|
||||
29 -> move_right()
|
||||
'/' -> move_right()
|
||||
17 -> move_down_faster()
|
||||
'.' -> move_down_faster()
|
||||
145 -> drop_down_immediately()
|
||||
' ' -> drop_down_immediately()
|
||||
'z' -> {
|
||||
; no joystick equivalent (there is only 1 fire button)
|
||||
; rotate counter clockwise
|
||||
drawBlock(xpos, ypos, 32)
|
||||
if blocklogic.canRotateCCW(xpos, ypos) {
|
||||
|
@ -139,7 +149,7 @@ waitkey:
|
|||
}
|
||||
drawBlock(xpos, ypos, 160)
|
||||
}
|
||||
else if key=='x' {
|
||||
'x' -> {
|
||||
; rotate clockwise
|
||||
drawBlock(xpos, ypos, 32)
|
||||
if blocklogic.canRotateCW(xpos, ypos) {
|
||||
|
@ -158,7 +168,7 @@ waitkey:
|
|||
}
|
||||
drawBlock(xpos, ypos, 160)
|
||||
}
|
||||
else if key=='c' {
|
||||
'c' -> {
|
||||
; hold
|
||||
if holdingAllowed {
|
||||
sound.swapping()
|
||||
|
@ -177,6 +187,7 @@ waitkey:
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub checkForLines() {
|
||||
; check if line(s) are full -> flash/clear line(s) + add score + move rest down
|
||||
|
|
Loading…
Reference in New Issue
Block a user