|
-
Dec 7th, 2002, 10:59 PM
#1
Thread Starter
Addicted Member
Scrolling Map
Im sort of new at programming vb, and recently I have been working on a scrolling tile map. I found a program that I sort of understood and used that to get me started but I'm stuck and can't get it to work. So could someone tell me what code I'm missing or messing up on or just any help you could give me.
This is the code on the form called startup
Private Sub Form_Load()
Map.Int_Map
End Sub
Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyUp
look_at = Mid(Map.Map(Char_Y + 1 - 1), Char_X + 1, 1)
If look_at = "A" Then
Char_Y = Char_Y - 1
Char_Face = 1
Draw_Position
End If
Case vbKeyDown
look_at = Mid(Map.Map(Char_Y + 1 + 1), Char_X + 1, 1)
If look_at = "A" Then
Char_Y = Char_Y + 1
Char_Face = 1
Draw_Position
End If
Case vbKeyRight
look_at = Mid(Map.Map(Char_Y + 1), Char_X + 1 + 1, 1)
If look_at = "A" Then
Char_X = Char_X + 1
Char_Face = 1
Draw_Position
End If
Case vbKeyLeft
look_at = Mid(Map.Map(Char_Y + 1), Char_X + 1 - 1, 1)
If look_at = "A" Then
Char_X = Char_X - 1
Char_Face = 1
Draw_Position
End If
End Select
End Sub
Sub Draw_Position()
Select Case look_at
Case Is = "A"
Picture1.PaintPicture imggrass.Picture, (X + 3) * 32, (Y + 3) * 32
Case Is = "B"
Picture1.PaintPicture imgblue.Picture, (X + 3) * 32, (Y + 3) * 32
Case Is = "C"
Picture1.PaintPicture imgmountain.Picture, (X + 3) * 32, (Y + 3) * 32
End Select
Select Case Char_Face
Case Is = 1
Picture1.PaintPicture imgchar.Picture, (X + 3) * 32, (Y + 3) * 32
End Select
End Sub
Here is the code in the module called Map
Public Char_Y As Single
Public Char_X As Single
Public Char_Face As Single
Public Draw_Position As Single
Public Y As Single
Public X As Single
Public look_at As String
Public Map(50) As String
Sub Int_Map()
Map(0) = "BBBBBBBBBBBBBBBBBBB"
Map(1) = "BBBBBAAAAAAABBBBBBB"
Map(2) = "BBBAAAAAAAAAAABBBBB"
Map(3) = "BAAAAACAAAAAAAAAAAB"
Map(4) = "BAAAAAAAAAAAAAAAAAB"
Map(5) = "BAAAAAAAAACAAAAAAAB"
Map(6) = "BAAAAAAAAAAAAAAAAAB"
Map(7) = "BAAAAAAAAAAAAAAAAAB"
Map(8) = "BAAAAAAAAAAAAAAAAAB"
Map(9) = "BBBBAAAAAACAAAAAABB"
Map(10) = "BBBBBBBBBBBBBBBBBBB"
Char_Y = 5
Char_X = 5
Char_Face = 1
Startup.Draw_Position
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|