Chapter 11. Scoring and Game Rules

In previous chapters, we incrementally learned about all the technical skills and knowledge necessary to build a game with Stencyl. We have even implemented some game mechanics. However, it would not be a game if there were no clearly defined game rules or gameplay. In this chapter, we will:

  • Create and track a score value
  • Render it to the screen
  • Create a coin collection gameplay component to increment the score variable

Collecting coins

Before we can begin with programming the coin collection gameplay, we need an actor in our game that will represent the coins. Let's create one now, using the now familiar Actor Type creation workflow that we established in the earlier chapters, by performing the following steps:

  1. In the Dashboard tab, under RESOURCES, select Actor Types, and click on Create New.
  2. Set the Name to Coin, and click on Create.
  3. Click on This Actor Type contains no animations. Click here to add an animation.
  4. Change the Name of the animation from Animation 0 to Default.
  5. Ensure that Looping? is checked. It should be checked by default.
  6. Click on the Click here to add a frame button.
  7. Set Scale to 4x, and Resize Method to Bicubic if these are not already set by default.
  8. Set Columns to 6.
  9. Click on Choose Image..., then navigate to and select Game Assets/Graphics/Actor Animations/gold coin anim.png.
  10. Click on Add to import this 6-frame sprite-sheet into our Default animation.
..................Content has been hidden....................

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