Autor Beitrag
Marsi
Hält's aus hier
Beiträge: 7



BeitragVerfasst: Sa 18.09.04 18:23 
Hy Jungs
ich hab par fette fragen :?:
Ich hab angefangen ein Jump und run spiel zu programmieren
ich hab bei meinen Männel aber nich die dxspriteengine benutzt
krieg das aber irgenwie nicht hin
am besten ihr könnt mir mal nen link oder
ne E-mail schreiben wo ich ein Quellcodes zu einen Jump and run spiel finde am besten mit erklärungen

Das wäre nett
Danke schon mal im Vorraus :D :?:
Phobeus
ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1280

Linux (FC6), WinXP Pro (Box)
D6 Pers, D7 Pro, FPC 2.x
BeitragVerfasst: Sa 18.09.04 18:39 
Sag mal mit Verlauch...
"Ich brauche noch ein drei-stöckiges Familienhaus, bitte in der gleichen Ortschaft und mit autonomer Stromversorgung. Bitte bis zum Winter fertig und Schlüssel bei mir abgeben. Das wars auch schon."
Wenn Du nicht in der Lage bist so etwas zu konstruieren und daraus eine konkrete Frage zu machen, dann hat es auch keinen Sinn danach zu suchen. Eine Suchmaschine sind wir hier wohl kaum? Ich persönlich kriege bei "ein paar fetten Fragen" nämlich schnell ne Hals. (Das gilt nicht für das Forum oder andere Teilnehmer), aber vielleicht solltest Du doch mal lieber google fragen oder eine konkrete Frage stellen...

_________________
"Menschen sterben nicht wenn man sie zu Grabe trägt, sondern wenn sie ihre Träume verlieren..."
Marsi Threadstarter
Hält's aus hier
Beiträge: 7



BeitragVerfasst: Sa 18.09.04 18:51 
Also
ich hab bin so weit schon:
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:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
unit DXInputTut;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  DXClass, DXInput, DXDraws, DXSprite;

type
  TForm1 = class(TForm)
    DXInput1: TDXInput;
    DXTimer1: TDXTimer;
    DXDraw1: TDXDraw;
    DXImageList1: TDXImageList;
    DXTimer2: TDXTimer;
    procedure DXTimer1Timer(Sender: TObject; LagCount: Integer);
    procedure DXDraw1Initialize(Sender: TObject);
    procedure DXDraw1Finalize(Sender: TObject);
    
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  ManX : Integer;
  ManY : Integer;
  sprung: Integer;


implementation

uses Unit2;


{$R *.DFM}


procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
var
   I:Integer;
   StrVal : string;
   KeyImage : Integer;
begin
DXInput1.Update;

KeyImage := 2;


for i := 0 to DXInput1.Joystick.ButtonCount do
begin
     if DXInput1.Joystick.Buttons[i] = True then
     begin
          str(i,StrVal);
          MessageDlg(StrVal,mtInformation,[mbOK] ,0);
     end;
end;


if ((abs (manx - gegenx)) < 60) and ((abs(many - gegeny))< 60) then
begin
dxtimer1.Enabled:=false;
if MessageDlg('Game Over!!. Nochmal',
    mtConfirmation, [mbYes, mbNo], 0) = mrYes then
  begin
  ManX := 400;
manY := 400 ;

gegenX := 200;
gegenY := 200;
    dxtimer1.Enabled:=true;
  end
 else
 begin
 form2.show;
 end
end;


if isUp in  dxinput1.Keyboard.States then
begin
          KeyImage := 10; // Springen

          many:=many-10;
     end;

if isDown in dxinput1.Keyboard.States then
begin
KeyImage := 7; // Ducken
Many:=many + 5;
end ;


if isLeft in dxinput1.Keyboard.States then
begin
          KeyImage := 8; // Linkslaufen
          Manx:=manx - 10;
end ;

if isRight in dxinput1.Keyboard.States then
begin
          KeyImage := 5; // Rechtslaufen
          Manx:=manx+10;

end;


// Draw the background
DXImageList1.Items[0].Draw( DXDraw1.Surface,0,0,0);
// Draw the pointy thing using the Image indicated by the
// player1
Dximagelist1.Items[KeyImage].Draw( DXDraw1.Surface,ManX - round(Dximagelist1.Items[KeyImage].Width /2), manY - round(Dximagelist1.Items[KeyImage].Height /2)  ,0);

// Draw another ball to show a throttle control
// Flip the surfaces to disaply the changes
DXDraw1.Flip;



end;

procedure TForm1.DXDraw1Initialize(Sender: TObject);
begin

// Set up original positions for our sprites

ManX := 400;
manY := 400 ;

