Showing posts with label game program. Show all posts
Showing posts with label game program. Show all posts

Wednesday, March 30, 2016

Input Text with Sprite Kit

Not all the time, player touch on something on the screen. We need to input name or some text to talk. 


This is how you can input the text with the default keyboard in IOS.

In Header File:


Catch Touch Event: 

 Start to Edit Text
 Change Text with Input






Link: Download

Tuesday, March 3, 2015

Create level with pList

With the small game, you need some database to easy create a level map. CoreData is so hard for your little game. So pList is suitable for you to create a small data for your game.

This is easy to change and give more level to your games. It contains all the base information for your game and you can change it very easy.
This is good for Sprite Kit, too. All this come from Apple so they will perfect with other.

So first we should know how to create a Plist File:

+ Just create a new File in your Xcode project and you will see it from


* This time you only need to create your pList to start store your data. This will be constructor like this:
- You have 2 types of collection data to store an data with have many properties: Dictionary and Array
+ Dictionary to store the different type of property
+ Array to store to similar property for your object

- The other types is used to store  the data for you to use this:
+ Boolean
+ Data
+ Date
+ Number
+ String

- This will very easy to get your data from pList:

    NSString* lkPath = [[NSBundle mainBundle] bundlePath];
    NSString* lkFinalPath = [lkPath stringByAppendingPathComponent:@"LKGameData.plist"];
    NSDictionary *lkPlistData = [NSDictionary dictionaryWithContentsOfFile:lkFinalPath];

=> This code will get all the data from pList for ready to create your level.
- You can check all the property in this pList by using:

    NSLog(@"The property list contains: %@", lkPlistData);

=> This code will show all your property list in this pList and you can check them for right input 

Monday, June 23, 2014

Using dispatch_block_t to make the function

- (void)doAnimation:(NSSet *)chains completion:(dispatch_block_t)completion;

=> This work perfect on the way.

You will do the block completion after all the action in the function doAnimation done.
It is amazing.