How do I stop solids shifting each other?

Get help using Construct 2

Post » Mon Sep 26, 2016 10:13 pm

So I have a group of solids that I would like to be able to sit next to one another, flush if you will, at any point during gameplay.

There will be a switch to toggle when the objects are able to be moved using the 8 direction, however when this toggle is activated the objects move ever slightly by literally a pixel or two, almost as if they are repelling one another.

Ultimately this is a problem because my main game works on a grid basis which falls apart if the objects are forced off the grid, even slightly.

Here is an example capx of what is happening:
https://drive.google.com/open?id=0B3txc ... XZPektSVFU

Is there a way to activate movement or control of the objects without them shifting one another off their original positions?

Thanks in advance beautiful people
B
8
S
2
Posts: 17
Reputation: 579

Post » Tue Sep 27, 2016 3:48 am

You may want to set up custom events for movement and collisions if at all feasible. I've run into this issue before with pixel perfect blocks sliding up against each other where solids did not play nicely. Adjacent pixels count as colliding and solids will block each other.

Although if anyone has any other ideas I'd be interested as well.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Tue Sep 27, 2016 3:57 am

you could do different frames of the object with each its own object collision mask such as if you have a square object in a
1-D world that would be fine since the camera is always from above but when doing 2-D or even isomeric where its 2.5.

It could pose a problem so I've always ruled that its best to make several of the same frame with different collision mask to see which works the best.

And if you want to restore the object collision back to the original you could make an invisible sprite to check to see when to turn back to the other frame with a better collision mask for your game.

So in your case find a commonground that you can see the sprite doing and try to adjust the colliosion mask to it. Or you could disable collision until you are far enough away to resume collision. Just some trick I've learn.
B
52
S
24
G
6
Posts: 391
Reputation: 7,845

Post » Tue Oct 04, 2016 8:16 pm

Thanks guys, appreciate the help.

I've managed to do it using the first thing @Gearworkdragon said about collision masks and reduced each side of the object's collision by 2 pixels. This has stopped solids displacing each other when touching the side of another one. Works pretty friggin' well I must say.

Thanks again for the help!

- StomachBug
B
8
S
2
Posts: 17
Reputation: 579


Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi, senecaa and 22 guests