gegenX := 200;
gegenY := 200;

// Set the Maximum and Minimum Ranges for the Joystick
// This allows us to restrict the values returned from the joystick
DXInput1.Joystick.RangeX := 320 ;
DXInput1.Joystick.RangeY := 200 ;
DXInput1.Joystick.RangeZ := 200 ;

// Set the Deadzone properties
// The higher the value, the more you will have to move the joystick in order for
// a value to be registered

DXInput1.Joystick.DeadZoneX := 10;
DXInput1.Joystick.DeadZoneY := 10;
DXInput1.Joystick.DeadZoneZ := 10;

// Switch on the Timer, Let the game thing commence
form2.Show;

end;

procedure TForm1.DXDraw1Finalize(Sender: TObject);
begin
// Disable the Timer, no more DirectX objects must be referenced

DXTimer1.Enabled := False;
Dxtimer2.enabled:= false;


end;



end.


1.So wenn ich aber "up" drücke ist der MAN (Player1) weiter oben und kommt nich wieder runter
wie geht so was?? :?:
(OK ich kann mich nicht sehr gut ausdrücken :oops: )

2.Wenn ich jetzt Gegenstände einbaue wie macht man das er nich durch sie hindurchgehen kann?
DANKE!

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
Maweki
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 197

Ubuntu Linux
Lazarus
BeitragVerfasst: Sa 18.09.04 19:04 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
if isUp in  dxinput1.Keyboard.States then  
begin  
          KeyImage := 10; // Springen  

 
          many:=many-10;  
     end;


1. Warum hast du Deutsch UND Englisch kommentiert. Oder ist das teilweise garnich dein Code?
2. Nach dem Springen mit nem Timer oder ner Schlife die Figur langsam wieder die 10 ebenen (oder Pixel, was auch immer) wieder runterfallen lassen
3.
Kollisionsabfrage...
Marsi Threadstarter
Hält's aus hier
Beiträge: 7



BeitragVerfasst: Sa 18.09.04 19:19 
Und wie kann ich es langsam herunterfallen lassen
( :?: )
Maweki
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 197

Ubuntu Linux
Lazarus
BeitragVerfasst: Sa 18.09.04 19:24 
machste nen extra Timer. Und da machste, sagen wir mal 20ms
und dann machste in das Ontimer, dass der eine Ebene runtersackt. Und dann Aktivierste den Timer, sobald er oben is, und deaktivierst ihn (im OnTimer-Event), wenn er wieder unten angekommen ist. Die selbe Methode würde ich fürs Springen empfehlen...
mimi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: So 19.09.04 07:22 
ich kann dir wohl qullcode von meinen spielen geben, aber ob du da duchsteigen wirst ?
ein kleienr auszug:
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:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
procedure TBO.MoveBall(Index,Speed:Integer);
var
  x,y,r,i:Integer;
begin
  if Pause = True then exit;

  // Wenn der Ball am Spielfeldrand berührt
  if (Ball[index].x-speed) < 0 then Ball[index].isLeft:=Rechts;

  if ((Ball[index].x+16)+speed) >= 640 then Ball[index].isLeft:=Lings;

  if ((Ball[index].y)-speed) <= 0 then Ball[index].isTop:=Unten;

  // Wenn der Ball den Player berührt
  if GFL.kollision(3,2,ball[index].x,ball[index].y,player.x,player.y,0,0) = True then begin
    Randomize;
    Ball[index].isTop:=Oben;
    r:=Random(2);
    ran:=r;
    if r = 0 then Ball[index].isLeft:=False;
    if r = 1 then Ball[index].isLeft:=True;
  end;

  // Wenn der Ball ein Stein berührt
  for x:=0 to MapX do begin
    for y:=0 to MapY do begin
                         
      if (Steine[x,y].Tex > None) then begin
        if (GFL.kollision(4,3,x*mapS,y*MapS,ball[index].x,ball[index].y,1,Steine[x,y].Tex) = True) then begin
          if Ball[index].isTop = Oben then begin
            Ball[index].isTop:=Unten;
            Ball[index].isLeft:=Boolean(Random(2));
            Steine[x,y].Tex:=-1;
          end
          else begin
            Ball[index].isTop:=Oben;
            Ball[index].isLeft:=Boolean(Random(2));
            Steine[x,y].Tex:=-1;
          end;
        end; // Kollision
      end; // Steine > None
    end; // y
  end; // x

