⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.frm

📁 小型RPG游戏设计
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      BorderStyle     =   1  'Fixed Single
      Caption         =   "100"
      BeginProperty Font 
         Name            =   "Comic Sans MS"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   615
      Left            =   6600
      TabIndex        =   0
      Top             =   3120
      Width           =   855
   End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Jesse Acosta
'1999 - 2000
'Nomadic@icehouse.net
'http://www.vengei.com/nomadik/
'Email me if you have questions or if something isnt documented well
'This was done as a school project to show how to make a simple game.
'I made the Subs basically Self Explainatory.. Its not that hard..
'Please email me for comments and stuff as well! Jaa Mata Minasan!
Private Sub Form_KeyPress(KeyAscii As Integer)
'Dim look_at As String
'Changes Direction of Samurai, then Moves if possibles
    Select Case KeyAscii
        Case Asc("8")
            look_at = Mid(Map(Char_Y + 1 - 1), Char_X + 1, 1)
            If look_at = "6" Or look_at = "3" Or look_at = "U" Or look_at = "N" Then
            Char_Y = Char_Y - 1
            Char_Face = 2
            Draw_Position
            End If
        Case Asc("2")
            look_at = Mid(Map(Char_Y + 1 + 1), Char_X + 1, 1)
            If look_at = "6" Or look_at = "3" Or look_at = "U" Or look_at = "N" Then
            Char_Y = Char_Y + 1
            Char_Face = 1
            Draw_Position
            End If
        Case Asc("4")
            look_at = Mid(Map(Char_Y + 1), Char_X + 1 - 1, 1)
            If look_at = "6" Or look_at = "3" Or look_at = "U" Or look_at = "N" Then
            Char_X = Char_X - 1
            Char_Face = 3
            Draw_Position
            End If
        Case Asc("6")
            look_at = Mid(Map(Char_Y + 1), Char_X + 1 + 1, 1)
            If look_at = "6" Or look_at = "3" Or look_at = "U" Or look_at = "N" Then
            Char_X = Char_X + 1
            Char_Face = 4
            Draw_Position
            End If
        Case Is = 13
            Init_Game
        Case Asc("T") Or Asc("t")
            'Talks to someone if right in front of them
            Talk_To_Others
    End Select
'Am I at The Village?
            look_at = Mid(Map(Char_Y + 1), Char_X + 1, 1)
            If look_at = "U" Then At_Village
End Sub

Private Sub Form_Load()
    'Load And Play Midi     Start
    Midi = "uyworld.mid"
    CmdStr = "play " + App.Path + "\" & Midi
    ReturnVal = mciSendString(CmdStr, 0&, 0, 0&)
    'Load And Play Midi     End
    Init_Game
End Sub

Private Sub Form_LostFocus()
    Show
    FrmMain.SetFocus
End Sub

Private Sub Form_Terminate()
    'Load And Stop Midi     Start
    CmdStr = "stop " + App.Path + "\" & Midi
    ReturnVal = mciSendString(CmdStr, 0&, 0, 0&)
    'Load And Stop Midi     End
End Sub

Private Sub Form_Unload(Cancel As Integer)
    'Load And Stop Midi     Start
    CmdStr = "stop " + App.Path + "\" & Midi
    ReturnVal = mciSendString(CmdStr, 0&, 0, 0&)
    'Load And Stop Midi     End
End Sub

Sub Init_Game()
'Initialization Stuff
FrmMain.Show
Found_Scroll = False
LblEquip.Caption = "Equipment: Nothing"
Answers(1) = "Whoever has walked with truth generates life."
Answers(2) = "Do not cut off the neck of that which has had its neck cut off."
Answers(3) = "That which is given in submission becomes a medium of defiance."
Answers(4) = "The destruction is from his own personal god; he knows no savior."
Answers(5) = "Wealth is hard to come by, but poverty is always at hand."
Answers(6) = "He acquires many things, he must keep close watch over them."
Answers(7) = "Have you tried the Southwest reigon of Booken Island?"
Answers(8) = "The Northeast reigon of Booken Island might be promising."
Answers(9) = "I have heard that the scroll has been seen in the Northwest."
Answers(10) = "The elders believe the scroll lies in the Southeast"
Newline = Chr(13) + Chr(10)
 Map(0) = "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"
 Map(1) = "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"
 Map(2) = "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"
 Map(3) = "VVVQTTTTTTTTTTTTTTTTTTTTTTTTTTTTSVVVVVVVVVVVVV"
 Map(4) = "VVVG55555555555555555566B6646666MVVQTTTTTSVVVV"
 Map(5) = "VVVG55U5566665555556666666666666MVVG66666MVVVV"
 Map(6) = "VVVG5566P66666655566666466666666MVVG66666MVVVV"
 Map(7) = "VVVG6666664666646666666666666666MVV1003002VVVV"
 Map(8) = "VVVG66666666666666666666E0C66466MVVVVV3VVVVVVV"
 Map(9) = "VVVG55666666666666646666MVG66666FTTTTT3TTTSVVV"
