Elikkä tässä voi liikuttaa tuommosta neliöö tuossa ruudukossa...
Dim kartta(5, 5) As Integer '6x6 mappi
Private Type uukko
X As Integer
Y As Integer
End Type
Dim karttarx, karttary As Integer
Dim Ukko As uukko 'tehäänpäs ukkeli
Dim KoKo As Integer
Private Sub Form_Load()
'********************'
'* Ruudussaliikkuja *'
'********************'
Ukko.X = 2
Ukko.Y = 2
KoKo = 20 'Ruutujen koko
ReNd
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'jos nuolinäppäintä painetaan ukko liikkuu
If KeyCode = vbKeyDown Then
Ukko.Y = Ukko.Y + 1
End If
If KeyCode = vbKeyUp Then
Ukko.Y = Ukko.Y - 1
End If
If KeyCode = vbKeyRight Then
Ukko.X = Ukko.X + 1
End If
If KeyCode = vbKeyLeft Then
Ukko.X = Ukko.X - 1
End If
'Jos ukko yrittää mennä alueen yli
If Ukko.X > 5 Then Ukko.X = 5
If Ukko.X < 0 Then Ukko.X = 0
If Ukko.Y > 5 Then Ukko.Y = 5
If Ukko.Y < 0 Then Ukko.Y = 0
ReNd
End Sub
Private Sub ReNd()
For X = 0 To 5
For Y = 0 To 5
kartta(X, Y) = 0 'tekee alueesta maata
kartta(Ukko.X, Ukko.Y) = 1 'merkitsee ukon olinpaikan
karttary = Y * KoKo + KoKo
karttarx = X * KoKo + KoKo
If kartta(X, Y) = 1 Then Line (X * KoKo, Y * KoKo)-(karttarx, karttary), RGB(255, 0, 0), BF 'piirretään ukko
If kartta(X, Y) = 0 Then Line (X * KoKo, Y * KoKo)-(karttarx, karttary), RGB(0, 0, 255), BF 'piirretään maa
Form1.Caption = Ukko.X & "," & Ukko.Y
Next
Next
End SubAihe on jo aika vanha, joten et voi enää vastata siihen.