Posted on

Cocos2d-x Tutorial Series

Cocos2d-x Tutorial Series
(Official Cocos2d-X Image)

 

Introudction:
Cocos2d-x Tutorial Series .From Zero to Hero . In this series i will guide you how to make Basic Game & Advance level games which includes Level created from Box2D World & much more..
IN Basic Game :
Simple Game like this
(Ofcourse it’s my game it’s not good!)
In Advanced Game :
A Game with Box2D World Racing type game with smooth Curved Levels (Which you do in Illustrator using Pen Tool OR you can say it smooth Polygons which makes curved level)
Index
About Me:
I am not a Professional Programmer but i know how to Use cocos2d-x,Cocos2d-xna for making Games & i feel happy to share my knwoeldge with you as you all know the Tutorials are very less and 1 ebook is in the market which is Paid so some user will find it difficult to learn Cocos2d-X which is a great for Cross Platform GamesNOTE: I am targetting Cocos2d-x 2.2.2
PLEASE NOTE : This series is Discontinued due to older version of Cocos2d-x. I will make a new Series with latest version 3.x

Last Update: 24-01-2014
Posted on

1. Prerequisite Cocos2d-X

Welcome Guys to First lesson of Cocos2d-X v 2.2.2 Tutorial Series

Prerequisite
Summary: 
In this Lesson i am going to teach you (Ok i am not a teacher so i am going to show you instead of  teach you “teach  -> Show)
Setting up Cocos2d-x for all major Platform (Just leaving IOS  because of no MAC & IOS Device for testing & some others which are simple & easy)
& Running Sample app TestCPP
Detail:
Download Cocos2d-X V 2.2.2 from here http://cdn.cocos2d-x.org/cocos2d-x-2.2.2.zip
After downloading it save  to directory without Spaces in path for example:
C:Downloads Filescocos2d-x-2.2.2cocos2d-x-2.2 (Wrong)
C:Downloadscocos2d-x-2.2.2cocos2d-x-2.2          (Right)
Extract it using any software (I don’t care what you use..😀 )
1. Let’s start with Windows
using Visual Studio (If you don’t have a copy you can get it from Dreamspark by verifying your Student Status) .Installing Visual Studio is easy just do couple of clicks Next Next and Install type
Open this solution file

