Adding finishing details to the game

The game is now functionally complete, but there are a few elements left to polish up. To start, the player takes damage but never dies, nor is there a heads-up display (HUD) to show this. Let's create a quick Overlord.

  1. Create a new Object, obj_Overlord, with no sprite applied and persistence is checked.
  2. Add a Draw GUI event and a new Script for it, scr_Overlord_DrawGUI, with the following code:
    draw_healthbar(0, 0, 200, 16, health, c_black, c_red, c_green, 0, true, true);
    
    if (health <= 0)
    {
        with (obj_Player) { instance_destroy(); }
        room_goto(TitleScreen);
        instance_destroy();
    }

    First, we use the function draw_healthbar which you can see has a lot of parameters. The first four are the size and placement of a rectangular bar. Next is the variable to be used for how full the bar is, in our case, the global health variable. The next three are the background color, and the min/max colors. Next is the direction the bar should fall, zero being to the left. The final two Booleans are for drawing the background and border that we want.

    After that we do a health check and if the player should be dead, we remove the player, return to the frontend, and then remove the Overlord itself. It is important to remove any persistent instances in the world or they won't go away!

  3. Place a single instance of obj_Overlord into C04_R01.
  4. Populate the rooms with a variety of enemies. If we use the Brawl we will either need to create a room that works with the path we created, or even better, redraw the path to fit our room layout.
  5. Make sure the Sandbox room is moved back to the bottom of the Resource tree and run the game. We should see the health bar at the top of the screen and if you take damage, the health bar should go down. If the player takes too much damage, the game will end and return to the frontend.

    All that is left is to create levels, paint the world with a tile set, and add some background music. At this point you should know how to do that, so we will leave it up to you. We have supplied some additional assets for this purpose in the Chapter 4 folder. You should have something that looks like the following screenshot when you are done:

    Adding finishing details to the game
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.228.138