Changeset 6 for trunk/UCore.pas
- Timestamp:
- Mar 6, 2011, 7:31:53 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r4 r6 282 282 end; 283 283 284 285 284 if Engine.KeyState[Ord(Keys.Shoot)] then 286 285 if Bullets.Count < MaxBulletCount then begin 287 286 NewBullet := TBullet.Create; 288 287 NewBullet.Player := Self; 289 NewBullet.Position := Position; 288 NewBullet.Position := Point(Position.X + DirectionToDelta[Direction].X * 4, 289 Position.Y + DirectionToDelta[Direction].Y * 4); 290 290 NewBullet.Direction := Direction; 291 291 Bullets.Add(NewBullet); … … 299 299 Position.Y := Position.Y + DirectionToDelta[Direction].Y; 300 300 301 if Engine.World.Surface.ItemsXY[Position.Y, Position.X] <> Byte(smNothing) then begin 302 if (Engine.World.Surface.ItemsXY[Position.Y, Position.X] = Byte(smDirt1)) or 303 (Engine.World.Surface.ItemsXY[Position.Y, Position.X] = Byte(smDirt2)) then 304 Engine.World.Surface.ItemsXY[Position.Y, Position.X] := Byte(smNothing); 305 Bullets.Delete(I); 306 end else 301 307 with Engine.World.Surface do 302 308 if (Position.X >= Count.X) or (Position.X < 0) or … … 304 310 Bullets.Delete(I) else 305 311 Engine.World.Surface.ItemsXY[Position.Y, Position.X] := Byte(smBullet); 312 Engine.Redraw; 306 313 end; 307 314 end; … … 313 320 begin 314 321 with Engine.FBitmapLower.Canvas do begin 315 Rectangle(ScreenFrame);316 322 Brush.Color := SurfaceMatterColors[smRock]; 317 323 FillRect(ScreenFrame); 318 319 324 320 325 with Engine.World do … … 326 331 Pixels[X, Y] := SurfaceMatterColors[TSurfaceMatter(Surface.ItemsXY[YY, XX])]; 327 332 end; 333 Pen.Color := clBlack; 334 Frame(ScreenFrame); 328 335 329 336 (*CopyRect(ScreenFrame, Engine.World.Surface.Canvas, … … 333 340 Position.X + (ScreenFrame.Right - ScreenFrame.Left) div 2, 334 341 Position.Y + (ScreenFrame.Bottom - ScreenFrame.Top) div 2));*) 335 TextOut(ScreenFrame.Left, ScreenFrame.Top, Name);342 //TextOut(ScreenFrame.Left, ScreenFrame.Top, Name); 336 343 //ShowMessage(IntToStr(ScreenFrame.Right - ScreenFrame.Left) + ' ' + 337 344 //IntToStr(ScreenFrame.Bottom - ScreenFrame.Top)); … … 361 368 var 362 369 X, Y: Integer; 370 XX, YY: Integer; 363 371 begin 364 372 Result := smNothing; 365 373 with Engine.World, TTank(Tanks[NewDirection]) do 366 374 for Y := 0 to Image.Count.Y - 1 do 367 for X := 0 to Image.Count.X - 1 do 375 for X := 0 to Image.Count.X - 1 do begin 376 XX := X + NewPosition.X - Image.Count.X div 2; 377 YY := Y + NewPosition.Y - Image.Count.Y div 2; 368 378 if (Image.ItemsXY[Y, X] > 0) and 369 (Surface.ItemsXY[Y + NewPosition.Y, X + NewPosition.X] <> Byte(smNothing)) then379 (Surface.ItemsXY[YY, XX] <> Byte(smNothing)) then 370 380 begin 371 381 Result := smDirt1; 372 if (Surface.ItemsXY[Y + NewPosition.Y, X + NewPosition.X] <> Byte(smDirt1)) and373 (Surface.ItemsXY[Y + NewPosition.Y, X + NewPosition.X] <> Byte(smDirt2)) then382 if (Surface.ItemsXY[YY, XX] <> Byte(smDirt1)) and 383 (Surface.ItemsXY[YY, XX] <> Byte(smDirt2)) then 374 384 begin 375 Result := TSurfaceMatter(Surface.ItemsXY[Y + NewPosition.Y, X + NewPosition.X]);385 Result := TSurfaceMatter(Surface.ItemsXY[YY, XX]); 376 386 Exit; 377 387 end; 378 388 end; 389 end; 379 390 end; 380 391 … … 387 398 begin 388 399 with Engine.World do begin 389 Surface.Merge(Surface.CreateIndex(Position.X, Position.Y), TTank(Tanks[Direction]).Image, ShowTankProc); 400 Surface.Merge(Surface.CreateIndex(Position.X - TTank(Tanks[Direction]).Image.Count.X div 2, 401 Position.Y - TTank(Tanks[Direction]).Image.Count.Y div 2), TTank(Tanks[Direction]).Image, ShowTankProc); 390 402 end; 391 403 end; … … 399 411 begin 400 412 with Engine.World do begin 401 Surface.Merge(Surface.CreateIndex(Position.X, Position.Y), TTank(Tanks[Direction]).Image, HideTankProc); 413 Surface.Merge(Surface.CreateIndex(Position.X - TTank(Tanks[Direction]).Image.Count.X div 2, 414 Position.Y - TTank(Tanks[Direction]).Image.Count.Y div 2), TTank(Tanks[Direction]).Image, HideTankProc); 402 415 end; 403 416 end;
Note:
See TracChangeset
for help on using the changeset viewer.