On-Screen Button Holdable

I apologize if this is a stupid question, but I have tried everything I can think of to make an on-screen button “holdable” (if the button is held, do x) but the default Button.OnClick is the closest I can get. Is there anyway to make it possible to, say, hold an on-screen button to continuously call something like WalkNavigation.MoveForward?

Hello!

In your view’s Update method (see Designing user interface and handling events (press, update) within the view | Manual | Castle Game Engine ), or in any OnUpdate event handler, just check is button Pressed and then do something . E.g.

procedure TMyView.Update(...);
begin
  inherited;
  if MyButton.Pressed then
    WalkNavigation.MoveForward;
end;

I can’t believe I never thought about that. Sorry! Thank you so much

1 Like