Bullet + Sine behaviour = jerky spawn

Get help using Construct 2

Post » Fri Aug 28, 2015 1:14 am

Hi, I am having a problem with spawning an actor into the scene with bullet and sine behaviour attached to him.

Initially, on spawn there is this wierd jerky movement, not only does this not look nice, also there are times when due to this he is thrown out of the scene even though I have set some boundaries. After spawning its all good, just during the spawning moment, he apears and then is yanked to the left or right by some pixels.

I would appreciate any help.

Thanks.

EDIT: The jerky spawn isnt happening all the time, its random. I should add that I am spawning actors in a random time frame too.
Brick by brick, stone by stone.
B
56
S
25
G
18
Posts: 273
Reputation: 13,363

Post » Fri Aug 28, 2015 1:35 am

It is hard to tell without looking at your events. Can you share the capx or screenshot of your events so everyone can better look at it.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

Post » Fri Aug 28, 2015 1:49 am

rekjl wrote:It is hard to tell without looking at your events. Can you share the capx or screenshot of your events so everyone can better look at it.


Here is a part of the code: http://screenshot.net/53v57f0 (sorry cant attach files here)
I have another problem with this code.

I have set it up so that a box is spawned randomly every 0-4 seconds under the condition that there are less than 4 boxes in the scene.
Once I destroy a box, another box is supposed to spawn between 0-4 seconds, but instead the box spawns immediately after I destroy 1. I have tested this for
a couple minutes straight hundred of times, since I thought that the box might be spawning in the 0-ish time frame. But no, it does not, it always spawns straight away.

It seems that when the 4 boxes have been spawned, and I wait for 4 seconds or more to destroy a box, it is spawned straight away like I said. The random time does not work after I wait the 4 seconds, seems like it loads a box into memory during the time that the boxes are all loaded and after the 4 seconds I wait.

Now I can't jump over this, to me it seems that the code is not behaving as I am making it to, but I might be missing something since I am have just started working in Construct 2 today. Thanks for the help.
Brick by brick, stone by stone.
B
56
S
25
G
18
Posts: 273
Reputation: 13,363

Post » Fri Aug 28, 2015 4:56 am

Solomon wrote:
rekjl wrote:Once I destroy a box, another box is supposed to spawn between 0-4 seconds, but instead the box spawns immediately after I destroy 1


Do the first 4 boxes spawn correctly every 0-4 seconds?

To fix the sine thing, you might want to make the box invisible, and then make it visible after you enabled the sine movement. I think this is a problem with sine itself
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Fri Aug 28, 2015 8:36 am

August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Fri Aug 28, 2015 12:14 pm

Honestly, I don't see anything wrong with it Solomon. I tried recreating your events and it worked correctly, with the object creation being random. I'm afraid you'll need to show more screenshot, or better, share a capx. It doesn't need to be your entire game. Just recreate the parts that are causing you an issue, than test it out if indeed the problem still persist, share that capx with us than we will be able to help you out.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

Post » Fri Aug 28, 2015 12:48 pm

To download the capx file please go to: filedropper.com/testtest

@7Soul

Yes the first 4 boxes spawn correctly, the problem appears after I start destroying boxes after waiting a couple of seconds. So basically try this with the file that I have provided: Wait for 4 boxes to spawn. Wait 4 or more seconds after they are sitting on the ground. Click on a box to destroy it and watch another box spawn immediately instead during the 0-4 second period as is stated in code.

Regarding the sine movement, if it really is buggy then I am a bit worried :cry: So basically it would be better to come up with a random movement and not use that behaviour eh?

@RamPackWobble

Cant download the file unfortunately, missing file.

@rekjl

I am attaching the capx file as you requested.


So basically steps needed to recreate my problems:

1) Watch as the boxes spawn from the spawner, keep destroying them randomly and watch them spawn. Some boxes will have a jittery movement on spawning other will not.
2) Wait until the boxes are spawned randomly, all 4 of them. Then wait 4 seconds or more, and click on a box to destroy it, now watch a box appear instantly instead of in the 0-4 second time frame as Ive inputted in the event editor.
3) There is also 1 more issue. Although I have set collision, the boxes, once they fall on the ground sprite overlap it. The only way to get rid of the sine and bullet behaviors on the boxes I came up with I have implemented, but still the boxes aren't pixel perfect so to speak with their collisions. Whats more, not only they aren't pixel perfect, but their overlap is not constant, some will fall more some less, which is weird as they all have the same speed when falling.

I am getting a little bit fed up, I cant make a simple game without errors. :(
Any help will be really appreciated.

Thank you.
Brick by brick, stone by stone.
B
56
S
25
G
18
Posts: 273
Reputation: 13,363

Post » Fri Aug 28, 2015 2:23 pm

B
46
S
23
G
31
Posts: 693
Reputation: 20,637

Post » Fri Aug 28, 2015 2:46 pm

rekjl wrote:Is this what you wanted to achieve?


Wow, so basically it was all because of the "every random(0,4) seconds" that I was having both jitter problems on spawn and problems with spawning in the timeframe after destroying a box once they were all spawned? You switched the 'after random time frame' from event to action and killed 2 birds with 1 stone?
Or did you do something else to prevent the box spawn jitter?

I still dont get it why it cant be the way I did it the first time :? Could you please explain the difference?

One more thing, did the collisions work alright (meaning were they pixel perfect without overlapping the ground) when the boxes hit the ground sprite? I read that there is a way to attach an invisible sprite to check for collisions, but why is that necessary, how come this simple code for collisions doesn't work?

Thanks for all your help :)
Brick by brick, stone by stone.
B
56
S
25
G
18
Posts: 273
Reputation: 13,363

Post » Fri Aug 28, 2015 3:27 pm

:oops:

I'll try again _ not having much luck with cloud saves at the moment ...

https://www.dropbox.com/s/b6rzgxz0v5u9x ... .capx?dl=0
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Next

Return to How do I....?

Who is online

Users browsing this forum: 25games and 32 guests