Einzelnen Beitrag anzeigen

Benutzerbild von Master_RC
Master_RC

Registriert seit: 18. Jan 2005
459 Beiträge
 
Delphi 7 Enterprise
 
#31

Re: Brauche ein "Map-System" oder sowas für ein sp

  Alt 27. Feb 2005, 15:20
gut...

dann mach ich mal:

Delphi-Quellcode:
function MapRenew:boolean;
var i,ii: integer; MyRect,MyRect2: TRect; bitmap: TBitmap; ctype: string;
begin
ctype := ini.ReadString('Char','type','');
MyRect2 := Rect(0,0,32,32);
if charx < 1 then charx := 1;
if chary < 1 then chary := 1;
ini.WriteInteger('Char','mapx',charx);
ini.WriteInteger('Char','mapy',chary);
ini.UpdateFile;


form5.paintbox1.canvas.brush.style := bsclear;
for i := -2 to 2 do begin
 for ii := -2 to 2 do begin
   if unit5.charx+i > 0 then begin
    if unit5.chary+ii > 0 then begin
     Bitmap := TBitmap.Create;
     Bitmap.LoadFromFile('IMG/Map/'+map[charx+i,chary+ii].Textur);
     MyRect := Rect((charx*32)+(i*32),(chary*32)+(ii*32),(charx*32)+(i*32)+32,(chary*32)+(ii*32)+32);
     form5.PaintBox1.Canvas.BrushCopy(MyRect,Bitmap,MyRect2,clfuchsia);
     bitmap.Free;
    end else begin
      Bitmap := TBitmap.Create;
      Bitmap.LoadFromFile('IMG/Map/none.bmp');
      MyRect := Rect((charx*32)+(i*32),(chary*32)+(ii*32),(charx*32)+(i*32)+32,(chary*32)+(ii*32)+32);
      form5.PaintBox1.Canvas.BrushCopy(MyRect,Bitmap,MyRect2,clfuchsia);
      bitmap.Free;
      end;
   end else begin
      Bitmap := TBitmap.Create;
      Bitmap.LoadFromFile('IMG/Map/none.bmp');
      MyRect := Rect((charx*32)+(i*32),(chary*32)+(ii*32),(charx*32)+(i*32)+32,(chary*32)+(ii*32)+32);
      form5.PaintBox1.Canvas.BrushCopy(MyRect,Bitmap,MyRect2,clFuchsia);
      bitmap.Free;
   end;
 end;
Bitmap := TBitmap.Create;
MyRect := Rect((charx*32),(chary*32),(charx*32)+32,(chary*32)+32);
 if fileexists('DATA/TEMPLATES/'+ctype+'/char.bmp') then begin
  Bitmap.LoadFromFile('DATA/TEMPLATES/'+ctype+'/char.bmp');
 end else begin
  Bitmap.LoadFromFile('IMG/Map/nochar.bmp');
 end;
form5.PaintBox1.Canvas.BrushCopy(MyRect,Bitmap,MyRect2,clfuchsia);
bitmap.Free;
end;

result := true;
 if map[charx,chary].Teleportx <> 0 then begin
   if map[charx,chary].Teleporty <> 0 then begin
     form5.timer4.enabled := true;
   end;
 end;
end;
das record der variable "map" hat unter anderem folgende wichtige werte:
x,y: integer;
textur: string;

die vairablen "charx" und "chary" bestimmen den x-y-wert des charakters
Ein Volk ist nur soviel wert, wie es dessen Toten ehrt.
  Mit Zitat antworten Zitat