vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
SEPA-Dateien erstellen inkl. IBAN-, BLZ-/Kontonummernprüfung  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Fortgeschrittene Programmierung
Moorhun Fake?! 
Autor: Gigaherz
Datum: 19.05.02 19:45

Hi
ich Möchte ein moorhunähnliches spiel in visualbasic schreiben. Allerdings habe ich
beim fahren über das hintergrundbild ein Probolem. wenn ich mit dem Cursor über
eine festgelegte position auf dem Bild bin soll das bild sich bewegen allerdings wird die if-Schleife so oft durchgenommen so da das bild noch weiter scrollt wenn man mit
der maus wieder in die mitte geht wenn ich nach der bewegung die erneute abfrage
weglasse mus ich die maus hin und her bewegen damit sich das bild bewegt.
Damit ihr das besser versteht hier mal der quelltext:
******************************** Form1 *******************************

Option Explicit
Public yx As Boolean
Public Min&, Max&, Wert&

Private Sub Command1_Click()
End
End Sub

Private Sub Form_Load()

'Me.Timer1.Enabled = False
'yx = True
'Call Animation
Loading

Min = Picture1.Width - Form1.Width * -1
Max = Min + Picture1.Width - Huhn.Width - 10
Wert = 60
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim I
I = x
DoEvents
'flag = 0
If x < 700 + Picture1.Left * -1 Then
Wert = 120 & _
ScrollL(I)
End If
If x > -700 + Picture1.Left * -1 + Form1.Width Then
Wert = 120 * -1 & _
ScrollR(I)
If x <= Form1.Width Then
Wert = 60 & _
Mitte(I)
End If
End If
DoEvents
End Sub

************************************** Modul *********************************


Global flag&

Public Function ScrollL(x)
If Form1.Picture1.Left >= 0 Then
GoTo ende
End If
flag = 1
Form1.Picture1.Left = Form1.Picture1.Left + 15
If flag = 0 Then Exit Function
'_____________________________________________________
'If Form1.Command1.Left <> Form1.Picture1.Left Then
'Form1.Command1.Left = Form1.Command1.Left + 30
'End If
ende:
End Function

Public Function Mitte(x)
flag = 0
End Function

Public Function ScrollR(x)
Dim f, p, g
f = Form1.Width
p = Form1.Picture1.Width
g = p - f
If Form1.Picture1.Left <= g * -1 Then
GoTo ende
End If
flag = 2
Form1.Picture1.Left = Form1.Picture1.Left - 15
If flag = 0 Then Exit Function
'_____________________________________________________
'If Form1.Command1.Left <> Form1.Picture1.Left Then
'Form1.Command1.Left = Form1.Command1.Left - 30
'End If
ende:
End Function
Public Function Loading()

Form1.WindowState = vbMaximized
Dim fgw, fgh
Form1.Picture1.Picture = LoadResPicture(101, 0)
fgw = Form1.Width
fgh = Form1.Height
With Form1.Picture1
.Width = 23820
.Height = Form1.Height
End With
Dim img As Object
Set img = Form1.Picture1
img.Top = 0
Dim o, t
o = img.Width / 4 * -1
t = Form1.Width / 4
img.Left = o + t
End Function

Würde mich sehr über Antworten und Vorschläge freuen
Mfg
Gigaherz
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Moorhun Fake?!62Gigaherz19.05.02 19:45

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel