[SOLVED]Problem with unwanted collisions.

Discussion and feedback on Construct 2

Post » Wed Nov 02, 2011 8:27 am

Unfortunately the only way to get collisions working reliably for the platform movement is to count adjacent objects as overlapping. So two 32x32 objects positioned at (0, 0) and (32, 0) count as overlapping. I'm afraid it's just something you have to work with - if it's changed so they don't count as overlapping, some weird platform bugs start appearing.

As for a workaround, how about using a full-size collision mask, but setting the object size to 31.9 x 31.9?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Wed Nov 02, 2011 9:59 am

It would probably benefit you not to use platformer behavior but design your own movement.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Wed Nov 02, 2011 11:00 am

I would simply not use the platform behavior and do a stepped movement.
As you have a stepped horizontal movement, I think it would be logical to have a stepped vertical movement.
so
[code]Global vRate = 1 //speed of dropping
every vRate seconds
-> Sprite : set Y to self.Y+32
//sprite2 is just the inert form of sprite
Sprite overlap Sprite2
-> spawn sprite2
-> sprite2 : set Y to self.Y-32
-> sprite2 : set width to Sprite.Width
-> sprite2 : set height to Sprite.Height
-> destroy sprite
system : sprite.count = 0
-> create Sprite at X = floor(random(layoutWidth)/32)*32 Y=0[/code]

This way you can even use vRate to modulate difficultyYann2011-11-02 11:04:39
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Wed Nov 02, 2011 3:22 pm

It might be a good idea to not use built-in collision at all and rely on an array representation of the grid to create your own collision detection.
B
45
S
16
G
18
Posts: 845
Reputation: 13,673

Post » Wed Nov 02, 2011 7:38 pm

Hi all and thank you for your response.

I must admit that I'm lazy, that's why I use PlatformBehavior, but with the worries that implies I give up this idea.
With Ashley's explanations I realize it's not a good solution to base a simple game as Tetris on a complex system.

I realize that making a stepped movement way is a better solution, a better start.
Starting from scratch sometimes saves time ... I just lost more time trying to make the PlatformBehaviours set up my ideas than I will have wasted trying from scratch.

Anyways, I'll post the final solution here, as it benefits everyone, although Yann gives me the solution on a plate!
B
23
S
5
G
5
Posts: 112
Reputation: 4,737

Post » Thu Nov 03, 2011 12:07 am

And tadam!
Everything works, finally just few events for doing that.

Here is the file, hope that can help.
tetris-like.capx

Merci Yann!

Press the spacebar to accelerate the fall of a sprite.

And now I can continue this tetris-like in a good way.
B
23
S
5
G
5
Posts: 112
Reputation: 4,737

Post » Sun Jul 21, 2013 7:10 pm

Hi. The file is not available anymore. Does someone still have it?
B
47
S
14
G
5
Posts: 635
Reputation: 8,017

Post » Tue Oct 08, 2013 8:02 pm

Oops sorry! I've moved some files on my Dropbox!

Here's the link:

tetris-like.capx
B
23
S
5
G
5
Posts: 112
Reputation: 4,737

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: MrMaciej and 0 guests