Le jeu de labyrinthe fun et gratuit - Retour au site
 
							 
							
						 14
  14   
								
								Xaumina
En fait, ce que je veux, c'est la formule qui concerne l'eau, la bouée et le plugin de la bouée. Vous l'avez deviné, c'est pour faire un terrain ciel qu'on peut survoler avec des ailes, et qui fait apparaître un plugin quand on va sur le terrain (ce serait un terrain en plus, pas sur le terrain ciel directement).
actions
  GoOnMyWater;
field TMyWater
  name 'Mon eau';
  image 'Fields/Water';
  // Permettre de passer au-dessus avec la planche
  on message Plank do
  begin
    if Kind = pmkPassOver then
      not Player.AbleTo(GoOnMyWater);
  end;
  // Appliquer le fondu des terrains avoisinant
  on DoDraw do
  begin
    inherited;
    DissipateGroundNeighbors(Context);
  end;
  // Empêcher de venir si ne peut pas GoOnMyWater
  on Entering do
  begin
    if Player can GoOnMyWater then
      Exit;
    Cancel;
    if KeyPressed then
      Player.ShowMessage('Il faudrait une bouée pour aller dans l''eau.');
  end;
  // Activer la bouée si on est téléporté dans l'eau
  on Entered do
  begin
    Player.DoAction(GoOnMyWater);
  end;
end;plugin TMyBuoyPlugin
  hint 'Plugin de la bouée';
  action GoOnMyWater;
  on AfterConstruction do
  begin
    PainterBefore.AddImage('Plugins/Buoy');
    inherited;
  end;
  on Moved do
  begin
    if not (DestSquare.Field is TMyWater) then
      Player.RemovePlugin(Self);
  end;
end;object TMyBuoy
  name 'Bouée';
  image 'Objects/Buoy';
  action GoOnMyWater then
    Player.AddPlugin(MyBuoyPlugin);
end;Hors-ligne
 
							 
							
						 9
  9   
								
								Hors-ligne
 
							 
							
						 14
  14   
								
								Hors-ligne
 
							 
							
						 14
  14   
								
								Xaumina
En fait, je pensai que la pierre passerait sous un pont, puisque ce n'est ni un effet, ni un terrain, ni un obstacle, ni un outil. mais ça bloque quand même. Est-ce que je pourrais avoir l'expression Fundelphi pour arranger ça ?
unit Rocks;
uses
  FunLabyBase, MovableBlocks, SimpleBridges;
components
  MyMovableBlock: TMyMovableBlock;
function IsBadForMoveRock(PosComponent: TPosComponent): Boolean;
begin
  Result := (PosComponent is TSquareModifier) and
    not (PosComponent is TSimpleBridge);
end;
poscomponent TMyMovableBlock(TMovableBlock)
  on IsMoveAllowed do
  var
    BehindQPos: TQualifiedPos;
    I: Integer;
    PosComp: TPosComponent;
  begin
    BehindQPos.Map := Context.Map;
    BehindQPos.Position := Behind;
    Result := IsDestSquareValid(Context, Context.Map[Behind]) and
      (not IsAnyPosComponent(BehindQPos, IsBadForMoveRock)) and
      (CanCrossZones or IsSameZone(Context.Map, Context.Pos, Behind));
    // Can only push the block under a bridge, not above
    if Result and IsAnyPosComponent(BehindQPos, TSimpleBridge) then
    begin
      for I := 0 to Master.PosComponentCount-1 do
      begin
        PosComp := Master.PosComponents[I];
        if (PosComp is TSimpleBridge) and
          SameQPos(BehindQPos, PosComp.QPos) then
        begin
          Result :=
            not (NegDir[Player.Direction] in TSimpleBridge(PosComp).OpenedDirs);
          Break;
        end;
      end;
    end;
  end;
end;
end.Pièces jointes :  SimpleBridges.fnd (2,2 KB)
 SimpleBridges.fnd (2,2 KB)
Hors-ligne
 
							 
							
						 5
  5   
								
								Hors-ligne
 
							 
							
						 5
  5   
								
								Modifié Xaumina (mars 7, 2011 13:52:49)
Hors-ligne
 
							 
							
						 14
  14   
								
								  on IsDestSquareValid do
  begin
    Result := (Square.Field is TGround) and
      (Square.Tool = nil) and (Square.Obstacle = nil);
  end;Hors-ligne
 
							 
							
						 5
  5   
								
								Modifié Xaumina (mars 7, 2011 18:22:22)
Hors-ligne
 
							 
							
						 14
  14   
								
								Xaumina
Où place-t-on la formule pour les effets ?
Xaumina
Je parlais aussi des pierres qui ne veulent pas aller sous les ponts (le formule ne fonctionnait pas).
 Pour avoir ça il faudrait plus que des Simple bridges.
 Pour avoir ça il faudrait plus que des Simple bridges.
 
					
						
						Hors-ligne
 
							 
							
						 5
  5   
								
								Hors-ligne