Skip to content

Latest commit

 

History

History
17 lines (17 loc) · 1.53 KB

README.md

File metadata and controls

17 lines (17 loc) · 1.53 KB

jigsawgame

Issues and lessons learned

1. When adding the background, scaling the background picture is needed to adjust to different screen sizes. But calling setScaleX() and setScaleY() doesn't work if we use addChild(child, z-index, tag). Instead, we use addChild(child).

Reason: not specified yet.

2. Game crashes when unmute the sound.

Related code is in org.cocos2d.sound.SoundEngine. When the engine unmutes the sound, it just resume the original volumns saved in the variables, prevEffectsVolumn and prevSoundsVolumn, of type Float which are not initialized when the engine starts and when it mutes the sounds and effects. We should set a value, say 1.0, to both of the variables using setSoundVolumn() and setEffectsVolumn().

3. Before the sprites fade in, set their opacity to zero.

4. All callback methods of Cocos2d animations should be declared as public methods.

5. Add jar libraries to Android Studio projects:

File -> Project Structure -> Project Setting -> libraries

6. Initialize Gradle Wrapper:

Right click project -> Open Module Setting -> Add a module(Android Gradle)

7. Randomize number series:

Assume that there is an integer array of size n, what is the best way to randomize the first m elements (m is no larger than n)?

For each of the first m elements, switching with a random element.

8. Wrong fragments which obviously do not belong to the current pictures

Use an exclusive key for each picture, say, the picture file names.