Bullet spawning from non-existent offset due to speed

0 favourites
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • R0J0hound is absolutely right, this is to do with the order of execution. The problem is the browser Gamepad API doesn't actually fire events. With keyboard input, pressing a key makes the browser fire a "keydown" event which fires Construct 2's 'On key pressed' trigger. On the other hand the Gamepad API just has an array of button states which you have to regularly check and see if something has changed. Construct 2 makes it look like gamepad input fires events by using an event that looks like a trigger, but is really evaluated every tick like normal events, and it internally uses logic like "is button down this tick but was up last tick", therefore practically firing like a trigger.

    However I think the execution order for each frame is something like this:

    1. Browser fires any pending events [possibly firing a keyboard input trigger]

    2. Behaviors tick (the bullet behavior will advance speed * dt pixels here)

    3. Events run [possibly firing a gamepad input trigger, since it checks it in the event]

    4. Screen is redrawn

    So the difference is whether or not the behavior is advanced the same tick as the input is triggered.

    I don't know if this really counts as a bug; Construct 2 is working correctly, it just is a consequence of the order things are checked in. I guess it's an inconsistency though. I'm not sure there's anything obvious we can do about it. The Gamepad API is due to get real browser events in a future update, so I guess that would solve it. Moving the bullet behavior to tick after events would also work, but that would have surprisingly severe compatibility implications, since a lot of games probably rely on fairly subtle edge cases like this and changing that would break them. I'm also not convinced it's really an important bug - whether or not the bullet advances one extra tick before you see it is only really noticable at extremely high speeds and also when you compare keyboard and gamepad input at the same time, whereas I think most players would just stick to one kind of input for the whole game.

    I'm not sure we'll do anything about this right now, but I'll leave this report open.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)