Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

JEU


Information sur la source

Catégorie :Jeux Classé sous : jeu Niveau : Initié Date de création : 11/03/2001 Vu : 2 043

Note :
7 / 10 - par 3 personnes
7,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

Commentaire sur cette source (0)
Ajouter un commentaire et/ou une note

Description

mettre 4 label (caption = 0) 4 timer ( timer1 et 2 = 1 timer4=100 timer3=2700) et mettre 2 image (une picture et l'autre pict2)
timer1.enabled = false
 

Source

  • Private i
  • Option Explicit
  • Const cSoundBuffers = 10
  • 'Le code qui suit est de Nix
  • Dim X(50), Y(50), Velocity(50), Size(50) As Integer
  • Private Sub Form_Activate()
  • Randomize
  • For i = 1 To 50
  • X(i) = Int(Me.Width * Rnd)
  • Y(i) = Int(Me.Height * Rnd)
  • Velocity(i) = Int(500 - (Int(Rnd * 499)))
  • Size(i) = 16 * Rnd
  • Next
  • End Sub
  • Private Sub Timer4_Timer()
  • For i = 1 To 50
  • Circle (X(i), Y(i)), Size(i), BackColor
  • Y(i) = Y(i) + Velocity(i)
  • If Y(i) >= SOUND.Height Then
  • Y(i) = 0
  • X(i) = Int(SOUND.Width * Rnd)
  • End If
  • Circle (X(i), Y(i)), Size(i), vbWhite
  • Next
  • End Sub
  • Private Sub Form_Keydown(KeyCode As Integer, Shift As Integer)
  • If KeyCode = vbKeyLeft Then pict2.Left = pict2.Left - 40
  • If KeyCode = vbKeyRight Then pict2.Left = pict2.Left + 40
  • If KeyCode = vbKeySpace Then espace
  • If (pict2.Top >= Image1.Top) And (pict2.Top <= (Image1.Top + Image1.Height)) Then
  • If (pict2.Left >= Image1.Left) And (pict2.Left <= (Image1.Left + Image1.Width)) Then
  • End If
  • End If
  • End Sub
  • Private Sub Form_Load()
  • Me.BackColor = 0
  • End Sub
  • Private Sub espace()
  • Label1.Caption = pict2.Top
  • Timer1.Enabled = True
  • End Sub
  • Private Sub Timer1_Timer()
  • Dim dedans As Boolean
  • dedans = True
  • Label1.Caption = Label1.Caption - 90
  • pict2.Top = Label1.Caption
  • If (pointDedans(pict2.Top, pict2.Top + pict2.Height, pict2.Left, pict2.Left + pict2.Width, Image1.Left, Image1.Top)) = False Then
  • If (pointDedans(pict2.Top, pict2.Top + pict2.Height, pict2.Left, pict2.Left + pict2.Width, Image1.Left + Image1.Width, Image1.Top)) = False Then
  • If (pointDedans(pict2.Top, pict2.Top + pict2.Height, pict2.Left, pict2.Left + pict2.Width, Image1.Left, Image1.Top + Image1.Height)) = False Then
  • If (pointDedans(pict2.Top, pict2.Top + pict2.Height, pict2.Left, pict2.Left + pict2.Width, Image1.Left + Image1.Width, Image1.Top + Image1.Height)) = False Then
  • dedans = False
  • End If
  • End If
  • End If
  • End If
  • If dedans = True Then
  • Label4.Caption = Label4.Caption + 10
  • Image1.Left = Rnd * 3000
  • End If
  • If pict2.Top <= 0 Then
  • pict2.Top = 5520
  • Timer1.Enabled = False
  • End If
  • 'bonus
  • If Label4.Caption = 100 Then
  • MsgBox "Bonus de 50 points", vbExclamation, "bonus"
  • Label4.Caption = Label4.Caption + 50
  • End If
  • If Label4.Caption = 200 Then
  • MsgBox "Bonus de 50 points", vbExclamation, "bonus"
  • Label4.Caption = Label4.Caption + 50
  • End If
  • If Label4.Caption = 300 Then
  • MsgBox "Bonus de 50 points", vbExclamation, "bonus"
  • Label4.Caption = Label4.Caption + 50
  • End If
  • If Label4.Caption = 400 Then
  • MsgBox "Bonus de 50 points", vbExclamation, "bonus"
  • Label4.Caption = Label4.Caption + 50
  • End If
  • If Label4.Caption >= 500 Then
  • MsgBox "Vous avez gagné", vbExclamation, "Gagné"
  • End If
  • End Sub
  • Private Sub Timer2_Timer()
  • Label1.Caption = pict2.Top
  • Label2.Caption = pict2.Left
  • Label3.Caption = Image1.Left
  • End Sub
  • Private Function pointDedans(Base, Hauteur, Gauche, Droite, X, Y) As Boolean
  • pointDedans = False
  • If (X >= Gauche) And (X <= Droite) Then
  • If (Y >= Base) And (Y <= Hauteur) Then
  • pointDedans = True
  • End If
  • End If
  • End Function
  • Private Sub Timer3_Timer()
  • Image1.Left = Rnd * 3000
  • End Sub
Private i
Option Explicit
Const cSoundBuffers = 10
'Le code qui suit est de Nix
Dim X(50), Y(50), Velocity(50), Size(50) As Integer
Private Sub Form_Activate()

    Randomize
    For i = 1 To 50
        X(i) = Int(Me.Width * Rnd)
        Y(i) = Int(Me.Height * Rnd)
        Velocity(i) = Int(500 - (Int(Rnd * 499)))
        Size(i) = 16 * Rnd
    Next
End Sub



Private Sub Timer4_Timer()

    For i = 1 To 50
        Circle (X(i), Y(i)), Size(i), BackColor
        Y(i) = Y(i) + Velocity(i)
        If Y(i) >= SOUND.Height Then
            Y(i) = 0
            X(i) = Int(SOUND.Width * Rnd)
        End If
        Circle (X(i), Y(i)), Size(i), vbWhite
    Next
End Sub


Private Sub Form_Keydown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyLeft Then pict2.Left = pict2.Left - 40
If KeyCode = vbKeyRight Then pict2.Left = pict2.Left + 40
If KeyCode = vbKeySpace Then espace
If (pict2.Top >= Image1.Top) And (pict2.Top <= (Image1.Top + Image1.Height)) Then
If (pict2.Left >= Image1.Left) And (pict2.Left <= (Image1.Left + Image1.Width)) Then

End If
End If
End Sub

Private Sub Form_Load()
Me.BackColor = 0
End Sub
Private Sub espace()
Label1.Caption = pict2.Top
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
Dim dedans As Boolean
dedans = True
Label1.Caption = Label1.Caption - 90
pict2.Top = Label1.Caption
If (pointDedans(pict2.Top, pict2.Top + pict2.Height, pict2.Left, pict2.Left + pict2.Width, Image1.Left, Image1.Top)) = False Then
   If (pointDedans(pict2.Top, pict2.Top + pict2.Height, pict2.Left, pict2.Left + pict2.Width, Image1.Left + Image1.Width, Image1.Top)) = False Then
      If (pointDedans(pict2.Top, pict2.Top + pict2.Height, pict2.Left, pict2.Left + pict2.Width, Image1.Left, Image1.Top + Image1.Height)) = False Then
         If (pointDedans(pict2.Top, pict2.Top + pict2.Height, pict2.Left, pict2.Left + pict2.Width, Image1.Left + Image1.Width, Image1.Top + Image1.Height)) = False Then
           dedans = False
         End If
      End If
   End If
End If


If dedans = True Then
   Label4.Caption = Label4.Caption + 10
   Image1.Left = Rnd * 3000
End If
If pict2.Top <= 0 Then
pict2.Top = 5520
Timer1.Enabled = False
End If

'bonus
If Label4.Caption = 100 Then
MsgBox "Bonus de 50 points", vbExclamation, "bonus"
Label4.Caption = Label4.Caption + 50
End If
If Label4.Caption = 200 Then
MsgBox "Bonus de 50 points", vbExclamation, "bonus"
Label4.Caption = Label4.Caption + 50
End If
If Label4.Caption = 300 Then
MsgBox "Bonus de 50 points", vbExclamation, "bonus"
Label4.Caption = Label4.Caption + 50
End If
If Label4.Caption = 400 Then
MsgBox "Bonus de 50 points", vbExclamation, "bonus"
Label4.Caption = Label4.Caption + 50
End If
If Label4.Caption >= 500 Then
MsgBox "Vous avez gagné", vbExclamation, "Gagné"

End If
End Sub

Private Sub Timer2_Timer()
Label1.Caption = pict2.Top
Label2.Caption = pict2.Left
Label3.Caption = Image1.Left
End Sub

Private Function pointDedans(Base, Hauteur, Gauche, Droite, X, Y) As Boolean
pointDedans = False
If (X >= Gauche) And (X <= Droite) Then
If (Y >= Base) And (Y <= Hauteur) Then
pointDedans = True
End If
End If

End Function


Private Sub Timer3_Timer()
Image1.Left = Rnd * 3000

End Sub 

Conclusion

plus simple
http://perso.wanadoo.fr/steyer.ad/download/setup.exe
 

Commentaires et avis

Aucun commentaire pour le moment.

Ajouter un commentaire

Discussions en rapport avec ce code source dans le forum

Jeu de dames [ par Christophe ] Je cherche à réaliser un mini-jeu de dames. Sachant qu'on doit pouvoir ensuite gérer des événements Drag-Drop, quels types de contrôles dois-je utilis winamp et VB5 [ par Rescator ] bonjourj'utilise un petit prog ecris sous vb5 pour commander un jeu de lumière par le port // de mon PC. seulement j'aimerais récupérer le tempo de la bouger objet avet une manette de jeu? [ par ZIDANE ] Est ce que quelqu'un sait comment faire pour bouger un objet avec une mannette de jeu ordinaire ? (gamepad)Si vous avez la réponse pouvez vous me l'en Jeu de tir à la Rogue Spear [ par Nat ] Salut.Je développe un jeu de tir et j'ai grave besoin d'aide.Il me manque un graphiste et j'aimerais aussi savoir comment on fait pour interpréter la SOURCE JEU D'ECHEC [ par TOUATI ] POUR UN HANDICAPE SEMI VISUEL JE CHERCHE DES SOURCES POUR ADAPTER CE JEU A CES PROBLEMES POUR CELA JE CHERCHE /1/ les sources d'un jeu d'echec 2 / un Cmt afficher une fenetre par dessus un jeu windows ? [ par lechti62 ] Bonjour je voudrai savoir si il est possible quand un jeu Windows ou Direct Xest lancé, de pouvoir afficher un programme fait avec VB par dessus ce je Comment creer un serveur de jeux en reseaux? [ par Momo3dfx ] Salut a tous,j'ai un exellent site, sur un jeu, j'ai du matos pour faire un serveur, j'ai tout sauf l'expérience et el savoir faire.-Comment fait-on p AIDE DATA SVP ! [ par Seb ] Je fais un programme jeu :j ai une basse access que j accede grace au data de vb et j aimerai mettre a jour le score d'une personne à la fin d un jeu. Tri d'un fichier pour un jeu [ par @ thedentiste @ ] J'aimerai savoir comment peut on trier un fichierc'est pour faire une table des scores avec deux éléments le nom du joueur et le score Merci d'avance@ DX : aidez moi svp !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! [ par Ophidian ] a ceux qui sy connaissent et aux autres :dans la source du moteur3D en DX de je sais plus qui, on est dans un monde en 3D et on peut bouger. Comment f


Nos sponsors

Sondage...

CalendriCode

Janvier 2009
LMMJVSD
   1234
567891011
12131415161718
19202122232425
262728293031 

Consulter la suite du CalendriCode

Téléchargements

Logiciels à télécharger sur le même thème :



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel BAÏSE, Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,437 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.