Map(10) = "VVVG55555555555555666L66FTD66666L66666666PMVVV"
Map(11) = "VVVG555555556646666666666666a6666646666466MVVV"
Map(12) = "VVVG55555566666664666466646666646666666666MVVV"
Map(13) = "VVVG66555666666666666666666666666555564666MVVV"
Map(14) = "VVVG666466646664666666666666666L5555555546MVVV"
Map(15) = "VVVG666666666L666666666666P664666665555666MVVV"
Map(16) = "VVVG6466664666666666L666666666666665556966MVVV"
Map(17) = "VVVG6666666666666L666666666666466555566666MVVV"
Map(18) = "VVVG66646666664666646666666646666555666666MVVV"
Map(19) = "VVVG6666666666666666666L666666655566666646MVVV"
Map(20) = "VVVG664L6666666666666666666666555666466666MVVV"
Map(21) = "VVVG6666444444444464466666L655555556664666MVVV"
Map(22) = "VVVG676646O6666664644666666666655555556666MVVV"
Map(23) = "VVVG666646664444466646666666666666666E00002VVV"
Map(24) = "VVVG6666446666466646464666666466L6666FTTTTSVVV"
Map(25) = "VVVG66664664444446464646666666666666666466MVVV"
Map(26) = "VVVG66664666666666644466646666666666646666MVVV"
Map(27) = "VVVG66664444444444644666666646686666666666MVVV"
Map(28) = "VVVG66L6666HI666666666666666666666L6666646MVVV"
Map(29) = "VVVG66666LLJKLL666666P66666666646666466666MVVV"
Map(30) = "VVVG666LLLLL66LL66666666646666666666664666MVVV"
Map(31) = "VVVG66666666666666666666666666666666666666MVVV"
Map(32) = "VVV1000000000000000000000000000000000000002VVV"
Map(33) = "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"
Map(34) = "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"
Map(35) = "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"
    Char_X = 5
    Char_Y = 5
    Char_Face = 1
    TxtText.Text = ""
    TxtText.Text = "Your Sensei has become ill. You must venute out to find the sacred" + Newline
    TxtText.Text = TxtText.Text + "Samurai Scroll. Hurry, or else your Sensei may die!" + Newline
    LblTime = 100
    Scroll_Place
    Draw_Position
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
'Checks timer.. if down to Zero then you lose
    LblTime.Caption = Val(LblTime.Caption) - 1
    If Val(LblTime.Caption) < 0 Then Lose
End Sub

Sub Draw_Position()
'Draws character on board along with board
Dim pass As Byte
    For Y = -3 To 3 Step 1
        For X = -3 To 3 Step 1
            pass = 0
            If Y + Char_Y + 0 < 1 Then Blue
            If X + Char_X + 0 < 1 Then Blue
            If X + Char_X + 0 > Len(Map(1)) Then Blue
            If Y + Char_Y + 0 > 36 Then Blue
            If pass = 0 Then look_at = Mid(Map(Y + Char_Y + 1), (X + Char_X + 1), 1)
            If X = 0 And Y = 0 Then GoTo Skip:
            Select Case look_at
            Case Is = "0"
                PaintPicture ImgBB.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "1"
                PaintPicture ImgBl.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "2"
                PaintPicture imgBr.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "3"
                PaintPicture ImgBridge.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "4"
                PaintPicture ImgBush.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "5"
                PaintPicture ImgForest.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "6"
                PaintPicture ImgGrass.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "7"
                PaintPicture ImgGuy1.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "8"
                PaintPicture ImgGuy2.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "9"
                PaintPicture ImgGuy3.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "A"
                PaintPicture ImgGuy4.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "B"
                PaintPicture ImgGuy5.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "C"
                PaintPicture ImgIlb.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "D"
                PaintPicture ImgIlt.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "E"
                PaintPicture ImgIrb.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "F"
                PaintPicture ImgIrt.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "G"
                 PaintPicture ImgL.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "H"
                PaintPicture ImgMount1.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "I"
                PaintPicture ImgMount2.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "J"
                PaintPicture ImgMount3.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "K"
                PaintPicture ImgMount4.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "L"
                PaintPicture ImgMountain.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "M"
                PaintPicture ImgR.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "N"
                PaintPicture ImgScroll.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "O"
                PaintPicture ImgSign.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "P"
                PaintPicture ImgSkull.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "Q"
                PaintPicture ImgTl.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "R"
                PaintPicture ImgTori.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "S"
                PaintPicture ImgTr.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "T"
                PaintPicture ImgTT.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "U"
                PaintPicture IMgVillage.Picture, (X + 3) * 32, (Y + 3) * 32
            Case Is = "V"
                PaintPicture ImgBlack.Picture, (X + 3) * 32, (Y + 3) * 32
            End Select
Skip:
        Next
    Next

