Cocos2D-X Platformer tutorial Part 10 – Refactor Player

To fix the stuttering issue and making the code cleaner we are going to refactor the Player class. Instead of having the player sprite as a separate field we will extend the Sprite class.
After that we will make the necessary changes to GameScene.

  • Even we have a sprite for the player we will save its container size separately, because scaling or animating effects might change the size and break collision detection
  • There will be changes in initializing and updating the GameScene
  • Update player sprite method is removed from GameScene, it belongs to the Player class now
  • Updated to 3.9, next part will improve the scaling


Recent Posts

Categories