Bubble Shooter Type Game

0 favourites
  • 3 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • Hello! I'm trying to make a bubble shooter like game except instead of trying to match bubbles you have to knock things down.

    I've already started to get things working but I cannot figure out how to get things to stay put or fall when they are or are not supported.

    <img src="https://dl.dropboxusercontent.com/u/60298955/ludumDareScreen.png" border="0" />

    In the screenshot, I've highlighted certain blocks to make what I'm having trouble with more clear.

    In the game you shoot a ball at these blocks. I want certain blocks to fall if they have no support!

    The Yellow marked blocks would be stable because theyre touching the wall.

    The green marked blocks would also be stable because theyre connected to a block that is touching the wall.

    But the blue marked blocks would not be stable because they are not connected at all. So the blue ones would fall.

    I've tried so many things, but I'm still pretty new to construct. This seems kind of simple. There just has to be something that I'm missing!

    Thank you in advance for your help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't know what the best possible solution is, but I can tell you what I would do if I were making this type of game.

    I would have an array called ColumnCounter where each index corresponds to a column. Index 0 would refer to column 0, index 1 would refer to column 1, etc. So its size would be how many columns you have in your game. The value held at each index would simply be a counter which increases by 1 every time a block in that column is spawned.

    Each block would have a variable called ID or something similar. It would be assigned the value at its column index in the array. After it is assigned, the value at the index would increase by 1. Each block would also have a variable called Column, and when a block is spawned, this variable would assigned the value of what column the block is spawned in. So if it spawned in column 5, its Column variable would be 5.

    When a block is destroyed, an event would perform a For Each search for Blocks. The next condition would be blocks whose Column variable matches that of the block that was destroyed. And the last condition would be blocks whose ID is less than the ID of the block that was destroyed. Each block should also have a variable perhaps called Detached or Free, or anything that helps you know that this block should fall. In the action part of this event, set your Detached variable to True. (You can make this variable a boolean. I don't use booleans though, I make two global variables, True = 1, and False = 0. I would make Detached a Number variable and type True and False. I do this to use booleans in equations.)

    In your event which advances the blocks, you would apply an additional Y movement to all blocks whose Detached variable is True. You may also want another variable which would prevent the detached blocks from being destroyed by a block that you launch.

    Wow, okay this post is long! I will step through this with an example to show you how it would work. I will make a variable called RandomColumn for randomly spawning a block. I will also make two variables called DestroyedBlockColumn and DestroyedBlockID

    • Block is spawned in column RandomColumn
    • Its Column variable is set to RandomColumn
    • It's ID is set to ColumnCounter.At(RandomColumn)
    • ColumnCounter.At(RandomColumn) = ColumnCounter.At(RandomColumn) + 1

    When a block is destroyed:

    • Block is destroyed

           - DestroyedBlockColumn = Block.Column

           - DestroyedBlockID = Block.ID

    • For Each Block, where Block.Column = DestroyedBlockColumn, and Block.ID < DestroyedBlockID

           - Set Block.Detached = True

    In your event which advances the blocks:

    • Block.Y = Block.Y + (whatever you have the normal blocks doing) + (Block.Detached * dt * (another number, perhaps a percentage of the game window height, you will have to experiment))

           - this part works if Detached is a Number variable

    I hope this helps, ask me any questions you may have.

  • After writing that, I realized I missed something very important, you want blocks to attach horizontally as well as vertically. I will get back to you later with an example using the Pin behavior.

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