How to make a Boss with individual destructible parts

2
  • 14 favourites

Attached Files

The following files have been attached to this tutorial:

.capx

bosstutorial-with-families.capx

Download now 36.1 MB
.capx

bosstutorial-no-families-spawn-only.capx

Download now 36.1 MB

Stats

3,252 visits, 4,760 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

So you want to give your boss fight an 'umph' by shooting pieces off, mh? Well good thing you came here! I highlighted for you the indestructible (or very tedious to destroy bits better said) in black. And the destructible parts in red.

Now don't let it confuse you of thinking it's a single image. Because as you can see here, it's all individual parts:

Now the main challenge when I had to solve this issue was: "How can I make them all hang together and not float around as individual pieces?"

The trick is relatively simple. You make their layer the exact same size, see here:

Each layer in my case scenario are 1024 x 1024 but the actual image only occupies a little portion of this screen with transparent background (see collision pictures further below). Personally I suggest to put the images together first in another program before you assemble your boss to make sure the original individual images are in the right position and right size. I personally use GIMP because it offers a lot of features and is free. Whether you use GIMP or another layer-enabled Image Manipulation Program, i.e. Photoshop, make sure each boss piece is it's own entire layer.

Once you organized all your boss bits on your layers, export them one by one as PNGs. Now you got all your boss bits separate, which in my scenario were 21.

Now put the individual layers into your game project so you can access them in Construct 2. This following task will be tedious but is necessary: You have to double-check the collision box on every single piece. Because if your layer is huge, like mine on 1024x1024 it may not recognize the collision box of your object.

This is what it might look like:

And this is what it's supposed to look like (I highlighted the collision box tool for you):

Make sure to check on every single boss bit!

Now it's time to put it all together which is really easy:

1. You go in the event sheet and set whatever conditions you need. Then set the create object position of the center piece.

2. Set for every single Boss piece the create object position to the same coordinations of the center piece. If you did everything right until this point, the boss should line up perfectly. If it does not, double check the layer size for each individual piece.

3. I had a static boss who only did rotate and the rotation speed for all bits were the same. So if you want the boss to move with all pieces you can try to assign them with a 'set position to object' and select the center boss piece as the object (I did not test this, just throwing an idea around).

Now that your boss is put together, you have to define how to destroy those pieces. I hope you have at least the Personal License for Construct 2 so you can use families. If you don't then you will have to assign each piece individually to the player attack and taking damage. So here is the way you can do it with families:

1. Create the 'BossEnemies' Family.

2. Assign all your boss pieces to this family.

3. give the BossEnemies Family an instance variable called 'BossHealth'.

4. Setup whatever the sprite of your player weapon with a simple 'on collision' condition with the BossEnemies family and tell it to subtract health by 1 or whatever value your player's weapon causes.

5. Setup BossEnemies Family condition once BossHealth is equal or less than 0 to destroy BossEnemiesFamily. (This will cause every individual boss piece to be destroyed once it has received enough hits)

Optionally you can also set that if a specific piece gets destroyed, that other parts are being destroyed or damaged as well. In my scenario it is because you can destroy the outer parts in such way that you make a 'tunnel' toward the center. And if you destroy the big center piece, the outside pieces don't really have a structure to hold on anymore (logically speaking) and so I destroy them as reward for the players skill.

6. Now go through every single object in the BossEnemies Family and define a health value. For example my outside pieces (the black ones) have 99 Health. While the smaller outside pieces (the red ones) have health of like 8 to 12.

Now your boss pieces are working completely independently and you can destroy your boss piece by piece.

7. This is optional. But in order to increase difficulty as you destroy the boss further, you can for example on each 'BossEnemies' Family destroyed change a variable to make the boss harder to defeat. This could be more damage output, more frequent use of special attacks, etc. In my case I did increase the rate of fire by subtracting a variable that I set on the center piece which fires. This Variable sets how fast the turret I use for the boss in order to fire shoots :

.CAPX

bosstutorial-with-families.capx

Download now 36.1 MB
.CAPX

bosstutorial-no-families-spawn-only.capx

Download now 36.1 MB
  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!