in Visual Studio 2012 as it’s for VS 2012 (If you want to open in any Greater version then please google it)
Right Click on TestCPP in solution explorer
like this
and select set as Startup Project
Then Click on the Play icon (which you saw in most Music Player in this Software it’s not called Play Icon)
If any Pop up askes to compile other Projects click yes
Click on it wait for it to complete the process (The time for compiling is much more then expected and also depends upon your Computer )
Now when you have completed it it will open a Window for you to show TestCPP app it’s a demo application to check Cocos2d-X features 
Click on every List item and check it’s feature what you can achieve with Cocos2d-X the power of cocos2d-x is not limited to these features you can achieve anything 
2. Let’s come to Android Version
1. Go to the Android Developer Site download ADT Bundle (http://developer.android.com/sdk/index.html)
&
2. Download the NDK (Native Development Kit)
Q: What is ADT Budle ?
A:  ADT Bundle includes Eclipse with SDK Manger and other tools to get you started in development of Android APPS & GAMES using SDK (Software Development Kit)
Q: What is NDK ?
A: NDK stands for Native Development Kit . It let’s you run C  / C++ Code in Android app . As you know Cocos2d-X is Cross platform & it’s run with C++ Language . So we need Android NDK
3. Download CYGWIN

Install Packages from any Single mirror site (Please check Make Packages are included in it)
now you are ready to make TestCPP for your andorid Device/Emulator/Bluestacks
Open ADT Bundle Folder – > Eclipse -> eclipse.exe
Import the TestCPP
File -> Import -> Existing Project into workspace -> Select Root directory -> Browse
C:Downloadscocos2d-x-2.2.2cocos2d-x-2.2samplesCppTestCppproj.android
Press Ok

Now Setting Variables
* Windows->Preferences->General->Workspace->Linked Resources
Click on New ->
In Name field:- COCOS2DX
In Location field:- The Root Directory in my PC it’s  
C:Downloadscocos2d-x-2.2.2cocos2d-x-2.2

Now we have to set NDK_ROOT Environment Variable
Windows -> Prefrences -> C/C++ -> Build -> Environment ->
Click on Add button (Right Side)
In Name field: NDK_ROOT
In Values field: The Root Directory of NDK (C:Downloadsandroid-ndk-r9-windows-x86_64android-ndk-r9) 

Also add these two Variables 
In Name field: CYGWIN
In Values field: nodosfilewarning
In Name field: SHELLOPTS
In Values field: igncr
Last thing what we have to do is 
Importing libcocos2dx Lib project
Same process for importing
File -> Import -> Existing Project into workspace -> Select Root directory -> Browse
Cocos2d-X ROOT/cocos2dx/platform/android/java (My PC – > C:Downloadscocos2d-x-2.2.2cocos2d-x-2.2cocos2dxplatformandroidjava)
Finish -> Ok
now if everything is gone as per tutorial you will not face any problem and it will get compiled Successfully
On TestCPP -> Right Click -> Run As -> Android Application
now make some coffee  because it will take much time to compile all Files after Completion of this Process open it in emulator or BlueStacks or any Device 
i will recommend BlueStacks instead of Emulator (Sometimes it will not able to run just Black screen ,It’s slow as comparison to Bluestacks )
NOTE: if you got any error Clean the Project Project-> Clean then Build it again Or
Post in Comments 🙂
3. Marmalade
Make sure you have Marmalade Installed on your System Open proj.marmalade folder in 
C:Downloadscocos2d-x-2.2.2cocos2d-x-2.2samplesCppTestCppproj.marmalade

Double click on TestCPP.mkb file it will let you open in the Visual Studio or Right click and open it with Marmalade HUB
4.BB 10

Install Blackberry Native SDK (https://developer.blackberry.com/native/downloads/)
For testing purpose download Simulator also (I would recommend Device DAC,DAB or any other)

Import TestCPP from proj.blackberry directory

Open Blackberry Native SDK -> File -> Import -> Existing Projects into WorkSpace -> Browse -> Finish -> Ok

Now some projects are also Required to build TestCPP or any other Sample / Your Project Successfully

extensions -> C:Downloadscocos2d-x-2.2.2cocos2d-x-2.2extensionsproj.blackberry

CocosDenshion  -> C:Downloadscocos2d-x-2.2.2cocos2d-x-2.2CocosDenshionproj.blackberry

Cocos2dx -> C:Downloadscocos2d-x-2.2.2cocos2d-x-2.2cocos2dxproj.blackberry

Box2D -> C:Downloadscocos2d-x-2.2.2cocos2d-x-2.2externalBox2Dproj.blackberry

Chipmunk -> C:Downloadscocos2d-x-2.2.2cocos2d-x-2.2externalchipmunkproj.blackberry

so import these Projects one by one or select Cocos2d-x Root directory and select it in List view of Check boxes

Now if you want to make for Simulator go to all of these projects Including TestCPP
Select Project – > right click -> Properties -> C/C++ Build -> Manage Configuration Select Simulator (Do same for Device if you want to make it for Device)

Select Configuration from drop down menu Simulator (Active)
do all these for all Projects 😀 because the build Library will be in that folder

For example you have choose Device-Release in Cocos2dx Project or CocosDenshion and your TestCPP is in Simulator configuration it will look for cocos2dx lib file in Simulator folder but actually the file is in Device-Release

so it will show you error be care full and choose appropriate  configuration
to run on simulator Add a new target if no simulator is found & Right click on Project Run As Blackberry C/C++ Application

____________________________________________________________________________

For WP8 i would recommend Cocos2d-XNA instead of Cocos2d-x as it will let you able to make it for WP7 & WP8

So i am not covering it in this Tutorial may be in Future

Some Advice :

Build your Project on Windows in Visual Studio write code and test it on Machine instead of slow emulators/Simulators/ and checking again and again on Device when you find it’s working fine and completed then go in Eclipse import the project as the Classes folder will be same on all Platform run it on Device or Bluestacks For android

do same thing for Blackberry or any other Platform it will save you lot of headache and Time..

In next tutorial I will show you how to create your own Project & write Hello World!

Check Index of Cocos2d-X Tutorial Series

Posted on

Flying Birds made with Cocos2d-x

Title: Flying Birds
Platform: Android 2.3+
Description: Once upon a time there was a Bad Man who have Locked group of birds in a Cage . Fly your first green bird who have escaped from the Bad Man’s cage
Protect your-self from Forks & escape yourself from branches.Remember Bad Man’s army of birds are on there way to get you back in the cage but don’t worry
you have got your-self some power ups which will help you to escape
Collect berries -> get 3 more birds which can destroy all things
Collect Star    -> get invisibility no one will catch your for 4.0 Seconds
Collect Coins   -> get Score for each coins and buy other birds from the cage
How to Play:
Touch to fly ,Leave touch to get low…
How to unlock Birds:
Click on bird (not Lock) check requirement .
Full fill the requirement and select your bird.
Screenshot:

PlayStore URL:
Posted on

Marmalade Windows Phone 8 Contest

Now you can Submit your app until 31st December

Port you already made app or Game in Marmalade & go Cross platform

Marmalade supports all major Mobile Platforms write once deploy to all

Link:-https://www.madewithmarmalade.com/offers/wp8

Rewards

  • FREE Windows Phone Dev Center registration token
  • FREE Windows Phone 8 Device
  • FREE 3 month Marmalade Indie license
  • Earn Nokia DVLUP points (points can be redeemed for a 1 year Marmalade Indie license or used towards other great prizes such as an Xbox 360 or Visual Studio Pro)*
Posted on

Android : Too many pattern attempts Solution

Android the most popular Operating System fro smartphones now a days.The OS is Linux based designed mainly for Touchscreen & tablet devices.
I am not here to talk about android History if you want to read more about android then visit this Link

Android

A Common prob. in android Smartphones users are facing is their smartphones is locked after too many wrong pattern attempts

Most of Android smartphones users lock their smartphone using pattern lock for better privacy. (Reason can be they have some 18+ Pics which they don’t want to show to their friends :P)

What is pattern Lock ??
The Pattern lock is type of lock which let you draw image by connecting circles which make a pattern. You can only open your mobile if your draw right pattern. In case you draw wrong pattern, you are aksed to redraw the right Pattern

If you are a android user and draw more then 20 times wrong pattern then your smartphone get locked.
Now you can’t try new pattern or use any other feature of smartphone.Even you can’t make any Phone call.
If this is your case then you are in right place.

Solution to the Prob.

If your smartphone is locked with too many wrong attempts then here we go with our First solution.

Use Google account associated with smartphone. You need to login with your google account & then you can easily disable or change the pattern of your lock but for this
you your WiFi has to be turned on already because you can’t turn on the WiFi if your smartphone is locked.
Another solution is in some smartphones when you press Lock key more then 4-5 seconds you will get a Alert dialog
to turn on your Mobile Data pack (Only useful if you have set the APN already)

If WiFi is turned off on your smartphone then you can’t login into your account. You can also enable the WiFi or Mobile data through Android Debug Bridge 
This method requirement is that you must enabled USB Debugging feature under ‘Developer Options’ on your device

Steps to bypass Lock screen through ADB (Not by turning on the Wifi)
1. Download ADB thorugh Google site
2. Connect your Device through USB
3. Open CMD in windows
4. Issue the following Command

adb shell
rm /data/system/gesture.key

5. Now reboot your android device & supply the following Commands
6.

adb shell
cd /data/data/com.android.providers.setting­s/databases
sqlite3 settings.db
update system set value=0 where name=’lock_pattern_autolock’;
update system set value=0 where name=’lockscreen.lockedoutpermanently’;
.quit

7. Restart it
8. You’re done now it will accept any new pattern

If you are facing any error then please let me know in Comments