“Flappy Purupuru” Documentation by “Code This Lab S.r.l.” v1.0

“Flappy Purupuru”

Created: 20/07/2014
By: Code This Lab S.r.l.
Email: info@codethislab.com

Thank you for purchasing our game. If you have any questions that are beyond the scope of this help file, please feel free to email via user page contact form here. Thanks so much!

Table of Contents

  1. Description
  2. Getting Started
  3. HTML Structure
  4. CSS Files and Structure
  5. JavaScript
  6. Game functions
  7. Events
  8. Enable Sounds

A) Description - top

Flappy Purupuru is a HTML5 action game. The game is freely inspired to the popular game "Flappy Bird". The goal of the player is to tap the screen to let Purupuru survive as long as possible avoiding the obstacles. The ZIP package contains the game with 768x1024 resolution that automatically scales to fit proportionally current screen device.
The game is fully compatible with all most common mobile devices.
Sounds are DISABLED ON MOBILE DEVICES to avoid compatibility issues but can be easily enabled (read Enable Sound section). Anyway we can't grant full compatibility on all mobile devices if this feature is enabled.

B) Getting Started - top

To install the game just upload on your server the files contained into the folder 'game768x1024'. WARNING: The game won't run locally with some browser like Chrome due to some security restrictions so please upload it on your server space.

C) HTML Structure - top

This game have the canvas tag in the body. The ready event into the body calls the main function of the game: CMain().
The head section declares all the javascript functions of the game. The whole project uses a typical object-oriented approach.
In the init function there are 3 mapped events that can be useful eventually for stats



D) CSS Files and Structure - top

The game use two CSS files. The first one is a generic reset file. Many browser interpret the default behavior of html elements differently. By using a general reset CSS file, we can work round this. Keep in mind, that these values might be overridden somewhere else in the file.

The second file contains all of the specific stylings for the canvas and some hack to be fully compatible with all most popular mobile devices

E) JavaScript - top

This game contains:

  1. jQuery
  2. Our custom scripts
  3. CreateJs plugin
  1. jQuery is a Javascript library that greatly reduces the amount of code that you must write.
  2. The game have the following js files:
    • CMain: the main class called by the index file.
      This file controls the sprite_lib.js file that manages the sprite loading, the game sounds, the loop game and initialize the canvas with the CreateJs library
    • ctl_utils: this file manages the canvas resize and its centering
    • sprite_lib: this class loads all images declared in the main class
    • settings: general game settings
    • CLang: global string variables for language localization
    • CPreloader: simple text preloader to show resources loading progress
    • CMenu: simple menu with play button
    • CGfxButton: this class create a standard button
    • CTextButton: this class create a standard text button
    • CToggle: this class create a standard toggle button
    • CHelpPanel: this class manages the help panel that appears when game starts
    • CGame: this class manages the game logic
    • CHero: The Hero controlled by the player
    • CObstacle: this class controls the obstacles
    • CScrollingBg: the scrolling background
    • CInterface: this class controls game GUI that contains text and buttons
    • CEndPanel: this class controls the game over panel that appears when player lose all the lives
  3. CreateJs is a suite of modular libraries and tools which work together to enable rich interactive content on open web technologies via HTML5.

Resuming, the complete game flow is the following:

  1. The index.html file calls the CMain.js file after ready event is called
  2. The main class calls CPreloader.js to init preloader text and start sprite loading
  3. When all sprites contained in "/sprites" folder and sounds (if not mobile) are loaded, the main class removes the preloader and calls the CMenu.js file that shows the main menu
  4. If user click on the play button in main menu, the CGame.js class is called and the game starts
  5. The game class shows immediately a help screen that explain briefly the game instructions. When the player tap the first time, the game starts
  6. If Purupuru hit an obstacle or falls to the ground, the game is over
  7. If the user click on game over panel, the game restart

F) Game functions - top

In this section will be explained all the most important functions used in CGame.js file.

G) Events - top

The game trigger the following events:

I) Enable Sounds - top

The game avoid sound playing if loaded on any mobile device. If you want to enable sounds also on mobiles, you have to change the following value in settings.js file:


Once again, thank you so much for purchasing this game. Fell free to contact us if you have any questions or issue relating to this game. No guarantees, but we'll do our best to assist.


Go To Table of Contents