Put_down_Character:
    Select Case Char_Face
    Case Is = 1
                PaintPicture ImgDownG.Picture, 3 * 32, 3 * 32
    Case Is = 2
                PaintPicture ImgUpG.Picture, 3 * 32, 3 * 32
    Case Is = 3
                PaintPicture ImgLG.Picture, 3 * 32, 3 * 32
    Case Is = 4
                PaintPicture ImgRG.Picture, 3 * 32, 3 * 32
    End Select
    
    Dim Look As String
    Look = Mid(Map(Char_Y + 1), Char_X + 1, 1)
    If Look = "N" Then
        Found_Scroll = True
        LblEquip.Caption = "Equipment: Scroll"
    End If
End Sub

Sub Scroll_Place()
'Randomizes where Scroll is
    Dim Scroll_x As Integer
    Dim Scroll_Y As Integer
    Do
    Randomize Timer
    Scroll_x = Int(Rnd * Len(Map(1))) + 1
    Scroll_Y = Int(Rnd * 35) + 1
    Loop Until Mid(Map(Scroll_Y), Scroll_x, 1) = "6"
    Mid(Map(Scroll_Y), Scroll_x, 1) = "N"

    
End Sub

Sub Blue()
                pass = 1
                PaintPicture ImgBlack.Picture, (X + 3) * 32, (Y + 3) * 32
End Sub

Private Sub Timer2_Timer()
    Draw_Position
    Timer2.Enabled = False
    FrmMain.SetFocus
End Sub

Sub Talk_To_Others()
'What happens when talking(MUST be underneath the person talking to)
    Dim Choice As Byte
    Dim Look As String
    Dim Spoke As Boolean
    Dim Speaker As String
    Look = Mid(Map(Char_Y + 1 - 1), Char_X + 1, 1)
    
    Select Case Look
    Case Is = "7"
        Spoke = True
        Speaker = "Haji:"
    Case Is = "8"
        Spoke = True
        Speaker = "Mail-Man Dan:"
    Case Is = "9"
        Spoke = True
        Speaker = "Nezumi:"
    Case Is = "A"
        Spoke = True
        Speaker = "Shinji:"
    Case Is = "B"
        Spoke = True
        Speaker = "Cocoa:"
    Case Is = "O"
        Spoke = True
        Speaker = "The Sign Reads:"
    End Select
    Randomize Timer
    If Spoke = True Then
        TxtText.Text = TxtText.Text + "You: Konnichiwa! Do you know where I can find the Sacred Scroll?" + Newline
        TxtText.Text = TxtText.Text + Speaker + " " + Answers(Int(Rnd * 10) + 1) + Newline
    Else
        TxtText.Text = TxtText.Text + "Nobody is there to speak! to" + Newline
    Spoke = False
    End If
    TxtText.SelStart = Len(TxtText)
End Sub


Private Sub TxtText_GotFocus()
    FrmMain.SetFocus
End Sub

Sub At_Village()
    If Found_Scroll = True Then
        TxtText.Text = TxtText.Text + "You: Master I have found the Sacred Scroll!" + Newline
        TxtText.SelStart = Len(TxtText)
        TxtText.Text = TxtText.Text + "Sensei: Good work! You are truly a worthy Samurai!" + Newline
        TxtText.SelStart = Len(TxtText)
        'Stop Midi     Start
        Midi = "uyworld.mid"
        CmdStr = "Stop " + App.Path + "\" & Midi
        ReturnVal = mciSendString(CmdStr, 0&, 0, 0&)
        'Stop Midi     End
        Timer1.Enabled = False
    
        'Load And Play Midi     Start
        Midi = "lnbintro.mid"
        CmdStr = "play " + App.Path + "\" & Midi
        ReturnVal = mciSendString(CmdStr, 0&, 0, 0&)
        'Load And Play Midi     End
    Else
        TxtText.Text = TxtText.Text + "Sensei: Have you found the scroll yet?" + Newline
        TxtText.SelStart = Len(TxtText)
        TxtText.Text = TxtText.Text + "You: Not yet, this is a difficult task." + Newline
        TxtText.SelStart = Len(TxtText)
    End If
End Sub

Sub Lose()
        Timer1.Enabled = False
        'Stop Midi     Start
        Midi = "uyworld.mid"
        CmdStr = "Stop " + App.Path + "\" & Midi
        ReturnVal = mciSendString(CmdStr, 0&, 0, 0&)
        'Stop Midi     End
    
        'Load And Play Midi     Start
        Midi = "haruumi1.mid"
        CmdStr = "play " + App.Path + "\" & Midi
        ReturnVal = mciSendString(CmdStr, 0&, 0, 0&)
        'Load And Play Midi     End
        TxtText.Text = TxtText.Text + "You: Oh no! I am too late! I have failed." + Newline
        TxtText.SelStart = Len(TxtText)
        TxtText.Text = TxtText.Text + "You: My only hope is through Seppuku!" + Newline
        TxtText.SelStart = Len(TxtText)

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -