Forum: Multimedia
Delphi
by Khabarakh,
27. Feb 2005
Okay, also doch etwas anders wie du es oben beschrieben hast.
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
Forum: Multimedia
Delphi
by Khabarakh,
27. Feb 2005
Okay, jetzt verstehe ich noch weniger :mrgreen: .
Du rufst es also etwa so auf:
for i := -2 to 2 do begin
for ii := -2 to 2 do begin
paintbox1.canvas.draw(i*32,ii*32,{Bitmap von Map});
end;
end;
Dann wird doch alles in die linke obere Ecke gezeichnet, die Hälfte außerhalb der Paintbox?
Ich denke, ohne mehr Quellcode kann ich dir nicht helfen.
Forum: Multimedia
Delphi
by Khabarakh,
27. Feb 2005
Paintbox1.Canvas.Draw(i*32+Paintbox1.Width div 2-Player.x*32-16,ii*32+Paintbox1.Height div 2-Player.Y*32-16,...);
So sollte es stimmen.
EDIT: Warumfor i := -2 to 2 do begin
for ii := -2 to 2 do begin ?
Sollte es nicht eher z.B.for i:=0 to High(Feld) do
for ii:=0 to High(Feld) sein?
Forum: Multimedia
Delphi
by Khabarakh,
5. Feb 2005
Was hat das mit dem Bitmap zu tun? Für die Bewegungen usw. greifst du auf deine TFeld-Variable zu:
if Key=VK_Left then
if (Spieler.x>0) and Feld.Begehbar then
begin
Spieler.x:=Spieler.x-1;
//usw.
end
else
//Bewegung nicht möglich
end;
Forum: Multimedia
Delphi
by Khabarakh,
4. Feb 2005
Dazu bräuchte der Record noch ein weiteres Feld:
TFeld = record
x: Integer; //X-Koordinate
y: Integer; //Y-Koordinate
Textur : String; //Texturpfad für das Feld
TexturPos: TPoint; //Position der Textur in der Textur-Datei
Jetzt lädst du die Textur-Datei in ein zusätzliches Bitmap und fügst dann den entsprechenden Bereich ein. Mal ein Beispiel mit BitBlt (ohne Scrollen):
begin