0 Favourites

Blocks getting out of alignment ...

  • I'm currently making a match-3 (Candy Crush type) game with 7 columns and 7 rows of blocks. However, I keep running into the same problem.

    For some reason when my blocks move down within the column they aren't always lined up exactly as they should be even though the code is the same for all blocks. I've used "set angle of motion" and "set Y" for blocks that are not "overlapping at offset" the bottom or other blocks. The blocks move down when the block beneath is destroyed, but it stops at different places. Half of the the blocks lineup straight while the other blocks sometimes overlap the block beneath, overlap the bottom or just don't line up perfectly. Is there a way to keep my columns and rows straight?

    Any advice is appreciated. Thanks.

  • It would be easier with some screenshots or better a .capx

  • I had a similar issue with a boulderdash style game I made once. What behaviours are you using for the blocks? Checking for overlapping at offset can cause issues, and there are several workarounds.

    One possible way to do it is to have the blocks correct themselves when they stop falling. i.e. when overlapping at offset stop falling and then immediately move the block into the right position (which will be the Y of the block it is overlapping with + its height) in the same frame.

    I can provide a short event block to illustrate this if you prefer.

  • Actually, SeriouslyCrunchy an example would be very much appreciated. I can understand what you're saying, but it would be easier for me to visualize it. And if it doesn't go quite the way I'd hoped, I'll post a capx of what I have so far.

    Thanks in advance.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Alright, I haven't had time to do it this evening so i'll sort an example for you in the morning.

  • Sorry for the double post but it seems I've misplaced the capx for my boulderdash game, I was going to grab a few screenshots of the events from that! Whoops!

    However, a perhaps better workaround is giving all the blocks the platformer and solid behaviours, and turning off default controls for the platformer. This negates the need to use 'overlapping at offset' entirely, which I have had some issues with a few times in C2.

    Give it a go and let me know how it goes!

  • Thanks for the advice, SeriouslyCrunchy! I appreciate the response. I'll give that a shot!

  • I had the exact same problem when creating a tetris clone before. The best solution is to "snap" your piece in place. You could place invisible markers at each rows. Than when you want it to, use the pick nearest invisible marker, than set your piece Y to the invisible marker.Y. That will make sure your pieces are always precise in terms of position.

  • Thanks, rekjl! That seems like another good fix! I appreciate the response!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
34 3,118
Cassianno's avatar
Cassianno
Unread hot topic Locked topic
0 Favourites
C3 - I'm not getting it.
37 2,006
Ashley's avatar
Ashley Construct Team Founder
Unread hot topic
0 Favourites
I'm blocked
32 2,129
JosepM's avatar
JosepM