Attribute VB_Name = "mod_MAIN" ' version 0.1.1 ' debut de dessin et de reflexion le 13 juin 2000 au soir. ' debut de la programmation 14 juin 2000 au matin. ' maitrise de la logique. ' la prochaine etape est de reussir a changer les images. enlever les msgbox et rajouter une identifiant, quand un carre est rempli. ' prevoir l'allocation dynamique du tableau et de la grille pour le futur. ' penser au principe de joueur. separer les coups et les gains. ' cree un joueur "ordinateur" et tenter de rendre networking. ' version 0.2.0 ' 22 juillet 2000 de midi a 20h ! ' cleanage du code dans ultraedit. ' renommer fichier, modules, etc. ' faire une fonction qui construit la grille automatiquement. ' faire la feuille des options ' adapter le tout. Maintenant, j'obtiens le meme etat stade, sauf que je peux choisir la grandeur de la grille. ' Prochaine etape. correction des bug dans la feuille options pour le multijoueur. ' cree gif pour les autres joueurs. ' et cree le principe de joueur. ' prendre le temps de coder la fin de la partie serait pas mal itoo et ' commencer the Computer_Brain ;)))) Option Explicit Global Const v_version = "0.2.0" 'Global Const SMKIMAGEPATH = "c:\temp\closecircuit\web\images\dots\" Public SMKIMAGEPATH As String Public v_border As Integer Type Tab_Ligne Ligne(1 To 41) As Boolean End Type Global Tab_Grid(1 To 41) As Tab_Ligne Public Nombre_IMG As Long, _ My_Width_X As Long, _ My_Height_Y As Long, _ Nb_Player As Integer, _ Nb_Player_Old As Integer, _ CurrPlayer As Integer Sub Main() Dim fso As Variant Dim v_temp As Variant SMKIMAGEPATH = App.Path + "\images\" Nombre_IMG = 1 Nb_Player = 2 Nb_Player_Old = 2 CurrPlayer = 1 My_Width_X = 3 My_Height_Y = 3 Set fso = CreateObject("Scripting.FileSystemObject") If Not fso.FolderExists(SMKIMAGEPATH) _ Then 'MsgBox ("C:\Temp n'existe pas ...") 'fso.CreateFolder ("C:\Temp") 'MsgBox ("C:\Temp créé") v_temp = MsgBox("Installation problématique", vbCritical + vbOKOnly, "ERROR") End End If Load sht_Game1 sht_Game1.Show BuildGrid My_Width_X, My_Height_Y End Sub ' Cette fonction recoit un nombre en entree et retourne Vrai ' Si ce nombre est Pair, Faux sinon. Function EvenOdd(Number As Long) As Boolean Dim v_temp As Double v_temp = Number / 2 If InStr(v_temp, ",") = 0 Then EvenOdd = True Else EvenOdd = False End If End Function Function BuildGrid(Size_X As Long, Size_Y As Long) Dim ToolTipString As String Dim I As Long, _ X As Long, _ Y As Long, _ CurX As Long, _ CurY As Long, _ Nombre_X As Long, _ Nombre_Y As Long Nombre_X = (Size_X * 2) + 1 Nombre_Y = (Size_Y * 2) + 1 CurX = 240 CurY = 240 X = 1 Y = 1 If Nombre_IMG > 1 Then For I = 2 To Nombre_IMG Unload sht_Game1.img_game(I) Next I End If For I = 1 To Nombre_X * Nombre_Y If I <> 1 Then Load sht_Game1.img_game(I) End If sht_Game1.img_game(I).Visible = True 'sht_Game1.img_game(I).Index = I ToolTipString = I & " : CurX : " & CurX & "CuxY : " & CurY sht_Game1.img_game(I).Top = CurY sht_Game1.img_game(I).Left = CurX If (EvenOdd(Y)) = True Then sht_Game1.img_game(I).Height = 495 If EvenOdd(X) = True Then ' CENTRE : Zachsq.gif sht_Game1.img_game(I).Picture = LoadPicture(SMKIMAGEPATH + "transparent.gif") ' , vbLPLarge, vbLPColor) sht_Game1.img_game(I).Width = 495 CurX = CurX + 495 + 120 Else ' bluevertline.gif sht_Game1.img_game(I).Picture = LoadPicture(SMKIMAGEPATH + "transparent.gif") ' , vbLPLarge, vbLPColor) sht_Game1.img_game(I).Width = 135 CurX = CurX + 135 + 120 End If Else sht_Game1.img_game(I).Height = 135 If EvenOdd(X) = True Then ' bluehorizline.gif sht_Game1.img_game(I).Picture = LoadPicture(SMKIMAGEPATH + "transparent.gif") ' , vbLPLarge, vbLPColor) sht_Game1.img_game(I).Width = 495 CurX = CurX + 495 + 120 Else sht_Game1.img_game(I).Picture = LoadPicture(SMKIMAGEPATH + "dot.gif") ' , vbLPLarge, vbLPColor) sht_Game1.img_game(I).Width = 135 CurX = CurX + 135 + 120 End If End If sht_Game1.img_game(I).ToolTipText = ToolTipString & _ "H: " & sht_Game1.img_game(I).Height & _ "W: " & sht_Game1.img_game(I).Width X = X + 1 If X = (Nombre_X + 1) Then Y = Y + 1 X = 1 If Y <> (Nombre_Y + 1) Then CurX = 240 End If If EvenOdd(Y) = True Then CurY = CurY + 135 + 120 Else CurY = CurY + 495 + 120 End If End If Next I Nombre_IMG = (I - 1) sht_Game1.Width = CurX + 240 sht_Game1.Height = CurY + 240 + 645 End Function