|
-
Dec 8th, 2002, 04:48 PM
#1
Thread Starter
Addicted Member
Tile Map
I've been working on a tile map and I can't seem to get it to work correctly. Here is all of my code so far, this is all pretty new stuff to me so I'm sure there is much wrong with it. I am trying to make it draw them in a picturebox. Any help would be appreciated.
-------------------------------------
Form called startup
-------------------------------------
Private Sub Form_Load()
Map.Int_Map
End Sub
Sub Draw_Position()
For X = 0 To 9
For Y = 0 To 9
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
Next Y
Next X
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
-----------------------------------------------
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 = 1
Char_X = 1
Char_Face = 1
startup.Draw_Position
End Sub
-
Dec 8th, 2002, 04:59 PM
#2
Registered User
hey - did
you get that code off my tutorial??
(geocities.com/vb_recruit)
If you did thats really cool -
coz Im interested to know what pple think of it!
Chris
-
Dec 8th, 2002, 05:05 PM
#3
Thread Starter
Addicted Member
hey kewl your the one my friend found this from. i thought i understood it but when i tried programming it myself it doesnt seem to want to work
-
Dec 8th, 2002, 05:18 PM
#4
Registered User
hey - do you have an instant messenger??
if so, please gimme ur screen name and I can help you
out.
Otherwise, ill just PM you a link where u can download
an example I created for my tutorial.
Chris
-
Dec 8th, 2002, 05:21 PM
#5
Thread Starter
Addicted Member
ive got aim and yahoo both my names are jeb2022
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
|