Bullet + Sine behaviour = jerky spawn

0 favourites
  • 14 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • 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.

  • 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.

  • 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.

  • > 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

  • 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.

  • 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 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.

  • https://www.dropbox.com/s/kp28stmvghho5gb/TEST%20TEST2.capx?dl=0

    Is this what you wanted to achieve?

  • 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

  • <img src="{SMILIES_PATH}/icon_redface.gif" alt=":oops:" title="Embarrassed">

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

    https://www.dropbox.com/s/b6rzgxz0v5u9x ... .capx?dl=0

  • rekjl - Ok I followed your example and know now what you did, thanks for your help

    RamPackWobble - Thanks for your example, a lot to learn there

  • Sorry for the late reply. Great to hear that! Have fun!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "Thanks for your example, a lot to learn there" - mainly how not to do it ?

  • "Thanks for your example, a lot to learn there" - mainly how not to do it ?

    Haha, nah

    Lot of nice mechanics going on there, always good to see something new to learn! So once again thanks!

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