回 帖 发 新 帖 刷新版面

主题:有谁知道

怎么用QB编俄罗斯方块

回复列表 (共21个回复)

沙发


看你这帖子没人回,原来是这么具体的一个问题哦,开玩笑,难到让别人直接网上copy一个*.bas(代码)才好?...
估计不是你的初衷吧,
做一个完美的程序要用心,不是随便一下就OK了,我感觉你应该再去看看教程之类,或者去做一些小程序,当然也可以做这个....

板凳

呵呵,看你也不像个初学者啊,不知道你还学别的什么编程语言哦?LZ

3 楼


我本来就不是初学者[em1]

4 楼

不过看你也不算大,估计也就上中学吧,你!

5 楼

是啊,怎么编呢??是个问题,期待楼主自己想出来

6 楼

强强。。你居然也会来这里啊

俄罗斯方块的编写。以前的老贴里有介绍的。

7 楼

可以上网搜索

8 楼

CLS
DECLARE FUNCTION MsgBox% (stil$)
DECLARE SUB GameOver ()
DECLARE SUB BlGet (e AS ANY)
DECLARE SUB BlClear ()
DECLARE SUB BlDraw ()
DECLARE SUB BlInit ()
DECLARE SUB Is.CanDown ()
DECLARE SUB Is.CanLeft ()
DECLARE SUB Is.CanRight ()
DECLARE SUB Is.CanTurnLeft ()
DECLARE SUB Is.CanTurnRight ()
DECLARE SUB MyPrn (X%, Y%, st$, bfclr%, bkclr%, over%)
DECLARE SUB Set.Palete ()
DECLARE SUB SysInit ()
DECLARE SUB Turn.Left (e AS ANY)
DECLARE SUB Turn.Right (e AS ANY)
DECLARE SUB Up.Pset (X%, Y%)
DECLARE SUB XYClear ()
DECLARE SUB XYSet ()
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'          定义变量
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
TYPE BlType               '方块
     Wid AS INTEGER       '宽度
     Hei AS INTEGER       '高度
     Bit AS STRING * 6    '形状
END TYPE

9 楼

接着上面





'-------------------------------
'按键值
CONST KeyLeft% = 75, KeyRight% = 77, KeyDown% = 80, KeyA% = 65
CONST KeyS% = 83, KeyEsc% = 27, KeySpace% = 32, KeyPgDn% = 81, KeyPgUp% = 73
'-------------------------------
CONST False = 0, True = NOT False   '真假值
CONST Bgnx% = 10, Bgny% = 0         '方块初始位置
CONST BackClr% = 10                 '背景色
CONST bordx% = 60, Bordy% = 50     '桶左上边界
CONST Pexx% = 16, Pexy% = 16        '方块高宽
CONST Hei% = 24, Wid% = 24          '桶高宽
DIM SHARED Works  AS LONG           '积分数
DIM SHARED Fast%                    '方块下落的速度
DIM SHARED BPic(32) AS LONG         '方块样式
REDIM SHARED Xy(Hei%, Wid%) AS INTEGER'桶方块数据
DIM SHARED Bl(11) AS BlType         '方块形状数组
DIM SHARED CurBl AS BlType          '当前方块
DIM SHARED NextBl AS BlType         '下一方块
DIM SHARED Blx%, Bly%               '当前方块位置
DIM SHARED Staring%                 '游戏是否开始变量
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DEFINT A-Z
SCREEN 12
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'程序开始了
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Fast% = 10
SysInit
BlInit         '初始化方块
DEF SEG = 65
WHILE Quit% = False       '等待按键
   '---------------------------------------
   NewTime% = PEEK(92)    '取时间间隔
   IF OldTime% > NewTime% THEN OldTime% = 0
   IF NewTime% > OldTime% + Fast% AND Staring% THEN
       OldTime% = NewTime%
       Is.CanDown
   END IF
   '---------------------------------------
   ikey$ = INKEY$: KeyCode% = -1    '取按键
   IF ikey$ <> "" THEN
       IF LEN(ikey$) = 2 THEN
            KeyCode% = ASC(MID$(ikey$, 2, 1))
            ELSE : KeyCode% = ASC(UCASE$(ikey$))
       END IF
   END IF
   '---------------------------------------
   IF KeyCode% > 0 THEN             '处理按键
       SELECT CASE KeyCode%
           CASE KeyLeft%            '左移
                IF Staring% THEN CALL Is.CanLeft
           CASE KeyRight%           '右移
                IF Staring% THEN CALL Is.CanRight
           CASE KeyDown%            '下落
                IF Staring% THEN CALL Is.CanDown
           CASE KeyA%               '左旋转
                IF Staring% THEN CALL Is.CanTurnLeft
           CASE KeyS%               '右旋转
                IF Staring% THEN CALL Is.CanTurnRight
           CASE KeyEsc%             '退出程序
                Quit% = True
           CASE KeySpace%           '暂停/开始
                Staring% = NOT Staring%
           CASE KeyPgDn%            '减速
                IF Fast% < 10 THEN
                   Fast% = Fast% + 1
                   M$ = LTRIM$(RTRIM$(STR$(10 - Fast%)))
                   LINE (500, 390)-(520, 407), BackClr%, BF
                   MyPrn 501, 391, M$, 13, BackClr%, 0
                   MyPrn 500, 390, M$, 4, 0, 0
                END IF
           CASE KeyPgUp%            '加速
                IF Fast% > 0 THEN
                   Fast% = Fast% - 1
                   M$ = LTRIM$(RTRIM$(STR$(10 - Fast%)))
                   LINE (500, 390)-(520, 407), BackClr%, BF
                   MyPrn 501, 391, M$, 13, BackClr%, 0
                   MyPrn 500, 390, M$, 4, 0, 0
                END IF
       END SELECT
   END IF
   '---------------------------------------
