How to make firework effect in a game with TDD

This article is talking about how to add a firework or confetti in a game with TDD.

Here are the content overview:

  • Concept
  • Prepare the firework particle
  • Create a custom view in CocosStudio

  • Create a custom class FireworkView with TDD methodology

  • Import the cocostudio data and Test

  • Bind the particle objects and Test

  • Add method to play specific firework emitter

  • Add logic to play all firework emitter automatically

Demo:

Continue reading

Notes about const in C++

This article contains some note about using const in c++;

Objective of using const

The main objective of using const is to:

Prevent changes to the data or Make it Read only

More Detail:

  • Prevent the caller change the values of a string in my class;
  • Prevent the caller change a constant value such as Pi, MaxOfPlayer, …
  • Better ownership of a piece of data, it is good to controlled the data by one source;

Continue reading