Announcement

Collapse
No announcement yet.

better way to delay input?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • better way to delay input?

    i have this piece of code:

    Code:
    public class test : Behavior
    {
    private float delay = 1.0f; private float timePassed = 0; protected override void Update(TimeSpan gameTime) {
    timePassed += (float)gameTime.TotalSeconds; var input = WaveServices.Input.KeyboardState; if (input.D == WaveEngine.Common.Input.ButtonState.Pressed && timePassed >= delay) {
    //do action timePassed = 0;
    }
    }
    }
    is there a better way to achieve this behavior with wave engine?

  • #2
    Hey,

    i presume you want to block the input for a certain amount of time, right? Why don't you use a timer? I don't know if this is still working with the current engine version:

    https://github.com/WaveEngine/Docume...Create-a-timer

    Cheers
    Kande

    Comment


    • #3
      Originally posted by Kande View Post
      Why don't you use a timer?
      Kande
      thanks for answering.
      i thought about it, but it seem like a little bit of an overhead, but i'm going to test it though, what i was actually looking for is a common construct/functionality for this kind of scenario, since wave engine has a lot of functionality, i presumed that maybe there was a common way to do this.

      Comment


      • #4
        Hi bio3c, have a look at GameActions https://github.com/WaveEngine/Docume...ki/GameActions
        CreateWaitGameAction could be useful there

        Have a nice day, Juan!

        Comment


        • #5
          Originally posted by jacano View Post
          have a look at GameActions
          thanks, that's great, also the timers that Kande suggested.
          but both of them require many steps for what i'm trying to do, unless i'm doing it wrong, and unfortunately there are few examples, but i feel that they are very flexible,
          it would be much appreciated if you could provide any example that relates to my original question.

          Comment

          Working...
          X