Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Making game in Delphi

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
xiyuno
Newbie cheater
Reputation: 0

Joined: 09 Dec 2007
Posts: 17
Location: hey

PostPosted: Sun Oct 04, 2009 11:01 am    Post subject: Making game in Delphi Reply with quote

Im making a game from a tutorial, im not finished with it, bcoz it says somethings wrong..

Code:
unit FleeProsjekt;

interface

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

type
  TForm1 = class(TForm)
    Enemy: TShape;
    EnemyTimer: TTimer;
    Player: TShape;
    Panel1: TPanel;
    Start: TButton;
    Score: TLabel;
    LevelTimer: TTimer;
    Label1: TLabel;
    ScoreTimer: TTimer;
    procedure EnemyTimerTimer(Sender: TObject);
    procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure StartClick(Sender: TObject);
    procedure LevelTimerTimer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.EnemyTimerTimer(Sender: TObject);
Var
  Overlay: TRect;
begin
   // Simple AZ 
   If Enemy.Left < player.left then Enemy.Left := Enemy.Left + Level.Tag;
   If Enemy.Left > player.left then Enemy.Left := Enemy.Left - Level.Tag;
   If Enemy.Top < player.Top then Enemy.Top := Enemy.Top + Level.Tag;
   If Enemy.Top > player.Top then Enemy.Top := Enemy.Top - Level.Tag;

  // This is the collision detection code.
  If intersectRect(Overlay, player.BoundsRect, Enemy.BoundsRect)then begin
     // The enemy Caught the player.
     EnemyTimer.Enabled := False;
     LevelTimer.Enabled := False;
     ScoreTimer.Enabled := False;

     Showmessage('You lost');
     Start.Enabled := True;
  end;

end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
   If EnemyTimer.Enabled = True then begin
   Player.Left := X - Player.Width div 2;
   Player.Top := Y - Player.Height div 2;
 end;

end;

procedure TForm1.StartClick(Sender: TObject);
begin
  EnemyTimer.Enabled := True;

  // reset the game elements
  Enemy.Left := 8;
  Enemy.Top := 8;

  Player.Left := 392;
  Player.Top := 240;

  Level.Tag := 1;
  Level.Caption := '1';


  // Start the game timers
  Start.Enabled := False;
  LevelTimer.Enabled := True;
  ScoreTimer.Enabled := True;
end;

procedure TForm1.LevelTimerTimer(Sender: TObject);
begin
Level.Tag := Level.Tag + 1;
Level.Caption := IntToStr(Level.tag);
end;

end.

 



It says that theres something wrong here, but i cant see it.

// Simple AZ
If Enemy.Left < player.left then Enemy.Left := Enemy.Left + Level.Tag;
If Enemy.Left > player.left then Enemy.Left := Enemy.Left - Level.Tag;
If Enemy.Top < player.Top then Enemy.Top := Enemy.Top + Level.Tag;
If Enemy.Top > player.Top then Enemy.Top := Enemy.Top - Level.Tag;

_________________
Oh yeah? Yeah. Oh yeah? Yeah. Oh yeah? Yeah.
Oh yeah? Yeah. Oh yeah? God damn yeah!
Back to top
View user's profile Send private message MSN Messenger
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Sun Oct 04, 2009 11:22 am    Post subject: Reply with quote

What are the errors?
Back to top
View user's profile Send private message
xiyuno
Newbie cheater
Reputation: 0

Joined: 09 Dec 2007
Posts: 17
Location: hey

PostPosted: Sun Oct 04, 2009 11:24 am    Post subject: Reply with quote

[Error] FleeProsjekt.pas(95): ')' expected but identifier 'tag' found
[Error] FleeProsjekt.pas(95): Missing operator or semicolon


those

_________________
Oh yeah? Yeah. Oh yeah? Yeah. Oh yeah? Yeah.
Oh yeah? Yeah. Oh yeah? God damn yeah!
Back to top
View user's profile Send private message MSN Messenger
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Sun Oct 04, 2009 11:29 am    Post subject: Reply with quote

I'd assume the 95 indicates that it's on line 95, which is:
Code:
Level.Caption := IntToStr(Level.tag);
Back to top
View user's profile Send private message
xiyuno
Newbie cheater
Reputation: 0

Joined: 09 Dec 2007
Posts: 17
Location: hey

PostPosted: Sun Oct 04, 2009 11:34 am    Post subject: Reply with quote

Thank you, I'm very new to Delphi. I started Yesterday Razz
_________________
Oh yeah? Yeah. Oh yeah? Yeah. Oh yeah? Yeah.
Oh yeah? Yeah. Oh yeah? God damn yeah!
Back to top
View user's profile Send private message MSN Messenger
NoManchesPuto
I post too much
Reputation: 0

Joined: 24 Jan 2009
Posts: 2820

PostPosted: Mon Oct 05, 2009 8:04 pm    Post subject: Reply with quote

xiyuno wrote:
Thank you, I'm very new to Delphi. I started Yesterday Razz


Wow doing quite, well I could assist you if you need it. I've created several AQWorlds Trainers in Pascal (Delphi).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites