Ciao a tutti
Vorrei un consiglio su un problema
Ho una picturebox che mi serve come "player", che tramite questo codice la faccio muovere:
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As IntPtr) As Short
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
If GetKeyState(87) < 0 OrElse GetKeyState(38) < 0 Then
PBPlayer1.Top -= 3
ElseIf GetKeyState(65) < 0 OrElse GetKeyState(37) < 0 Then
PBPlayer1.Left -= 3
ElseIf GetKeyState(68) < 0 OrElse GetKeyState(39) < 0 Then
PBPlayer1.Left += 3
ElseIf GetKeyState(83) < 0 OrElse GetKeyState(40) < 0 Then
PBPlayer1.Top += 3
End If
l'unico problema è che voglio creare dei "muri" che la picurebox non può attraversare, ho provato vari metodi ma nessuno di questi risolveva completamente il mio problema.
Grazie in anticipo![]()