AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi Brauche ein "Map-System" oder sowas für ein spiel...
Thema durchsuchen
Ansicht
Themen-Optionen

Brauche ein "Map-System" oder sowas für ein spiel...

Ein Thema von Master_RC · begonnen am 31. Jan 2005 · letzter Beitrag vom 27. Feb 2005
Antwort Antwort
Seite 4 von 4   « Erste     234   
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
Benutzerbild von Khabarakh
Khabarakh

Registriert seit: 18. Aug 2004
Ort: Brackenheim VS08 Pro
2.876 Beiträge
 
#32

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

  Alt 27. Feb 2005, 16:46
Okay, also doch etwas anders wie du es oben beschrieben hast.
Delphi-Quellcode:
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;
Ich habe den Quelltext auch noch etwas verkürzt.
Sebastian
Moderator in der EE
  Mit Zitat antworten Zitat
Benutzerbild von Master_RC
Master_RC

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

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

  Alt 27. Feb 2005, 17:11
gut, das werd ich gleich mal überprüfen

und gekürzt?
find ich gut ^^

nochmals THX! THX! ...
Ein Volk ist nur soviel wert, wie es dessen Toten ehrt.
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 4 von 4   « Erste     234   


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:25 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz