3 in a row

This forum is currently in read-only mode.
  • hi,

    I have no idea how to solve the following after searching the wiki and a search on "3 in a row" on this forum:

    I would like to detect 3 (or more) in a row, with a falling-blocks game.

    How the game looks likes/works:

    • 1 type of square blocks fall down (like tetris), creating different instances from 1 sprite object.
    • they detect the ground and eachother by using "collision".
    • after collision blocks stack up.
    • if they are next to eachother, I would like them to detect if it is 3 in a row, only horizontal.
    • I didn't use the grid-option.
    • blocks fall down from a chosen x-point at the top of the screen.

    I have tried "compare x-value", but perhaps I didn't do it correctly.

    In what direction do you think I must look?

    I think if only 1 sprite object can detect if another sprite object is next to it, I can continue.

    Or perhaps if I know how to compare x-value of an instance of a sprite-object (instead of standard sprite object).

    I've tried 1.5 hours only not to post this question in the forum and find it out myself, but I ended up with choosing between breaking my keyboard or posting this question.

    I chose the first option.

    Then posted the question.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Don't be afraid to cheat a bit! Create a sprite, 1 pixel high and slightly less than three blocks wide, with hotspot in middle, then for each block place the sprite over the block at desired angle, then check if it overlaps three blocks.

    +Sprite is overlapping Block



  • Thanks, I will try to see if I get that working.

  • I can't get it working.

    I am spawning the 1-pixel-horizontal-slightly-smaller-than-3-blocks-wide over (centered) the block, everytime the block gets created and falls down. (the 1-pixel-sprite follows the block, is attached to it, by an event)

    I don't know what I should do with a hotspot.

    I created 3 imageboxes, so that I could perhaps let it detect if the 3 Imageboxes were overlapped, but I could find no such option for imageboxes.

    So I am currently not using Imageboxes.

    It only detects: block overlaps the 1-pixel-sprite.

    This happens every spawning, so that's useless.

    A sollution would be: if the 1-pixel-sprite is completely overlapped from left x to right x: start action.

    I wouldn't know how to do this.

    (or if I could somehow ("pick closest-condition" perhaps?) let blocks detect if another object is near them, on the x-axis)

    What do you think I am doing wrong, or in what direction should I look for?

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