How to create a fake collision?

Get help using Construct 2

Post » Mon Feb 18, 2013 10:14 am

@mystazsea

It was useless, i've tested it before, these block fall to out of layout.
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Mon Feb 18, 2013 10:57 am

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..
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
30
S
11
G
8
Posts: 313
Reputation: 7,360

Post » Mon Feb 18, 2013 11:03 am

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
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
30
S
11
G
8
Posts: 313
Reputation: 7,360

Post » Mon Feb 18, 2013 1:14 pm

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.
B
1
Posts: 4
Reputation: 233

Post » Mon Feb 18, 2013 1:17 pm

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.andreyin2013-02-18 13:17:56
B
106
S
35
G
37
Posts: 798
Reputation: 25,215

Post » Mon Feb 18, 2013 7:52 pm

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
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Tue Feb 19, 2013 3:04 am

@R0J0hound Oh... it looks very tricky. I had no idea when you put Array Height is 20.

I really appreciate your help :)!



@mystazsea @mrabjohn @andreyin


R0J0hound provided a sample, not flexible enough but it worked like a charm.
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Tue Feb 19, 2013 6:47 am

I was working with this some more and realized that no collision detection is needed whatsoever, just find how far down a given block needs to move.

See example for details:
http://dl.dropbox.com/u/5426011/examples16/gemdrop4.capxR0J0hound2013-02-19 06:48:19
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Tue Feb 19, 2013 6:58 am

@R0J0hound That's the definitve solution what im looking.

I was figuring out how to remove array, but you rushed it, it improved performance a lot! awesome work!
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Previous

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, abdalghani, imothep85, LeFuji, makkancs, Marxally, Virpoja and 24 guests