METS BLOG

METS BLOG

Cocos2D-X Platformer tutorial Part 2 – Player

Okay time to add the player to the scene we created before in the first part of this tutorial.
Stuff that is new and things to look out for.

  • Added a SCALE_FACTOR, the view of the scene/tiledMap and the player was too small had to scale it a bit
  • Be careful, scaling means that positions also have to be scaled
  • You will notice this in the method positionForTileCoordinate in Level class
  • Positioning is done according to tiles since this will be a tiled game, ex: Point(10,2) means 10th tile on x axis and 2nd on y axis
  • Player class is there mostly to save the state of the player, its tempting to make it a sprite but I’m still not sure, you can make it a sprite if you want to


Leave a Reply

Your email address will not be published. Required fields are marked *