Tweaking the game

You may have beat the Hunger Run game in no time or you may have failed miserably just like me. Whichever type of gamer you are, you can configure Hunger Run to be harder or easier. We will wrap up this project with just doing that.

Prepare for lift off

The table shows all the configurable items:

Sprites

Variable name

Usage

Value to use for tweaking

Game Manager, Brick, Food

grid_count

Number of grids in the game

Lower is easier.

When lower, the run is shorter.

Game Manager

scroll_speed

The scrolling speed

Lower is easier.

Player can avoid bad food.

Food

good_food_start_cos_idx

Bad food ratio

Lower is easier.

When lower, fewer food types are bad.

Food

bad_food_start_grid_idx

Bad food appearance time

Lower is more difficult.

When lower, bad food would show sooner.

Engage thrusters

We will demonstrate how to configure these variables: grid_count, bad_food_start_grid_idx, scroll_speed, and good_food_start_cos_idx.

Tweaking the number of grids in the game

Perform the following steps to decrease the value of the grid_count variable:

  1. Go to the Game Manager sprite's Scripts tab.
  2. Find the when <green flag> clicked block, and enter a value lower than 10 in the set <grid_count> to () block.

Perform the following steps to increase the value of the grid_count variable:

  1. Create additional costumes for the brick sprite. Say we add five more costumes to make a total of 15 costumes.
  2. Go to the Game Manager sprite's Scripts tab.
  3. Find the when <green flag> clicked block, and enter 15 in the set <grid_count> to () block.

Tweaking bad food's appearance time

Perform the following steps to adjust the time when bad thing and bad food appears:

  1. Go to Game Manager sprite's Scripts tab.
  2. Find the when <green flag> clicked block.
  3. To make the game harder, enter a lower value than 3, say 2, in the set <bad_food_start_grid_idx> to () block. Therefore, the bad food would show up at grid 2, instead of grid 3.
  4. To make the game easier, enter a higher value than 3, say 5, in the set <bad_food_start_grid_idx> to () block. Therefore, the bad food would show up at grid 5, instead of grid 3.

Tweaking the scrolling speed

Perform the following steps to tweak the scrolling speed:

  1. Go to the Game Manager's Scripts tab.
  2. Find the when <green flag> clicked block.
  3. To make the game harder, enter a value higher than 0.5, say 2, in the set <scroll_speed> to () block. Therefore, the bad food would show up at brick number 2, instead of brick number 3.
  4. To make the game easier, enter a value higher than 3, say 5, in the set bad_food_start_grid_idx to () block. Therefore, the bad food would show up at brick number 5, instead of brick number 3.

Tweaking the movement of the player

Perform the following steps to tweak the movement of the player:

  1. Go to the player's Scripts tab.
  2. Find the when I receive <game_start> block.
  3. To make the game easier, increase the value of the jump_steps or jump_wait_time variable. The larger the jump_steps variable is, the higher the player sprite will jump.
  4. Moreover, we can make the player fall faster after he jumps. To do so, increase the value of the fall_speed variable.

Tweaking the bad food ratio

Assume your food sprite costume list is as the one shown in the following screenshot (as included in the starter project):

Tweaking the bad food ratio

To make the game easier, reduce the bad food ratio by performing the following steps:

  1. Go to the food sprite's Scripts tab.
  2. Find the when <green flag> clicked block.
  3. To make the game easier, enter a value lower than 3, say 2, in the set <good_food_start_cos_idx> to () block. There would be one bad food type.
  4. To make the game harder, enter a value higher than 3, say 5, in the set good_food_start_cos_idx to () block. Then there will be four bad food types.

    The result of tweaking the good_food_start_cos_idx variable is shown in the following screenshot:

    Tweaking the bad food ratio

Objective complete – mini debriefing

We have demonstrated how to tweak Hunger Run in the following ways:

  • Tweaking the number of bricks in the game
  • Tweaking the time of appearance of bad food
  • Tweaking the scrolling speed
  • Tweaking the movement of the player
  • Tweaking the bad food ratio
..................Content has been hidden....................

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