Bonjour,
J'ai deux macros : "Gauche" et "Monstres" :
Quand je lance "monstre" à partir d'un bouton, tout fonctionne correctement.
Le problème survient lorsque je lance "Monstres" à partir de "Gauche". Çà me parait incohérent...
Gauche :
Monstres :Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 Sub gauche() Application.Run "startUp()" If (Cells(xMax, yMin).Value <> "_/\_") Then For i = yMin To yMax + 1 Cells(xMax, i).Value = Cells(xMax, i + 1).Value Next i Else Cells(xMax, yMin).Value = "" Cells(xMax, yMax).Value = "_/\_" End If Application.Run "monstres()" Application.Run "balles()" End Sub
En me renseignant, j'ai vu que le problème aurait pu venir des "next", c'est pourquoi j'ai transformé les deux "next" en "next x" et "next y", mais le problème persiste toujours.Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 Sub monstres() MsgBox "debtut mosntersd" xMin = 101 xMax = 120 yMax = 21 yMin = 2 For x = xMin To xMax For y = yMin To yMax gx = xMax - x + xMin If Cells(gx, y).Value = "O" Then 'Monstre sur la derrnière ligne If gx = xMax - 1 Then MsgBox "perdu" ' monstre deant une balle ElseIf (Cells(gx + 1, y).Value = "|") Or (Cells(gx + 1, y).Value = "||") Or (Cells(gx + 1, y).Value = "|||") Then Cells(gx, y).Value = "" Cells(gx + 1, y).Value = "" 'Monstre devantn rien Else Cells(gx, y).Value = "" Cells(gx + 1, y).Value = "O" End If End If Next y Next x End Sub
Merci :)