Autor Beitrag
mimi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: So 10.10.04 17:13 
Hallo,
ich habe meine spiele bis jetzt immer so geschrieben:
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:
const
  MapX    = 39;
  MapY    = 23;

  sLings  = 2;
  sRechts = 3;
  sOben   = 1;
  sUnten  = 0;

  None    =  -1;
  Wand    =  0;
  LS      = 1;
  Door    = 0;
  Lings   = True;
  Rechts  = False;

type
  TLS = record
    x,y,richtung,Speed,SpeedCount,ox,oy,l:Integer;
    Visible:Boolean;
  end;
  
  TSchalter = record
    open:Boolean;
    LeserIndex:array of Integer;
  end;

  TWand = record
    Typ:Integer;
    Name:String;
    Schalter:Tschalter;
  end;

  TLR = record
    //  Modu
    x,y,m,w,wc,t,tc,l,lc,o,oc,mt,mc,s,sc:Integer;
    isColision,dir,open,isM,isSchalter:Boolean;
  end;

  TPlayer = record
    x,y,px,py,richtung:Integer;
    is_C:Boolean;
  end;

  TLeser = Class
    private
      GFL:TGrafik;
      Map:array[0..MapX,0..MapY] of TWand;
      Leser:array of TLR;
      player:TPlayer;
      Tasten:array[0..256] of Boolean;
      l:TLS;
      procedure CreateLeser(x,y,m:Integer; isColision,isSchalter:Boolean);
      procedure CreateWand(x,y,Typ:Integer;li:array of Integer;Name:String);
      procedure ClearMap;
      procedure CreateLevel;
      procedure TimeLeser(Index:Integer);
      procedure DoorLeser(Index:Integer);
    public
      constructor Create(F1:TForm; GR:Integer);
      procedure Draw;
      procedure CheckKey(Key:Word;Vaule:Boolean);
  end;

ich dachte ich könnte mir das irgenwie einfach machen und dachte das mir dabei die OOP helfen könnte.

da ich jetzt bei meinem aktuellen spiel mehre objekte mit unterschiedlichem verhalten habe wollte ich gerne alles classen basieren schreiben.

habe auch schon angefnagen:
ausblenden 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:
unit u_Objekte;

interface

uses G,DX,OG,Forms,Dialogs,tools,Windows,SysUtils,Graphics;

type
  TColision = function(obj1,obj2:Integer):Boolean of object;

  TObj = class
    private

    public
      onColision:TColision;
      Name:String;
      x,y,tex,tag:Integer;

  end;


implementation


end.

diese classe soll sich nur um die objekt verwaltung kümmern nur ich weiß noch nicht genau wie ich das anstelle. wir tipps währe ich dankbar *G*
ich hoffe ihr wiss was ich meine.

_________________
MFG
Michael Springwald, "kann kein englisch...."
Lhid
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 831



BeitragVerfasst: Mo 11.10.04 15:37 
Meinung und mich grundlegend geändert-> alte beiträge gelöscht


Zuletzt bearbeitet von Lhid am Sa 26.09.09 12:55, insgesamt 1-mal bearbeitet
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 11.10.04 15:49 
Ich würd für TObj ne Forwared-Deklaration machen und dieses dann als Paramter-Typ für die Objects verwenden.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.