Events in between renders / frame rate

0 favourites
  • 6 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • I'm trying to create a custom particle system to leave trails behind objects. Think of it like drawing on screen. Where ever you move your mouse, a particle trail is left behind, which looks like a drawn line.

    Here's the problem...

    If you move too quickly, you get a dotted line, instead of a solid line. Lower frame rates also create a dotted line. It's completely frame rate dependant. Nothing happens between frames.

    I need a way to create particles in their proper locations, in between screen renders. (Bypass the frame rate.)

    Pretend my frame rate is 1. If I move my mouse across the screen, I need the engine to keep track of where each particle should have been created, and show the proper result at the end of one second. A line, no matter what frame rate or mouse speed.

    (Currently, all I would see is a dot where I started, and a dot where the mouse stopped.)

    **Note: Increasing particle flow rate has no effect. Nothing happens between frames.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You should probably do something like in the capx in this topic which has a dotted path drawn on touch.

  • The mouse position registers every tick, therefore if you move more than a pixel in a tick, you are going to have a gap and a dotted line. I would guess you would need to record the positions each tick and then using some maths fill in the missing pixels each tick. The easiest would be just a straight line between two points. With fancier maths and some higher order polynomials you would be able to smooth out the curve.

  • I removed all code you don't need from the capx in the topic I linked.

    online preview

    Edited Capx

  • Thanks for the replies! I'm going to investigate your suggestions.

    Still might be a problem, though...

    Drawing a solid path/line is just an example of the behavior I need.

    In actuality, I need the particles to be fully dynamic, like a normal particle system. Random rotation, speed, spray, etc.

    For instance, what about a smoke trail? I need to drop in smoke particles that never stop spraying at the proper rate, no matter the mouse speed or frame rate.

    I'm going to see if maybe LittleStain's example might be possible, somehow. I would appreciate any more feedback anyone has.

  • I think LittleStain's example might be what I'm looking for. Not sure yet. I don't understand some of the things happening in the capx yet, but I'm puzzling it out. I'll edit this post, later, with my findings.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)