La unit classe_entita:
unit classe_entita;
interface
var fuga:boolean;
var uscita:boolean;
type
entita=object
private
x:byte;
y:byte;
vettore_x:shortint;
vettore_y:shortint;
colore:byte;
public
procedure accendi_cursore(ascissa,ordinata,color:byte);
function get_x():byte;
function get_y():byte;
end;
implementation
uses wingraph,lib_mura;
procedure entita.accendi_cursore(ascissa,ordinata,color:byte);
var a:integer;
begin
case color of
1: setcolor(yellow);
2: setcolor(red);
3: setcolor(white);
4: setcolor(blue);
5: setcolor(green);
6: setcolor(orange);
else setcolor(black);
end;
for a:=ascissa*dimensione_cella+1 to ascissa*dimensione_cella+dimensione_cella do line(a,ordinata*dimensione_cella+1,a,ordinata*dimensione_cella+dimensione_cella);
end;
function entita.get_x():byte;
begin
get_x:=x;
end;
function entita.get_y():byte;
begin
get_y:=y;
end;
end.
La dichiarazione della classe ghosts che eredita da entita:
unit lib_entita;
interface
uses lib_mura,wingraph,wincrt,classe_entita;
type
ghosts=object (entita)
PRIVATE
cattiveria:byte;
lastwalked:smallint;
PUBLIC
constructor crea(ascissa,ordinata,colour,tinturia:byte);
procedure vettorizza(x_target,y_target:byte; terreno:campo);
procedure sposta(terreno:campo);
end;
Gli errori che ricevo:
C:\Documents and Settings\Ciccio\Desktop\pacman>ppc386 lib_entita.pas
Free Pascal Compiler version 2.4.0 [2009/12/18] for i386
Copyright (c) 1993-2009 by Florian Klaempfl
Target OS: Win32 for i386
Compiling lib_entita.pas
lib_entita.pas(74,3) Error: Identifier not found "x"
lib_entita.pas(75,3) Error: Identifier not found "y"
lib_entita.pas(76,15) Error: Identifier not found "x"
lib_entita.pas(76,21) Error: Identifier not found "y"
lib_entita.pas(77,11) Error: Identifier not found "vettore_x"
lib_entita.pas(78,11) Error: Identifier not found "vettore_y"
lib_entita.pas(79,8) Error: Identifier not found "colore"
lib_entita.pas(91,19) Error: Identifier not found "x"
lib_entita.pas(91,35) Error: Identifier not found "y"
lib_entita.pas(104,27) Error: Identifier not found "x"
lib_entita.pas(104,37) Error: Identifier not found "y"
lib_entita.pas(105,27) Error: Identifier not found "x"
lib_entita.pas(105,37) Error: Identifier not found "y"
lib_entita.pas(106,26) Error: Identifier not found "x"
lib_entita.pas(106,34) Error: Identifier not found "y"
lib_entita.pas(107,26) Error: Identifier not found "x"
lib_entita.pas(107,34) Error: Identifier not found "y"
lib_entita.pas(137,6) Error: Identifier not found "x"
lib_entita.pas(139,12) Error: Identifier not found "vettore_x"
lib_entita.pas(139,46) Error: Identifier not found "x"
lib_entita.pas(139,87) Error: Identifier not found "x"
lib_entita.pas(140,12) Error: Identifier not found "vettore_y"
lib_entita.pas(142,6) Error: Identifier not found "y"
lib_entita.pas(144,12) Error: Identifier not found "vettore_y"
lib_entita.pas(144,45) Error: Identifier not found "y"
lib_entita.pas(144,85) Error: Identifier not found "y"
lib_entita.pas(145,12) Error: Identifier not found "vettore_x"
lib_entita.pas(148,19) Error: Identifier not found "vettore_x"
lib_entita.pas(148,21) Error: Identifier not found "x"
lib_entita.pas(148,57) Error: Identifier not found "vettore_x"
lib_entita.pas(148,59) Error: Identifier not found "x"
lib_entita.pas(148,77) Error: Identifier not found "vettore_y"
lib_entita.pas(148,79) Error: Identifier not found "y"
lib_entita.pas(148,115) Error: Identifier not found "vettore_y"
lib_entita.pas(148,117) Error: Identifier not found "y"
lib_entita.pas(150,39) Error: Identifier not found "vettore_x"
lib_entita.pas(150,41) Error: Identifier not found "x"
lib_entita.pas(150,51) Error: Identifier not found "vettore_y"
lib_entita.pas(150,53) Error: Identifier not found "y"
lib_entita.pas(152,12) Error: Identifier not found "vettore_x"
lib_entita.pas(153,12) Error: Identifier not found "vettore_y"
lib_entita.pas(161,15) Error: Identifier not found "x"
lib_entita.pas(161,21) Error: Identifier not found "y"
lib_entita.pas(162,25) Error: Identifier not found "x"
lib_entita.pas(162,27) Error: Identifier not found "y"
lib_entita.pas(162,29) Error: Identifier not found "x"
lib_entita.pas(162,31) Error: Identifier not found "y"
lib_entita.pas(164,7) Error: Identifier not found "x"
lib_entita.pas(164,25) Error: Identifier not found "vettore_x"
lib_entita.pas(164,36) Error: Identifier not found "x"
lib_entita.pas(164,36) Fatal: There were 50 errors compiling module, stopping
Fatal: Compilation aborted