Drgn13
Messages postés86Date d'inscriptionvendredi 14 mars 2003StatutMembreDernière intervention26 mars 2007 30 oct. 2003 à 23:02
j'ai trouvé une technique pas mal pour accélérer la réaction des touches :
Dim X(100), Y(100), Z(100) As Integer
Dim tmpX(100), tmpY(100), tmpZ(100) As Integer
Dim K As Integer
Dim Zoom As Integer
Dim Speed As Integer
Dim droite As Boolean
Dim gauche As Boolean
Private Sub Form_Activate()
K = 2038
Speed = 0
Zoom = 256
Timer1.Interval = 1
For i = 0 To 100
X(i) = Int(Rnd * 1024) - 512
Y(i) = Int(Rnd * 1024) - 512
Z(i) = Int(Rnd * 512) - 256
Next i
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode vbKeyUp Then Speed Speed - 1
If Speed -7 Then Speed -6
If KeyCode vbKeyDown Then Speed Speed + 1
If Speed 1 Then Speed 0
If KeyCode vbKeyRight Then droite True: gauche = False
If KeyCode vbKeyLeft Then gauche True: droite = False
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode vbKeyRight Then droite False
If KeyCode vbKeyLeft Then gauche False
End Sub
Private Sub mnuQuitter_Click()
End
End Sub
Private Sub Timer1_Timer()
For i = 0 To 100
Circle (tmpX(i), tmpY(i)), 5, BackColor
Z(i) = Z(i) + Speed
If Z(i) > 255 Then Z(i) = -255
If Z(i) < -255 Then Z(i) = 255
tmpZ(i) = Z(i) + Zoom
tmpX(i) = (X(i) * K / tmpZ(i)) + (Simulator.Width / 2)
tmpY(i) = (Y(i) * K / tmpZ(i)) + (Simulator.Height / 2)
Radius = 1
StarColor = 256 - Z(i)
Circle (tmpX(i), tmpY(i)), 5, RGB(StarColor, StarColor, StarColor)
Next i
If droite Then Image1.Left = Image1.Left + 120
If gauche Then Image1.Left = Image1.Left - 120
End Sub
vr3h
Messages postés164Date d'inscriptionjeudi 6 mars 2003StatutMembreDernière intervention 9 octobre 2006 30 oct. 2003 à 09:50
Salut, bon alors j'ai jeté un rapide coup d'oeil à ton source (je suis au taf dc je px passer bcp de tps dessus pr le moment), cela dit ya 2 ou 3 petites choses ke je px te dire : la 1ere, c'est que si ton environnement parait 3D (c'est plutot pas mal fait pr un debutant), il vaut mieux voir l'arriere de ton shuttle et non pas le dessus, ensuite, l'image de ton shuttle est un peu petite, et tu pourrais l'agrandir, enfin, pour eviter qq pb graphiques comme les etoiles qui clignotent je ne saurai ke te conseiller de passer à DirectX 7 ou 8 si VB5 les gère. Après a toi de voir ce que tu vx faire :) A bientot ss doute
spy166
Messages postés207Date d'inscriptionjeudi 21 novembre 2002StatutMembreDernière intervention29 mars 2006 30 oct. 2003 à 00:04
n'est-ce pas ?
JoePatent
Messages postés171Date d'inscriptionjeudi 30 janvier 2003StatutMembreDernière intervention20 juillet 2008 29 oct. 2003 à 22:00
Tres constructif vos remarques....
AHp33
Messages postés13Date d'inscriptionsamedi 11 janvier 2003StatutMembreDernière intervention21 mai 2004 29 oct. 2003 à 12:58
La conneri non plus
spy166
Messages postés207Date d'inscriptionjeudi 21 novembre 2002StatutMembreDernière intervention29 mars 2006 29 oct. 2003 à 12:36
30 oct. 2003 à 23:02
Dim X(100), Y(100), Z(100) As Integer
Dim tmpX(100), tmpY(100), tmpZ(100) As Integer
Dim K As Integer
Dim Zoom As Integer
Dim Speed As Integer
Dim droite As Boolean
Dim gauche As Boolean
Private Sub Form_Activate()
K = 2038
Speed = 0
Zoom = 256
Timer1.Interval = 1
For i = 0 To 100
X(i) = Int(Rnd * 1024) - 512
Y(i) = Int(Rnd * 1024) - 512
Z(i) = Int(Rnd * 512) - 256
Next i
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode vbKeyUp Then Speed Speed - 1
If Speed -7 Then Speed -6
If KeyCode vbKeyDown Then Speed Speed + 1
If Speed 1 Then Speed 0
If KeyCode vbKeyRight Then droite True: gauche = False
If KeyCode vbKeyLeft Then gauche True: droite = False
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode vbKeyRight Then droite False
If KeyCode vbKeyLeft Then gauche False
End Sub
Private Sub mnuQuitter_Click()
End
End Sub
Private Sub Timer1_Timer()
For i = 0 To 100
Circle (tmpX(i), tmpY(i)), 5, BackColor
Z(i) = Z(i) + Speed
If Z(i) > 255 Then Z(i) = -255
If Z(i) < -255 Then Z(i) = 255
tmpZ(i) = Z(i) + Zoom
tmpX(i) = (X(i) * K / tmpZ(i)) + (Simulator.Width / 2)
tmpY(i) = (Y(i) * K / tmpZ(i)) + (Simulator.Height / 2)
Radius = 1
StarColor = 256 - Z(i)
Circle (tmpX(i), tmpY(i)), 5, RGB(StarColor, StarColor, StarColor)
Next i
If droite Then Image1.Left = Image1.Left + 120
If gauche Then Image1.Left = Image1.Left - 120
End Sub
30 oct. 2003 à 09:50
30 oct. 2003 à 00:04
29 oct. 2003 à 22:00
29 oct. 2003 à 12:58
29 oct. 2003 à 12:36