Problem [Kollision programmieren]

G3kai

Grünschnabel
Hi,
Habe mir einen Code für Kollisions(-erkennung) angeschaut und an mein Programm angepasst.
Jetzt bekomme ich immer Fehler:

Code:
Private Sub Command1_Click()

  Dim feindLeft As Long, feindTop As Long, feindBreite As Long, feindHöhe As Long
  Dim wLeft As Long, wTop As Long, wBreite As Long, wHöhe As Long
  Dim aLeft As Long, aTop As Long, aBreite As Long, aHöhe As Long
  Dim sLeft As Long, sTop (-> Fehler) As Long, sBreite As Long, sHöhe As Long
  Dim dLeft As Long, dTop As Long, dBreite As Long, dHöhe As Long
  
  ' Koordinaten von Picturebox1 eintragen
  feindLeft = Feind.Left
  feindTop = Feind.Top
  feindBreite = Feind.Width
  feindHöhe = Feind.Height
  
  ' Koordinaten von Waffe eintragen
  wLeft = xW.Left
  wTop = xW.Top
  wBreite = xW.Width
  wHöhe = xW.Height
  
  aLeft = xA.Left
  aTop = xA.Top
  aBreite = xA.Width
  aHöhe = xA.Height
  
  sLeft = xS.Left
  sTop = xS.top (-> Fehler)
  sBreite = xS.Width
  sHöhe = xS.Height
  
  dLeft = xD.Left
  dTop = xD.Top
  dBreite = xD.Width
  dHöhe = xD.Height
  
  ' Kollision ?
  If Kollision(feindLeft, feindTop, feindBreite, feindHöhe, wLeft, wTop, wBreite, wHöhe, aLeft, aTop, aBreite, aHöhe, sLeft, sTop (-> Fehler), sBreite, sHöhe, dLeft, dTop, dBreite, dHöhe) = True Then
    ' Feind ausschalten
    Feind.Visible = False
  End If

End Sub


Ich verstehe nicht, warum z.B. bei
Code:
Dim sLeft As Long, sTop As Long, sBreite As Long, sHöhe As Long
ein Fehler kommt, aber bei
Code:
Dim dLeft As Long, dTop As Long, dBreite As Long, dHöhe As Long
nicht...
Diese Fehlermeldung lautet z.B.:
Compile Error:
Expected: variable



Könnte da wer helfen?


#EDIT:
Lösung gefunden.
War ein ziemlich dummer Fehler, ist mir aber erst jetzt aufgefallen:
"Stop" ist wohl ein festgelegter VB Befehl, wusste ich nicht-das Problem war also einfach nur, dass da "sTop(also STOP)" stand.
 
Zuletzt bearbeitet:

Neue Beiträge

Zurück