Wednesday, January 28, 2015

[Tutorial] Cocos2d-x: The second game - Breakout - Create and destroy brick (Part 2)

Some tasks in this lesson: + Create bricks+ Process physics collision+ Check the destruction of bricks, if done, it's WINGAME+ Check GameOver when the ball falls but not colliding with the paddle- It seems muck work but it's simple because it's rather like the first gameLet's start!Step 1 - Create bricksOpen file HelloWorldScene.cpp, add the following code blockfor (int i = 0; i < 5; i++) { static int padding = 100; auto block =...

Posted By Live Blog8:47 PM

[Tutorial] Cocos2d-x: The second game - Breakout (Part 1)

In this game, you must do some following tasks: + Add objects into game + Set physics attributes ( using Chipmunk for ease ) + Create the movement of the ball + Move the paddle Step 1 - Add objects into game - Set physics attributes Create a new project with familiar command: >cocos new breakout -p com.vn.breakout -l cpp -d f:android/project And remember to add USING_NS_CC; into HelloWorldScene.h  Open file HelloWorldScene.h add...

Posted By Live Blog8:20 AM

Tuesday, January 27, 2015

[Tutorial] Cocos2d-x: Box2D - another physics library of cocos2d-x (Part 2)

Filled under: ,

In previous part, we studied about Box2D, and build a small app using physics Box2D. In this lesson, we come to advanced a bit, control the ball, make it collide with the screen với màn hình as follow: + Make the ball move by vector + force + Predict the direction the ball moves Step 1 - Make the ball move by vector + force * Open file HelloWorldScene.h, in Public area, add the following code block: // You can see the meanings of variables...

Posted By Live Blog1:19 AM

Choose an Android item