主题:[原创]小程序
编的一个小玩艺儿,献丑了,大家别见笑啊(有个BUG)
小方块落下,用WSAD控制方向,横向或竖向连成三个即消失,满格即死
DECLARE SUB shanchu ()
DECLARE SUB panduan ()
DECLARE SUB ini ()
DECLARE SUB kongzhi ()
DECLARE SUB down ()
DECLARE SUB left ()
DECLARE SUB right ()
DECLARE SUB drawbox ()
COMMON SHARED clor, x, y, danwei(), danweiclor()
SCREEN 12
RANDOMIZE TIMER
LINE (99, 9)-(301, 371), 2, B
DIM danwei(0 TO 20, 0 TO 28)'pan duan shi shi yong
DIM danweiclor(0 TO 20, 0 TO 28)
CALL ini
DO
LOCATE 1, 20
PRINT x; ","; y; ","; danwei(x, y)
CALL panduan
CALL kongzhi
CALL shanchu
LOOP
SUB down
tem = clor
clor = 0
CALL drawbox
clor = tem
y = y + 1
CALL drawbox
END SUB
SUB drawbox
xzuobiao = (x - 1) * 20 + 110: yzuobiao = (y - 1) * 20 + 20
LINE (xzuobiao - 10, yzuobiao - 10)-(xzuobiao + 10, yzuobiao + 10), clor, BF
END SUB
SUB ini
x = 5: y = 1
clor = INT(RND * 3) + 12
END SUB
SUB kongzhi
DO
time = time + 1
LOCATE 1, 1
PRINT time
fangxiang$ = INKEY$
LOOP UNTIL fangxiang$ <> "" OR time = 100
time = 0
CALL down
IF fangxiang$ = "a" AND x > 1 AND danwei(x - 1, y) = 0 THEN
CALL left
ELSEIF fangxiang$ = "d" AND x < 10 AND danwei(x + 1, y) = 0 THEN
CALL right
ELSEIF fangxiang$ = "s" AND y < 18 AND danwei(x, y + 1) = 0 THEN
CALL down
ELSEIF fangxiang$ = "t" THEN
END
END IF
END SUB
SUB left
tem = clor
clor = 0
CALL drawbox
clor = tem
x = x - 1
CALL drawbox
END SUB
SUB panduan
IF y = 18 OR danwei(x, y + 1) = 1 THEN
danwei(x, y) = 1: danweiclor(x, y) = clor
CALL ini
END IF
IF y = 1 AND danwei(x, y + 1) = 1 THEN
CLS
LOCATE 10, 35
PRINT "YOU DEAD"
LOCATE 11, 30
PRINT "THANKS FOR PLAYING!"
LOCATE 12, 32
PRINT "JUST DO IT FOR ALICE."
FOR jjj = 1 TO 800000
NEXT jjj
END
END IF
END SUB
SUB right
tem = clor
clor = 0
CALL drawbox
clor = tem
x = x + 1
CALL drawbox
END SUB
SUB shanchu
FOR a = 18 TO 1 STEP -1
FOR B = 1 TO 8
IF danweiclor(B, a) = danweiclor(B + 1, a) AND danweiclor(B, a) = danweiclor(B + 2, a) AND danweiclor(B, a) <> 0 THEN
danwei(B, a) = 0: danwei(B + 1, a) = 0: danwei(B + 2, a) = 0
danweiclor(B, a) = 0: danweiclor(B + 1, a) = 0: danweiclor(B + 2, a) = 0
x = B: y = a: clor = 0
CALL drawbox
x = B + 1
CALL drawbox
x = B + 2
CALL drawbox
CALL ini
END IF
NEXT B
NEXT a
FOR e = 18 TO 3 STEP -1
FOR f = 1 TO 10
IF danweiclor(f, e) = danweiclor(f, e - 1) AND danweiclor(f, e) = danweiclor(f, e - 2) AND danweiclor(f, e) <> 0 THEN
danwei(f, e) = 0: danwei(f, e - 1) = 0: danwei(f, e - 2) = 0
danweiclor(f, e) = 0: danweiclor(f, e - 1) = 0: danweiclor(f, e - 2) = 0
x = f: y = e: clor = 0
CALL drawbox
y = e - 1
CALL drawbox
y = e - 2
CALL drawbox
CALL ini
END IF
NEXT f
NEXT e
FOR c = 18 TO 1 STEP -1
FOR d = 1 TO 10
IF danwei(d, c) = 0 AND danwei(d, c - 1) = 1 THEN
clor = 0
x = d: y = c - 1
CALL drawbox
x = d: y = c
clor = danweiclor(d, c - 1)
CALL drawbox
danwei(d, c) = 1
danwei(d, c - 1) = 0
END IF
NEXT d
NEXT c
END SUB
写的不好,因为没有学过编程,随便玩玩。好久没来论坛了,想念秋水还有冷石
小方块落下,用WSAD控制方向,横向或竖向连成三个即消失,满格即死
DECLARE SUB shanchu ()
DECLARE SUB panduan ()
DECLARE SUB ini ()
DECLARE SUB kongzhi ()
DECLARE SUB down ()
DECLARE SUB left ()
DECLARE SUB right ()
DECLARE SUB drawbox ()
COMMON SHARED clor, x, y, danwei(), danweiclor()
SCREEN 12
RANDOMIZE TIMER
LINE (99, 9)-(301, 371), 2, B
DIM danwei(0 TO 20, 0 TO 28)'pan duan shi shi yong
DIM danweiclor(0 TO 20, 0 TO 28)
CALL ini
DO
LOCATE 1, 20
PRINT x; ","; y; ","; danwei(x, y)
CALL panduan
CALL kongzhi
CALL shanchu
LOOP
SUB down
tem = clor
clor = 0
CALL drawbox
clor = tem
y = y + 1
CALL drawbox
END SUB
SUB drawbox
xzuobiao = (x - 1) * 20 + 110: yzuobiao = (y - 1) * 20 + 20
LINE (xzuobiao - 10, yzuobiao - 10)-(xzuobiao + 10, yzuobiao + 10), clor, BF
END SUB
SUB ini
x = 5: y = 1
clor = INT(RND * 3) + 12
END SUB
SUB kongzhi
DO
time = time + 1
LOCATE 1, 1
PRINT time
fangxiang$ = INKEY$
LOOP UNTIL fangxiang$ <> "" OR time = 100
time = 0
CALL down
IF fangxiang$ = "a" AND x > 1 AND danwei(x - 1, y) = 0 THEN
CALL left
ELSEIF fangxiang$ = "d" AND x < 10 AND danwei(x + 1, y) = 0 THEN
CALL right
ELSEIF fangxiang$ = "s" AND y < 18 AND danwei(x, y + 1) = 0 THEN
CALL down
ELSEIF fangxiang$ = "t" THEN
END
END IF
END SUB
SUB left
tem = clor
clor = 0
CALL drawbox
clor = tem
x = x - 1
CALL drawbox
END SUB
SUB panduan
IF y = 18 OR danwei(x, y + 1) = 1 THEN
danwei(x, y) = 1: danweiclor(x, y) = clor
CALL ini
END IF
IF y = 1 AND danwei(x, y + 1) = 1 THEN
CLS
LOCATE 10, 35
PRINT "YOU DEAD"
LOCATE 11, 30
PRINT "THANKS FOR PLAYING!"
LOCATE 12, 32
PRINT "JUST DO IT FOR ALICE."
FOR jjj = 1 TO 800000
NEXT jjj
END
END IF
END SUB
SUB right
tem = clor
clor = 0
CALL drawbox
clor = tem
x = x + 1
CALL drawbox
END SUB
SUB shanchu
FOR a = 18 TO 1 STEP -1
FOR B = 1 TO 8
IF danweiclor(B, a) = danweiclor(B + 1, a) AND danweiclor(B, a) = danweiclor(B + 2, a) AND danweiclor(B, a) <> 0 THEN
danwei(B, a) = 0: danwei(B + 1, a) = 0: danwei(B + 2, a) = 0
danweiclor(B, a) = 0: danweiclor(B + 1, a) = 0: danweiclor(B + 2, a) = 0
x = B: y = a: clor = 0
CALL drawbox
x = B + 1
CALL drawbox
x = B + 2
CALL drawbox
CALL ini
END IF
NEXT B
NEXT a
FOR e = 18 TO 3 STEP -1
FOR f = 1 TO 10
IF danweiclor(f, e) = danweiclor(f, e - 1) AND danweiclor(f, e) = danweiclor(f, e - 2) AND danweiclor(f, e) <> 0 THEN
danwei(f, e) = 0: danwei(f, e - 1) = 0: danwei(f, e - 2) = 0
danweiclor(f, e) = 0: danweiclor(f, e - 1) = 0: danweiclor(f, e - 2) = 0
x = f: y = e: clor = 0
CALL drawbox
y = e - 1
CALL drawbox
y = e - 2
CALL drawbox
CALL ini
END IF
NEXT f
NEXT e
FOR c = 18 TO 1 STEP -1
FOR d = 1 TO 10
IF danwei(d, c) = 0 AND danwei(d, c - 1) = 1 THEN
clor = 0
x = d: y = c - 1
CALL drawbox
x = d: y = c
clor = danweiclor(d, c - 1)
CALL drawbox
danwei(d, c) = 1
danwei(d, c - 1) = 0
END IF
NEXT d
NEXT c
END SUB
写的不好,因为没有学过编程,随便玩玩。好久没来论坛了,想念秋水还有冷石