Events in between renders / frame rate

Get help using Construct 2

Post » Thu Oct 03, 2013 6:37 am

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.
B
8
S
3
G
1
Posts: 16
Reputation: 1,341

Post » Thu Oct 03, 2013 7:10 am

You should probably do something like in the capx in this topic which has a dotted path drawn on touch.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Oct 03, 2013 9:14 am

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.
B
13
S
4
Posts: 67
Reputation: 1,270

Post » Thu Oct 03, 2013 9:32 am

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

online preview

Edited Capx
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Oct 03, 2013 8:23 pm

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.
B
8
S
3
G
1
Posts: 16
Reputation: 1,341

Post » Thu Oct 03, 2013 11:21 pm

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.
B
8
S
3
G
1
Posts: 16
Reputation: 1,341


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 32 guests