Platform game Start to Finish

3

Index

Attached Files

The following files have been attached to this tutorial:

.capx

demo-game.capx

Download now 5.33 MB

Stats

8,668 visits, 18,197 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.

Snake is done, create a sprite, and name it Snake_Venom, set behaviour to Bullet, and destroy outside layout. Set speed of bullets to about 320 for now but change it whenever and if you feel like.

We also need something to trigger when the player is nearby Snake, so the snake can start shooting player as well, remember to set behaviour to Invisible for this sprite.

Place Snakes where green square is, and Snake trigger where the Red rectangle is, place house at top right-hand side;

If you don’t know how to add SUB EVENT, just highlight where you want sub-event, example click on Player is overlapping Snake_Trigger, once this action is highlighted, press B on the keyboard once and construct 2 will add blank sub-event for you. In above code we check for player overlapping the trigger, if yes Snake will start shooting else it won’t do that. Also, we are checking for the Red snake, or Blue with Snake_ID is equal to Snake_Trigger. The sub even checks for Snake facing in which direction. If Snake facing left then set it to 180 degrees which are left, if not set the degree to 0, as Snake is facing Right. I hope that is clear enough for you to understand.

Create Particle object, and name it Particles_Blood, set the property as below;

Enter this code;

If Snake fires and hits player, then player health subtract by 1. Player Spawn Particles_Blood and also flash as well.

Now if Player Bullets hits Snake_Enemy we subtract 1 from Snake SN_Health and spawn Particles_Blood too.

Next, we check if Snake SN_Health = 0 if yes, then destroy Snake, add score else, not SN_Health = 0

Same for Player as well but, for the player we just set isAlive = 0 means dead.

What do we need now? Yep, we need a BOSS enemy so our hero can fight the battle with BOSS and survive and wins the game or Level. For this, I thought I have the cannon for the player, which is already the position in the BOSS room but, not activated. Soon as Player enter the room and collide with Room Trigger the cannon is activated, and also BOSS activated too. BOSS can fire the bolt through his mouth toward the player and Player cannon fires towards BOSS. To survive Player must move about or be hit by Boss cannon bolt.

Create Boss sprite;

Set property as follows;

Create trigger, and name it Boss_TR

1. Create Instance variable, and name it Boss_Health = 1500

2. Set behaviour to Sine

Sine parameter

Note Sine is not active at the start; you could do a lot with this behaviour, you have to play around with it to find best parameters.

Create Cannon sprite, and name it Cannon, now set behaviour to Turret and set parameter as; also we need Cannonball to fire from the cannon, create cannonball, and name it Cannon_Ball, set bullet behaviour, destroy outside layout, speed to 40. We need 2 sprites so create it, and name it Teleporter, and Home_Teleporter. Insert this Home_Teleporter by near house and Teleporter somewhere in the Boss room.

Note here if player Triggers Boss room then we have to create some kind of obstacle that prevents the player from Boss.

Place Boss on Red Square, Cannon on Green, Trigger on Yellow, insert Teleporter where pink circle is, and we will create the door on blue when we insert code.

  • 0 Comments

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