Changeset 24 for trunk/UCore.pas


Ignore:
Timestamp:
Sep 28, 2011, 9:14:55 PM (13 years ago)
Author:
george
Message:
  • Fixed: Up to eight possible players with different colors.
  • Fixed: Damage done to correct player shield.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r23 r24  
    204204    (X: 0; Y: 1), (X: -1; Y: 1), (X: -1; Y: 0), (X: -1; Y: -1));
    205205
    206 var
    207   Engine: TEngine;
    208 
    209206function SwapBRComponent(Value: Integer): Integer; inline;
    210207
     
    427424    Color := TColor($b600b6);
    428425    Player := 3;
     426  end;
     427
     428  // Player 5 cannon
     429  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     430    Kind := mkCannon;
     431    Color := clYellow;
     432    Player := 4;
     433  end;
     434  // Player 5 home
     435  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     436    Kind := mkHome;
     437    Color := TColor($ffff2c);
     438    Player := 4;
     439  end;
     440  // Player 5 body1
     441  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     442    Kind := mkTankBody;
     443    Color := TColor($ffff2c);
     444    Player := 4;
     445  end;
     446  // Player 5 body2
     447  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     448    Kind := mkTankBody;
     449    Color := TColor($b6b600);
     450    Player := 4;
     451  end;
     452
     453  // Player 6 cannon
     454  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     455    Kind := mkCannon;
     456    Color := clYellow;
     457    Player := 5;
     458  end;
     459  // Player 6 home
     460  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     461    Kind := mkHome;
     462    Color :=  TColor($2cffff);
     463    Player := 5;
     464  end;
     465  // Player 6 body1
     466  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     467    Kind := mkTankBody;
     468    Color := TColor($2cffff);
     469    Player := 5;
     470  end;
     471  // Player 6 body2
     472  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     473    Kind := mkTankBody;
     474    Color := TColor($00b6b6);
     475    Player := 5;
     476  end;
     477
     478  // Player 7 cannon
     479  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     480    Kind := mkCannon;
     481    Color := clYellow;
     482    Player := 6;
     483  end;
     484  // Player 7 home
     485  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     486    Kind := mkHome;
     487    Color :=  TColor($008cff);
     488    Player := 6;
     489  end;
     490  // Player 7 body1
     491  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     492    Kind := mkTankBody;
     493    Color := TColor($008cff);
     494    Player := 6;
     495  end;
     496  // Player 7 body2
     497  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     498    Kind := mkTankBody;
     499    Color := TColor($002da0);
     500    Player := 6;
     501  end;
     502
     503  // Player 8 cannon
     504  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     505    Kind := mkCannon;
     506    Color := clYellow;
     507    Player := 7;
     508  end;
     509  // Player 8 home
     510  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     511    Kind := mkHome;
     512    Color :=  TColor($d0d0d0);
     513    Player := 7;
     514  end;
     515  // Player 8 body1
     516  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     517    Kind := mkTankBody;
     518    Color := TColor($d0d0d0);
     519    Player := 7;
     520  end;
     521  // Player 8 body2
     522  with TMatter(Matter.AddNew(TMatter.Create)) do begin
     523    Kind := mkTankBody;
     524    Color := TColor($707070);
     525    Player := 7;
    429526  end;
    430527end;
     
    666763          for P := 0 to Engine.Players.Count - 1 do
    667764          with TPlayer(Engine.Players[P]) do
    668           if Enabled and (TMatter(Engine.World.Matter[ItemsXY[Pos.X, Pos.Y]]).Kind = mkTankBody) then
     765          if (TMatter(Engine.World.Matter[ItemsXY[Pos.X, Pos.Y]]).Kind = mkTankBody) and
     766            (TMatter(Engine.World.Matter[ItemsXY[Pos.X, Pos.Y]]).Player = P) then
    669767            Shield := Shield - 1 / ShieldSteps;
    670768          if StopByDirt then Explosion(LastPos, BulletExplosionRange);
     
    11111209  with TPlayer(PlayerPool.AddNew(TPlayer.Create)) do begin
    11121210    Keys.Left := 76;
    1113     Keys.Down := 186;
     1211    Keys.Down := 147;
    11141212    Keys.Right := 222;
    11151213    Keys.Up := 80;
     
    11231221    Keys.Shoot := 105;
    11241222  end;
     1223  with TPlayer(PlayerPool.AddNew(TPlayer.Create)) do begin
     1224    Keys.Left := 0;
     1225    Keys.Down := 0;
     1226    Keys.Right := 0;
     1227    Keys.Up := 0;
     1228    Keys.Shoot := 0;
     1229  end;
     1230  with TPlayer(PlayerPool.AddNew(TPlayer.Create)) do begin
     1231    Keys.Left := 0;
     1232    Keys.Down := 0;
     1233    Keys.Right := 0;
     1234    Keys.Up := 0;
     1235    Keys.Shoot := 0;
     1236  end;
     1237  with TPlayer(PlayerPool.AddNew(TPlayer.Create)) do begin
     1238    Keys.Left := 0;
     1239    Keys.Down := 0;
     1240    Keys.Right := 0;
     1241    Keys.Up := 0;
     1242    Keys.Shoot := 0;
     1243  end;
     1244  with TPlayer(PlayerPool.AddNew(TPlayer.Create)) do begin
     1245    Keys.Left := 0;
     1246    Keys.Down := 0;
     1247    Keys.Right := 0;
     1248    Keys.Up := 0;
     1249    Keys.Shoot := 0;
     1250  end;
    11251251  for I := 0 to PlayerPool.Count - 1 do
    11261252  with TPlayer(PlayerPool[I]) do begin
     
    11291255    InitTanks;
    11301256    Name := SPlayer + ' ' + IntToStr(I + 1);
     1257    Enabled := True;
    11311258  end;
    11321259end;
     
    12301357  I2: Integer;
    12311358begin
     1359  Active := False;
    12321360  Players.Clear;
    12331361  for I := 0 to PlayerPool.Count - 1 do
     
    12421370  with TPlayer(Players[I]) do
    12431371    Init;
     1372  ClearBackground := True;
    12441373  Redraw;
     1374  Active := True;
    12451375end;
    12461376
Note: See TracChangeset for help on using the changeset viewer.