This commit is contained in:
Alexandre 2025-01-03 10:41:28 +01:00
parent e1c482979b
commit 97f042d693
8 changed files with 34 additions and 26 deletions

BIN
again

Binary file not shown.

BIN
again.cmi

Binary file not shown.

BIN
again.cmx

Binary file not shown.

View File

@ -1078,7 +1078,7 @@ let seek_player (gd : game_data) (dgs : danger_map) =
let directn = path_seek gd dgs (gd.dt -. interval *. !remaining_dash) !cxi !cyi destx desty (player_range + int_of_float !remaining_dash) foundpath in let directn = path_seek gd dgs (gd.dt -. interval *. !remaining_dash) !cxi !cyi destx desty (player_range + int_of_float !remaining_dash) foundpath in
if !foundpath then begin if !foundpath then begin
found := true ; found := true ;
if logg then Printf.fprintf stderr "Found target (%d)\n" pl ; if logg then Printf.fprintf stderr "Found target (%d) [%d]\n" pl (int_of_float !remaining_dash) ;
if logg then Printf.fprintf stderr "(%d, %d) --[%d]--> (%d, %d)\n" !cxi !cyi directn destx desty ; if logg then Printf.fprintf stderr "(%d, %d) --[%d]--> (%d, %d)\n" !cxi !cyi directn destx desty ;
if destx = !cxi && desty = !cyi then begin if destx = !cxi && desty = !cyi then begin
if logg then Printf.fprintf stderr " Trapping\n" ; if logg then Printf.fprintf stderr " Trapping\n" ;
@ -1122,6 +1122,7 @@ let seek_player (gd : game_data) (dgs : danger_map) =
remaining_dash := max 0. (!remaining_dash -. 1.) remaining_dash := max 0. (!remaining_dash -. 1.)
done ; done ;
if logg then Printf.fprintf stderr "Success!\n" ; if logg then Printf.fprintf stderr "Success!\n" ;
remaining_dash := !remaining_dash +. 1. ;
true true
with with
| ReturnBool b -> b ;; | ReturnBool b -> b ;;
@ -1378,7 +1379,7 @@ print_dangers danger_data ;;*)
print_dangers danger_data ;;*) print_dangers danger_data ;;*)
if read_queue "again.sav" then begin if read_queue "again.sav" then begin
() remaining_dash := !remaining_dash +. 1.
end end
else begin else begin
let direction = ref 4 in let direction = ref 4 in

BIN
again.o

Binary file not shown.

View File

@ -1,21 +1,22 @@
69.28 107.0
1 0
13 21 13 21
1 1 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1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1
2 3 18 2 108.5
6 9 0 2 4 2 1 0 1
1 7 1 2 2 1 1 0 1 18 0 0 0 2 0 0
0 1
10 3 0

View File

@ -384,10 +384,6 @@ def execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, jo
joueur[J_PIEGESRESTANTS]-=1 joueur[J_PIEGESRESTANTS]-=1
pieges.append([i,j,indiceJoueur]) pieges.append([i,j,indiceJoueur])
print("||||| trap at", i, j, "|||||") print("||||| trap at", i, j, "|||||")
ip,jp = prochain(i,j,direction)
if plateau[ip][jp]==PLATEAU_VIDE and trouve_objet(ip, jp, bombes)==None:
joueur[J_LIGNE]=ip
joueur[J_COLONNE]=jp
i, j = joueur[J_LIGNE], joueur[J_COLONNE] i, j = joueur[J_LIGNE], joueur[J_COLONNE]
indicePiege = trouve_objet(i,j, pieges) indicePiege = trouve_objet(i,j, pieges)
@ -396,8 +392,18 @@ def execute_evenement(evenements, evenement, plateau, plateauCouleur, bombes, jo
piege = pieges[indicePiege] piege = pieges[indicePiege]
if piege[P_JOUEUR] != indiceJoueur: if piege[P_JOUEUR] != indiceJoueur:
penalite = 3 penalite = 3
print(indiceJoueur, "|||||||| has triggered", piege[P_JOUEUR], "'s trap (at", i, j, ")||||||||")
pieges.pop(indicePiege) pieges.pop(indicePiege)
ip,jp = prochain(i,j,direction)
if plateau[ip][jp]==PLATEAU_VIDE and trouve_objet(ip, jp, bombes)==None and penalite==0:
print(joueur[J_LIGNE], joueur[J_COLONNE], "--->", ip, jp)
joueur[J_LIGNE]=ip
joueur[J_COLONNE]=jp
else:
print("still")
i, j = joueur[J_LIGNE], joueur[J_COLONNE]
indicePowerup = trouve_objet(i,j,powerups) indicePowerup = trouve_objet(i,j,powerups)
if indicePowerup != None: if indicePowerup != None:
powerup = powerups.pop(indicePowerup) powerup = powerups.pop(indicePowerup)

View File

@ -1 +1 @@
1 0 4 0