How do I drag multiple sprites smoothly?

Get help using Construct 2

Post » Mon Nov 02, 2015 1:33 pm

I have a sprite that is draggable. There are a few smaller sprites positioned on/around this sprite that need to stay in there correct spot when the parent is dragged. I have this working fine, but there is one big problem. The smaller sprites lag pretty far behind the parent when it's dragging. It looks bad. Is there a correct way to do this so they will move at the same speed as the parent?

Thank you very much for any advice :-)
B
13
S
4
Posts: 280
Reputation: 1,578

Post » Mon Nov 02, 2015 1:36 pm

Oh Ok, there is the "pin" behavior. I'll try this. Hopefully the sprites will stay together smoothly with this.
B
13
S
4
Posts: 280
Reputation: 1,578

Post » Mon Nov 30, 2015 3:28 pm

Pin does the trick, but other objects lag behind like a trail of ducklings. Nothing can be done to fix.
B
13
S
4
Posts: 280
Reputation: 1,578

Post » Mon Nov 30, 2015 4:57 pm

Pinning should do the trick..
Could it be you are pinning every tick instead of once?

Without seeing your events/capx the question is hard to answer..
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 » Mon Nov 30, 2015 5:06 pm

LittleStain wrote:Pinning should do the trick..
Could it be you are pinning every tick instead of once?

Without seeing your events/capx the question is hard to answer..


Even dragging just 1 sprite around on the screen (nothing pinned) lags behind the mouse cursor. Even in the NW.js export. A little better in the export, but still noticeable. I have a modern laptop (i7 4810, 16GB RAM) too so I think it's just an inherent performance issue with JavaScript games. I don't think there is a solution other than using another tool and building a native app.

I'm doing what I can to minimize the visual performance things. I think it will be Ok.

Question: Is there any way to completely turn off Physics in the whole game? I don't need any.
B
13
S
4
Posts: 280
Reputation: 1,578

Post » Mon Nov 30, 2015 5:40 pm

locohost wrote:
LittleStain wrote:Pinning should do the trick..
Could it be you are pinning every tick instead of once?

Without seeing your events/capx the question is hard to answer..


Even dragging just 1 sprite around on the screen (nothing pinned) lags behind the mouse cursor. Even in the NW.js export. A little better in the export, but still noticeable. I have a modern laptop (i7 4810, 16GB RAM) too so I think it's just an inherent performance issue with JavaScript games. I don't think there is a solution other than using another tool and building a native app.

I'm doing what I can to minimize the visual performance things. I think it will be Ok.

Question: Is there any way to completely turn off Physics in the whole game? I don't need any.


If you haven't added the physics behaviour, it isn't present..
I've never really noticed a lag while dragging anything other than DOM elements..
Could it be something else is interfering with the behaviour?
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 » Mon Nov 30, 2015 5:47 pm

LittleStain wrote:
locohost wrote:
LittleStain wrote:Pinning should do the trick..
Could it be you are pinning every tick instead of once?

Without seeing your events/capx the question is hard to answer..


Even dragging just 1 sprite around on the screen (nothing pinned) lags behind the mouse cursor. Even in the NW.js export. A little better in the export, but still noticeable. I have a modern laptop (i7 4810, 16GB RAM) too so I think it's just an inherent performance issue with JavaScript games. I don't think there is a solution other than using another tool and building a native app.

I'm doing what I can to minimize the visual performance things. I think it will be Ok.

Question: Is there any way to completely turn off Physics in the whole game? I don't need any.


If you haven't added the physics behaviour, it isn't present..


I have not so I guess I'm Ok there.

I've never really noticed a lag while dragging anything other than DOM elements..
Could it be something else is interfering with the behaviour?


Does the number of events or type of events affect this? I have no "every tick" events. I do use a lot (well several, like 10ish) of event sheets, 1 sheet for each main game object to keep related code together. Would this have an effect on performance?

One last possibility: I'm working on a Win 10 VM. Maybe the VM is causing the lag?
B
13
S
4
Posts: 280
Reputation: 1,578

Post » Mon Nov 30, 2015 6:05 pm

You have absolutely no events that run every tick, or just no events where you use the condition system every tick?
Not that that would normally interfere, unless one of them has actions attached that conflict with the dragging..
Does the sprite you are dragging have any (other) movement behaviours attached, or are there events with actions setting it's position that could be conflicting/interfering?
Using multiple event-sheets and/or many events shouldn't have effect..
I guess the only reason the VM would have any effect is if it's somehow reducing framerate, or hasn't got enough memory/cpu/gpu assigned..
Did you check your framerate and (image) memory usage and cpu usage (using the debugger)?
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 » Mon Nov 30, 2015 6:08 pm

LittleStain wrote:You have absolutely no events that run every tick, or just no events where you use the condition system every tick?
Not that that would normally interfere, unless one of them has actions attached that conflict with the dragging..
Does the sprite you are dragging have any (other) movement behaviours attached, or are there events with actions setting it's position that could be conflicting/interfering?
Using multiple event-sheets and/or many events shouldn't have effect..
I guess the only reason the VM would have any effect is if it's somehow reducing framerate, or hasn't got enough memory/cpu/gpu assigned..
Did you check your framerate and (image) memory usage and cpu usage (using the debugger)?


No event using "Every tick" event.

It's a local Hyper-V so I can bump up the specs waaaaay up and try again this eve.
B
13
S
4
Posts: 280
Reputation: 1,578

Post » Mon Nov 30, 2015 6:10 pm

LittleStain wrote:You have absolutely no events that run every tick, or just no events where you use the condition system every tick?
Not that that would normally interfere, unless one of them has actions attached that conflict with the dragging..
Does the sprite you are dragging have any (other) movement behaviours attached, or are there events with actions setting it's position that could be conflicting/interfering?
Using multiple event-sheets and/or many events shouldn't have effect..
I guess the only reason the VM would have any effect is if it's somehow reducing framerate, or hasn't got enough memory/cpu/gpu assigned..
Did you check your framerate and (image) memory usage and cpu usage (using the debugger)?


No event using "Every tick" event.

It's a local Hyper-V so I can bump the specs waaaaay up and try again this eve. If that doesn't work I'll temporarily install C2 in the host OS and see what happens.
B
13
S
4
Posts: 280
Reputation: 1,578

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests