How to create a fake collision?

0 favourites
From the Asset Store
Particles support animations, collisions, effects and etc.
  • Hi pals!

    For some reason to save performance for mobiles if we use a lot of objects using collision checks could affect the peformance for browser and CocoonJS.

    When we disable collision for sprites, but how to make a fake collision using special workarounds?

    Thanks!

  • Invisible sprites takes so mush out of the performance?

  • shinkan According to Ashley, invisible sprites don't change the performance, they are basically registered objects in memory. They don't take rendering time.

    I doubt if the collisions are part of logic performance, not rendering.

  • Yes that's true, they don't take rendering time.

    How many and what kind of collisions do you need?

  • shinkan

    Im making a puzzle game more like diamond dash.

    <img src="http://www.gamesgoogleplus.net/public/photo/10-2.jpg" border="0">

    The problem is affecting the performance due to many collisions in CocoonJS, they told me CocoonJS is not a javascript performance booster, just another rendering performance.

    Here is my .capx http://dl.dropbox.com/u/76227787/FallingBlocksPerformance.capx

    They told me do not use collision, unless should have each block have state if position is changed, then do fall without collision. I have no idea how it works.

  • Maybe try to approach this from diffrent angle.

    What if You could save x an y position of every box on screen to array. Then if you destroy one box you can pinpoint correct position of that object - row and column - in array, and move all boxes above in same column down by heigh of destroyed box.

    Is that make any sens? I'm not good in that kind of games, so it's just my theory.

    Edit: That way you could do that without any collison checks - I think?

  • shinkan i tried to make one using array with row and column between positions but when spawn blocks from above after of one or more than two blocks are destroyed, it didn't work, i've spent 4 days without solution :S

  • Bump, because i haven't received a help since 1 week ago

  • What about a simpler approach?...

    By this I mean

    only checking for collisions when the block is actually falling...

    Or

    Checking only once a block has fallen and come to rest...

    Checked by a instance variable?

    This would radically cut down on the number of collision checks...

    As far as I can tell anyway....

    :-)

    Worth a test...

  • mystazsea

    It was useless, i've tested it before, these block fall to out of layout.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • OK...well then the array idea sounds like the best idea..great method but instead...use a data array and a corresponding jewel image array the same dimensions as the data array

    Consisting of preset tiles locked in place that dont move but rather respond to a set of preset rules that relate to what tile was immediately around it..is whether or not a tile is cleared falling or colliding for the first time..its just a numerical system of correlated rulesets.

    using tiled animation framed color sets plus a invisible/transparent tile color frame to represent empty as well as a variable stating what color each tile is...etc

    Then by using the image array and whether or not a grid square not using falling bricks except for determining which color is falling and when it reaches the position...'turn on the preset array colored stone and just turn off the visibility of the falling one ...this way it doesn't matter if your tiles fall out coz you would just turn off their visibility when outside of the game grid area...leaving only the preset image array displaying its color....does that make sense? I hope I am clear enough...the array idea is a good one...just needs tweaking..

  • Or what about just putting a buffer zone sprite around the game grid edge that activates the collision mesh just before the sprite hits the game grid border and falls out? It should work..or use y coordinate value to trigger collision mesh on..for example collision mesh is defiantly turned on at y pos= 700 pixels..with the solid frame border at y pos=750

  • Hi,

    I'm new to Construct, but it seems to me that collision on Sprite objects can be turned off or on.

    It would be most appropriate to treat each column as a static pile (i.e. no movement) - then only the top of the static pile would need collision enabled.

    Items that fall in from the top would have collision enabled by default.

    When a block lands, you'd turn off collision on the box it landed on, and disable movement on both.

    This idea could be extended such that when the full grid falls in (if that's how your level starts), only the first falling object would have collision enabled. As the box lands, simply enable collision on the next up the falling chain.

    Where blocks are removed from the middle, you'd have to treat the bottom bit as a static pile, and the top as a falling pile - indeed if blocks are removed such that two holes are made in one column, you'd still only have to treat all of the falling items as one stack, not several.

    Hope this makes sense.

    Cheers,

    Mark.

  • You could check for another block's position on an offset.

    For instance:

    if (block) is NOT overlapping (block) at (block.Yoffset) + 32 then

    -move (block) +32

    Or you could just use arrays.

  • An array could be used in this case since the objects are laid out in a grid. So for each grid position set the value to 1 if an object is there and 0 if an object isn't. Then you can see if a grid position is free with a array look up instead of a collision test with all the other objects.

    ex:http://dl.dropbox.com/u/5426011/examples16/gemdrop2.capx

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