![]() |
Re: Brauche ein "Map-System" oder sowas für ein sp
gut...
dann mach ich mal:
Delphi-Quellcode:
das record der variable "map" hat unter anderem folgende wichtige werte:
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; x,y: integer; textur: string; die vairablen "charx" und "chary" bestimmen den x-y-wert des charakters |
Re: Brauche ein "Map-System" oder sowas für ein sp
Okay, also doch etwas anders wie du es oben beschrieben hast.
Delphi-Quellcode:
Ich habe den Quelltext auch noch etwas verkürzt.
var center: TPoint;
[...] center:=Point(form5.Paintbox1.Width div 2-16,form5.Paintbox1.Height div 2-16); for i := -2 to 2 do for ii := -2 to 2 do try Bitmap:=TBitmap.Create; MyRect := Rect(i*32+center.x,ii*32+center.y,i*32+center.x+32,ii*32+center.y+32); if (charx+i > 0) and (chary+ii > 0) then Bitmap.LoadFromFile('IMG/Map/'+map[charx+i,chary+ii].Textur) else Bitmap.LoadFromFile('IMG/Map/none.bmp'); form5.PaintBox1.Canvas.BrushCopy(MyRect,Bitmap,MyRect2,clfuchsia); finally bitmap.Free end; |
Re: Brauche ein "Map-System" oder sowas für ein sp
gut, das werd ich gleich mal überprüfen ;)
und gekürzt? find ich gut ^^ nochmals THX! THX! ... |
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:00 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz