Autor Beitrag
pRoDiGyGER
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Mi 07.05.08 14:04 
hallo leute,
bin erst seit okt. 2007 am programmieren (delphi).
da ich in letzter zeit immer mehr programmiere und ich mir gedacht habe ich programmier mal ein kleines spiel, tauchte natürlich gleich ein fehler bzw. ein paar fragen auf:

ich möchte wenn ich auf die taste 1 drücke das die 2 images (die ich bewege (einmal mit WASD und mit dem Pfeiltasten)) jeweils andere icons laden!
aber ich meine jetzt nicht nur einfach so laden sondern sie sollen dann auch wieder auf knopfdruck gespiegelt werden (jeweiles 2 icons(1. gesicht links,2.gesicht nach rechts).

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Image1: TImage;
    Timer1: TTimer;
    Image2: TImage;
    Timer2: TTimer;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure Normal;
begin
//PFEILTASTEN
if GetAsyncKeyState($41)<0 then
begin
form1.image1.Picture.LoadFromFile('.\Mario LINKS.ico');
form1.image1.Left :=form1.image1.Left - 5;
end;
if GetAsyncKeyState($44)<0 then
begin
form1.image1.Picture.LoadFromFile('.\Mario.ico');
form1.image1.Left :=form1.image1.Left + 5;end;
if GetAsyncKeyState($53)<0 then
form1.image1.top :=form1.image1.top + 5;
if GetAsyncKeyState($57)<0 then
form1.image1.Top :=form1.image1.top - 5;
//WASD
if GetAsyncKeyState(VK_left)<0 then
begin
form1.image2.Picture.LoadFromFile('.\Luigi LINK.ico');
form1.image2.Left :=form1.image2.Left - 5; end;
if GetAsyncKeyState(VK_right)<0 then
begin
form1.image2.Picture.LoadFromFile('.\Luigi.ico');
form1.image2.Left :=form1.image2.Left + 5;end;
if GetAsyncKeyState(VK_down)<0 then
form1.image2.top :=form1.image2.top + 5;
if GetAsyncKeyState(VK_up)<0 then
form1.image2.Top :=form1.image2.top - 5;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
Normal;
//Modus
if GetAsyncKeyState($31)<0 then
image1.Picture.LoadFromFile('.\Red-Snapjaw.ico');
if GetAsyncKeyState($31)<0 then
image2.Picture.LoadFromFile('.\Blue-Snapjaw.ico');

//Bildende
if image1.Left<10 then image1.Left:=10;
if image1.Left>645 then image1.Left:=645;
if image1.Top<10 then image1.Top:=10;
if image1.Top>400 then image1.Top:=400;
if image2.Left<10 then image2.Left:=10;
if image2.Left>645 then image2.Left:=645;
if image2.Top<10 then image2.Top:=10;
if image2.Top>400 then image2.Top:=400;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Normal
end;

end.
Einloggen, um Attachments anzusehen!


Zuletzt bearbeitet von pRoDiGyGER am Mi 07.05.08 14:28, insgesamt 2-mal bearbeitet
GericasS
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 540

Windows Vista Home Premium
D2010, VisualStudio2008
BeitragVerfasst: Mi 07.05.08 14:07 
Poste ihn doch einfach mit den Delphi Tags

ausblenden Delphi-Quelltext
1:
Code					


weil das lesen von dem Quellcode in einer text datei ist durch die Formatierung einfach schrecklich :-D

LG

GericasS

_________________
Alexander N.
Neue Bewaffnung Amilo xi2428 T9300
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mi 07.05.08 14:25 
Und wenn du grad dabei bist, änder doch bitte auch direkt den Titel deines Threads. Quelltexte gibt es hier genug - der Titel sollte schon was über dein Problem sagen.