A simple pong implementation that runs on IOS.
The following stuff is used to create this Pong implementation for IOS:
- XCode 4.x
- Objective C
- Cocos2D
- Box2D
- Freetime in an hotel in Rotterdam
All real logic and non scaffolding code can be found in three classes.
Main entry point. Bootstraps all the game objects and is the layer where the game is drawn on. It also holds and manages the game score.
The paddle game object. Contains logic to move itself on touch.
The ball game object. It contains logic to respawn.
Box2D works with several fundamental objects. We briefly define these objects here and more details are given later in this document.
A physics world is a collection of bodies, fixtures, and constraints that interact together. Box2D supports the creation of multiple worlds, but this is usually not necessary or desirable.
A 2D geometrical object, such as a circle or polygon.
A chunk of matter that is so strong that the distance between any two bits of matter on the chunk is completely constant. They are hard like a diamond. In the following discussion we use body interchangeably with rigid body.
A fixture binds a shape to a body and adds material properties such as density, friction, and restitution.
< 6C20 div class="markdown-heading" dir="auto">