AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Delphi Projektarbeit - 2D Autorennen

Ein Thema von EpicProgger5000 · begonnen am 7. Feb 2014 · letzter Beitrag vom 3. Mär 2014
 
EpicProgger5000

Registriert seit: 7. Feb 2014
3 Beiträge
 
#1

Delphi Projektarbeit - 2D Autorennen

  Alt 7. Feb 2014, 11:34
Hallo,
Meine Gruppe und ich müssen nun im letzten Schuljahr noch eine Projektarbeit in Delphi 7 schreiben.
wir haben uns überlegt, ein 2d Autorennen zu erstellen.
Momentan hängen wir jedoch an 2 Dingen:
a) wie ändern wir die Lenkung so, das beide Autos korrekt fahren können?
b) wie teilen wir die Strecke in bestimmte bereiche, die von dem Auto nicht befahren werden können?
danke für eure Hilfe!

hier der Quelltext:

Code:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Image2: TImage;
    Image3: TImage;
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);

type Trotate = array[0..0] of TRGBQuad;
procedure bilddrehen(const Bitmap: TBitmap);
var P: PRGBQuad;
    x,y,b,h : Integer;
    RowOut: ^Trotate;
    help: TBitmap;
begin
  Bitmap.PixelFormat := pf32bit;
  help := TBitmap.Create;
  try
    help.PixelFormat := pf32bit;
    b := bitmap.Height;
    h := bitmap.Width;
    help.Width := b;
    help.height := h;
    for y := 0 to (h-1) do
    begin
      rowOut := help.ScanLine[y];
      P := Bitmap.scanline[bitmap.height-1];
      inc(p,y);
      for x := 0 to (b-1) do
      begin
        rowout[x] := p^;
        inc(p,h);
      end;
    end;
  finally
    bitmap.Assign(help);
    help.Free;
  end;
end;

procedure fahrtost;
begin
Image2.Left:=Image2.Left+5;
end;

procedure fahrtwest;
begin
Image2.Left:=Image2.Left-5;
end;

procedure fahrtnord;
begin
Image2.top:=Image2.top-5;
end;

procedure fahrtsued;
begin
Image2.top:=Image2.top+5;
end;


var i:integer;
begin
//If Key=vk_up then Image3.Left:=Image3.Left+5;
//If Key=vk_down then Image3.Left:=Image3.Left-5;
//If Key=vk_left then Image3.Top:=Image3.Top+-5   ;
//If Key=vk_right then Image3.Top:=Image3.Top+5  ;


//If Key=vk_numpad4 then Image2.Top:=Image2.Top+-5   ;
//If Key=vk_numpad6 then Image2.Top:=Image2.Top+5  ;



If Key=vk_left then
  begin
  for i:=1 to 3 do
  bilddrehen(image2.picture.bitmap);

  end;

If Key=vk_right then
    begin
    bilddrehen(image2.picture.bitmap) ;
        end;

If Key=vk_numpad4 then
  begin
  for i:=1 to 3 do
  bilddrehen(image3.picture.bitmap);
  end;
If Key=vk_numpad6 then bilddrehen(image3.picture.bitmap) ;

If (GetAsyncKeyState(vk_numpad8)<>0) then Image3.Left:=Image3.Left+5;
If (GetAsyncKeyState(vk_numpad2)<>0) then Image3.Left:=Image3.Left-5;

If Key=vk_up then fahrtost;

If Key=vk_down then fahrtwest;

if key=vk_numpad6 then fahrtsued;
if key=vk_numpad4 then fahrtnord;






end;

end.
  Mit Zitat antworten Zitat
 


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 00:40 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