Hi,
I downloaded the lateset version, making sure the set virtual thing you mentioned in the post is no longer on the page and therefore implemented,
but unfortunately I am running into syntax error weirdness with other parts of the code, even though I make sure to paste it word for word.
I used the code from the “md3 tags” demonstration that comes with the project per usual, but then just pasted the code provided above as an addition on top.
The exact error I am getting is “an = where a : should be” even though that is the syntax you used in the above post for the class defintion of TCastleThirdPersonNavigation.
Do you know why this is, is it perhaps put in the wrong spot?
{
Copyright 2023-2023 Michalis Kamburelis.
This file is part of "Castle Game Engine".
"Castle Game Engine" is free software; see the file COPYING.txt,
included in this distribution, for details about the copyright.
"Castle Game Engine" is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
----------------------------------------------------------------------------
}
{ Main view, where most of the application logic takes place. }
unit GameViewMain;
interface
uses Classes,
CastleVectors, CastleComponentSerialize,
CastleUIControls, CastleControls, CastleKeysMouse;
type
{ Main view, where most of the application logic takes place. }
TViewMain = class(TCastleView)
TMyThirdPersonNavigation = class(TCastleThirdPersonNavigation)
protected
procedure SetAnimation(const AnimationNames: array of String); override;
published
{ Components designed using CGE editor.
These fields will be automatically initialized at Start. }
LabelFps: TCastleLabel;
public
constructor Create(AOwner: TComponent); override;
procedure Start; override;
procedure Update(const SecondsPassed: Single; var HandleInput: Boolean); override;
function Press(const Event: TInputPressRelease): Boolean; override;
end;
procedure TMyThirdPersonNavigation.SetAnimation(const AnimationNames: array of
begin
end;
)
var
ViewMain: TViewMain;
implementation
uses SysUtils;
{ TViewMain ----------------------------------------------------------------- }
constructor TViewMain.Create(AOwner: TComponent);
begin
inherited;
DesignUrl := 'castle-data:/gameviewmain.castle-user-interface';
end;
procedure TViewMain.Start;
var
MyNavigation: TMyThirdPersonNavigation;
begin
inherited;
MyNavigation := TMyThirdPersonNavigation.Create(FreeAtStop);
MyViewport.InsertBack(MyNavigation);
end;
procedure TViewMain.Update(const SecondsPassed: Single; var HandleInput: Boolean);
begin
inherited;
{ This virtual method is executed every frame (many times per second). }
Assert(LabelFps <> nil, 'If you remove LabelFps from the design, remember to remove also the assignment "LabelFps.Caption := ..." from code');
LabelFps.Caption := 'FPS: ' + Container.Fps.ToString;
end;
function TViewMain.Press(const Event: TInputPressRelease): Boolean;
begin
Result := inherited;
if Result then Exit; // allow the ancestor to handle keys
{ This virtual method is executed when user presses
a key, a mouse button, or touches a touch-screen.
Note that each UI control has also events like OnPress and OnClick.
These events can be used to handle the "press", if it should do something
specific when used in that UI control.
The TViewMain.Press method should be used to handle keys
not handled in children controls.
}
// Use this to handle keys:
{
if Event.IsKey(keyXxx) then
begin
// DoSomething;
Exit(true); // key was handled
end;
}
end;
end.