WEND
END

10 楼

接着上面




DATA 0,0,0,0,0,0,0,0,0,64,0,48,0,60,63,254,0,60,0,48,0,64,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,1,0,6,0,30,0,63,254,30,0,6,0,1,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,128,0,128,0,128,0,128,0,128,0,128,0,128,0,128,4,144,3,224,3,224,1,192,1,192,0,128,0,0
DATA 17,0,17,0,17,0,35,252,34,4,100,8,168,64,32,64,33,80,33,72,34,76,36,68,32,64,32,64,33,64,32,128
DATA 1,0,17,0,17,0,17,16,31,248,33,0,65,0,1,4,255,254,1,0,2,128,2,128,4,64,8,48,16,14,96,4
DATA 4,64,126,64,68,68,84,126,84,136,85,8,84,72,84,72,84,72,84,80,84,80,16,32,40,80,36,142,69,4,130,0
DATA 0,0,127,248,0,16,0,32,0,64,1,128,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,5,0,2,0
DATA 16,64,16,32,16,0,19,254,250,2,20,68,16,64,63,254,208,136,16,136,17,8,16,144,16,96,16,80,80,140,35,4
DATA 16,32,18,32,34,32,35,36,74,172,250,112,18,32,35,252,66,32,250,112,66,172,3,36,26,32,226,36,67,254,0,0
DATA 16,64,16,80,35,248,32,64,72,64,255,252,17,36,32,168,66,32,249,36,7,254,0,64,28,96,224,144,65,12,2,4
DATA 3,248,66,8,50,8,19,248,2,8,2,8,243,252,18,8,18,208,18,32,18,144,19,12,18,4,40,0,68,6,3,252
DATA 1,0,1,0,33,8,33,8,33,8,33,8,63,248,33,8,1,0,65,4,65,4,65,4,65,4,65,4,127,252,64,4
DATA 16,16,8,24,4,32,4,72,127,252,1,0,1,0,1,4,255,254,1,0,2,128,2,128,4,64,8,48,48,14,192,4
DATA 2,0,2,32,3,240,2,0,2,0,2,4,255,254,2,0,2,0,2,128,2,96,2,48,2,16,2,0,2,0,2,0
DATA 4,0,14,4,120,254,8,132,8,132,254,132,8,132,24,132,28,252,42,132,40,0,72,136,136,196,9,6,10,2,8,0
DATA 0,128,4,128,4,64,8,64,8,32,16,16,32,8,79,238,132,36,4,32,4,32,4,32,4,32,8,32,17,64,32,128
DATA 16,0,16,0,16,4,18,126,255,68,18,68,18,68,18,68,18,68,34,68,34,68,34,68,34,68,74,124,132,68,0,0
DATA 16,128,16,128,16,128,16,136,91,252,84,136,80,136,144,136,16,136,31,254,16,128,17,64,17,32,18,16,20,14,24,4
DATA 0,16,64,24,48,20,23,254,4,16,4,16,13,208,20,20,37,212,229,84,37,84,37,88,37,208,37,42,8,70,16,130
DATA 19,248,18,8,19,248,90,8,87,248,80,4,151,254,20,164,20,164,23,252,16,0,19,248,17,16,16,224,17,24,22,6
DATA 0,4,255,254,2,0,2,0,2,0,2,128,2,64,2,48,2,16,2,0,2,0,2,0,2,0,2,0,2,0,2,0
DATA 8,32,8,36,255,254,9,32,65,248,35,16,36,160,128,64,73,176,18,14,47,252,226,8,34,8,34,8,35,248,34,8
DATA 2,0,2,0,2,4,255,254,4,0,4,0,8,0,8,8,31,252,40,8,72,8,136,8,8,8,8,8,15,248,8,8
DATA 8,64,28,64,240,252,17,132,18,72,252,48,16,96,57,160,52,62,84,66,144,196,17,36,16,24,16,48,16,192,23,0
DATA 2,0,2,0,2,8,255,252,4,0,4,0,4,0,8,16,15,248,16,128,16,128,32,128,64,128,128,132,127,254,0,0
DATA 8,32,9,168,15,36,17,32,17,36,63,254,81,32,145,32,17,164,19,24,29,16,17,48,17,72,17,138,21,6,18,2
DATA 0,4,127,254,68,68,68,68,68,68,127,252,66,4,2,0,7,240,8,16,20,32,98,192,1,0,6,0,24,0,224,0
DATA 34,8,34,28,127,96,34,64,34,64,62,64,34,126,34,72,62,72,34,72,34,72,255,72,0,136,21,8,34,8,64,8
DATA 4,0,3,0,1,0,0,4,255,254,4,0,4,16,7,248,4,16,4,16,4,16,8,16,8,16,16,16,32,160,64,64
DATA 16,128,16,128,16,128,16,136,19,252,252,136,16,136,16,136,16,136,23,254,28,128,241,64,65,32,2,16,4,14,8,4
DATA 8,64,28,64,240,64,16,64,17,68,253,76,17,80,50,64,56,64,84,160,80,160,145,16,17,8,18,14,20,4,24,0
DATA 0,16,63,248,32,16,40,80,36,80,34,144,34,144,33,16,33,16,34,144,34,144,36,80,40,80,48,18,64,10,128,6
DATA 16,12,126,240,16,128,40,132,126,254,8,144,254,144,9,16,10,16,0,16,31,248,16,16,31,240,16,16,31,240,16,16
DATA 16,128,16,72,23,252,32,0,35,248,98,8,163,248,32,0,47,254,40,2,51,244,32,64,32,64,32,64,33,64,32,128
DATA 0,8,127,252,8,32,8,32,8,32,8,32,8,36,255,254,8,32,8,32,8,32,8,32,16,32,16,32,32,32,64,32
DATA 16,64,16,64,16,64,16,128,252,136,37,4,39,254,36,2,36,4,73,254,41,4,17,4,41,4,69,4,133,252,1,4
DATA 32,128,16,132,20,254,254,128,33,0,34,254,60,34,36,36,36,160,36,168,36,188,36,160,68,160,85,96,138,38,4,28
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,4,255,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
'---------------------------------------------
DATA 0,0,56,108,198,198,214,214,198,198,108,56,0,0,0,0
DATA 0,0,24,56,120,24,24,24,24,24,24,126,0,0,0,0
DATA 0,0,124,198,6,12,24,48,96,192,198,254,0,0,0,0
DATA 0,0,124,198,6,6,60,6,6,6,198,124,0,0,0,0
DATA 0,0,12,28,60,108,204,254,12,12,12,30,0,0,0,0
DATA 0,0,254,192,192,192,252,6,6,6,198,124,0,0,0,0
DATA 0,0,56,96,192,192,252,198,198,198,198,124,0,0,0,0
DATA 0,0,254,198,6,6,12,24,48,48,48,48,0,0,0,0
DATA 0,0,124,198,198,198,124,198,198,198,198,124,0,0,0,0
DATA 0,0,124,198,198,198,126,6,6,6,12,120,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,24,24,24,48,0,0,0
DATA 0,0,0,0,0,126,0,0,126,0,0,0,0,0,0,0
DATA 0,0,0,0,2,6,12,24,48,96,192,128,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0
DATA 0,0,12,24,48,48,48,48,48,48,24,12,0,0,0,0
DATA 0,0,48,24,12,12,12,12,12,12,24,48,0,0,0,0
DATA 0,0,0,0,24,24,0,0,0,24,24,0,0,0,0,0
DATA 0,0,124,198,198,96,56,12,6,198,198,124,0,0,0,0
DATA 0,0,0,0,0,220,102,102,102,102,102,124,96,96,240,0
DATA 0,0,0,0,0,120,12,124,204,204,204,118,0,0,0,0
DATA 0,0,0,0,0,124,198,192,192,192,198,124,0,0,0,0
DATA 0,0,0,0,0,124,198,254,192,192,198,124,0,0,0,0
DATA 0,0,254,102,98,104,120,104,96,98,102,254,0,0,0,0
DATA 0,0,0,0,0,124,198,96,56,12,198,124,0,0,0,0
DATA 0,0,252,102,102,102,124,96,96,96,96,240,0,0,0,0
DATA 0,0,0,0,0,118,204,204,204,204,204,124,12,204,120,0
DATA 0,0,198,198,198,198,198,198,198,198,198,124,0,0,0,0
DATA 0,0,248,108,102,102,102,102,102,102,108,248,0,0,0,0
DATA 0,0,0,0,0,220,102,102,102,102,102,102,0,0,0,0
DATA 0,0,60,102,194,192,192,192,192,194,102,60,0,0,0,0
DATA 0,0,0,0,0,124,198,198,198,198,198,124,0,0,0,0
DATA 0,0,0,0,0,198,198,198,198,198,198,126,6,12,248,0
DATA 0,0,252,102,102,102,124,108,102,102,102,230,0,0,0,0
DATA 0,0,24,24,0,56,24,24,24,24,24,60,0,0,0,0
DATA 0,0,224,96,96,108,118,102,102,102,102,230,0,0,0,0
DATA 0,0,16,48,48,252,48,48,48,48,54,28,0,0,0,0
DATA 0,0,16,56,108,198,198,254,198,198,198,198,0,0,0,0
DATA 0,0,198,198,198,198,198,198,198,108,56,16,0,0,0,0


我来回复

您尚未登录,请登录后再回复。点此登录或注册