// Wenn ein Item den Ball berührt
  for i:=0 to high(Items) do begin
    if (Items[i].sTyp = 0) and (Items[i].Sichtbar = True) and (GFL.kollision(5,2,Ball[index].x, Ball[index].y , Items[i].x *MapS,Items[i].y*MapS,0,0)) then
      Items[i].Sichtbar:=False;

    if (Items[i].sTyp = 1) and (Items[i].Sichtbar = True) and (GFL.kollision(5,2,Ball[index].x, Ball[index].y , Items[i].x *MapS,Items[i].y*MapS,0,0)) then begin
      if Ball[index].isTop = Oben then begin
        Ball[index].isTop:=Unten;
        Ball[index].isLeft:=Boolean(Random(2));
      end
      else begin
        Ball[index].isTop:=Oben;
        Ball[index].isLeft:=Boolean(Random(2));
      end;
    end;
  end;

// Wenn Bälle zusammen stoßen
  for i:=0 to HIGH(Ball) do begin
    if i <> index then begin 
      if GFL.kollision(3,3,ball[i].x,ball[i].y,ball[index].x,ball[index].y,0,0) then begin
        if Ball[index].isTop = Oben then begin
          Ball[index].isTop:=Unten;
          Ball[index].isLeft:=Boolean(Random(2));
        end
        else begin
          Ball[index].isTop:=Oben;
          Ball[index].isLeft:=Boolean(Random(2));
        end;
      end;            
    end
  end;

// Position vom Ball ändern  
  if ball[index].isLeft = Lings then
    Ball[index].x:=Ball[index].x-speed
  else
    Ball[index].x:=Ball[index].x+speed;

  if ball[index].isTop = Oben then
    Ball[index].y:=Ball[index].y-speed
  else
    Ball[index].y:=Ball[index].y+speed;

end;

procedure TBO.CheckKey;
var
  px:Integer;
begin

  if (GetKeyState(ord('P')) = True) and ( DownKeyTime >= 5) then begin
    Pause:=Not Pause;
    DownKeyTime:=0;
  end;

  if Pause = False then begin
    DownKeyTime:=DownKeyTime+1;
    px:=Player.x;
    if GetKeyState(VK_ESCAPE) then begin
      Halt;
      exit;
    end;

    if GetKeyState(VK_LEFT) = True then px:=px-2;
    if GetKeyState(VK_RIGHT) = True then px:=px+2;

    if GetKeyState(VK_F2) and ( DownKeyTime >= 5) then begin
      Music.AddMusik(MusikListe.strings[random(MusikListe.Count-1)]);
      Music.randomMusik;
    end;

    if (GetKeyState(VK_Tab) = True) and ( DownKeyTime >= 5) then begin
      GFL.SetFullFrameModus;
      DownKeyTime:=0;
    end;

    if (GetKeyState(VK_F3) = True) and ( DownKeyTime >= 5) then begin
      LoadLevel(GetExeDir + 'level\std_level\1.txt');
    end;

    if (GetKeyState(ord('A')) = True) and ( DownKeyTime >= 5) and (Length(Ball) = 1) then begin
      Player.AutoPlay:=not Player.AutoPlay;
      DownKeyTime:=0;
    end;

    if (GetKeyState(ord('B')) = True) and ( DownKeyTime >= 5) then begin
      Randomize;
      ADD_BALL(random(MapX*MapS ),random(MapY*mapS ));
      DownKeyTime:=0;
    end;

    if (GetKeyState(ord('G')) = True) and ( DownKeyTime >= 5) then begin
      AddG(High(Items)+1);
      DownKeyTime:=0;
    end;

    if (GetKeyState(ord('C')) = True) and ( DownKeyTime >= 5) then begin
      SetLength(Items,0);
      DownKeyTime:=0;
     end;

    if (GetKeyState(ord('E')) = True) and ( DownKeyTime >= 5) then begin
      SetLength(Ball,1);
      DownKeyTime:=0;
    end;

    if DownKeyTime >=5 then DownKeyTime:=0;

    if ((px-16) div mapS >= 0 ) and ((px+16) div mapS < MapX) then
      Player.x:=px;
  end;
end;

das ist nur ein kleiner auszug: ich nutze delphiX und eine zusammenfasung davon die ich geschrieben habe damit ich es einfacher habe, es gibt mind 10.000 tutors über delphiX einfach mal: Suche bei Google DELPHIX TUTORIAL TUTORS KURSE

_________________
MFG
Michael Springwald, "kann kein englisch...."
Marsi Threadstarter
Hält's aus hier
Beiträge: 7



BeitragVerfasst: So 19.09.04 11:57 
Danke hat mir sehr geholfen :!: :!: :D :lol: 8)
mimi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: So 19.09.04 13:25 
das stichwort heißt:
Suche bei Google DELPHIX TUTORIAL

_________________
MFG
Michael Springwald, "kann kein englisch...."