[IPhone game development] iPhone game development 5: game scenario switching, dot matrix implementation, and use of Hiero tools

Source: Internet
Author: User

I. game scenario Switching

In iPhone game development, there are many animations available in scenario development between games. The specific animations are as follows:

 

Cctransitionrotozoom //  Scale down the image from large to small and beat it  

Cctransitionjumpzoom // The three-dimensional jump from the Left

Cctransitionmoveinl // Move from left to right

Cctransitionmoveinr // Move from right to left

Cctransitionmoveint // Move from top to bottom

Cctransitionmoveinb // Move from bottom to top

Cctransitionslideinl // Move from left to right

Cctransitionslideinr // Move from right to left

Cctransitionslideint // Move from top to bottom

Cctransitionslideinb // Move from bottom to top

Cctransitionshrinkgrow // Zoom in from large to small

Cctransitionflipx // Three-dimensional flip from X axis

Cctransitionflipy // Trigger from Y axis



Cctransitionflipangular // Flip from the right header

Cctransitionzoomflipx // Rotate from the X axis

Cctransitionzoomflipy // Trigger from Y axis

Cctransitionzoomflipangular // Zoom in and flip in from the right side

Cctransitionfade // Enter from the intermediate gradient

Cctransitioncrossfade // From the peripheral gradient

Cctransitionturnofftiles // Overwrite the upper layer from the grid

Cctransitionsplitcols // Vertical split into three blocks

Cctransitionsplitrows // Split into three blocks horizontally

Cctransitionfadetr // Gradient from the lower left to the upper right

Cctransitionfadebl // Gradient from the upper right corner to the lower left corner to enter

Cctransitionfadeup // Gradient from bottom to top

Cctransitionfadedown// Gradient from top to bottom

 

 

Each animation above is explained. When calling it, you need to write the following:Code:

 
Ccscene * SC = [ccscene node]; [SC addchild: [helloworld scene]; [[ccdirector shareddire] replacescene: [invalid transitionwithduration: tTime scene: SC];

 

 

The screen provides 26 scenario switching actions. I will post a demo to share with you.

 

2. Implementation of dot matrix words

In iPhone development, we need to implement different types of fonts and different disguised fonts. In addition to using Photoshop to draw pictures and load them into, we can also do some pasting.

(1) Introduction to lattice words

Dot Matrix words can be rendered to the screen using OpenGL ES. Each character in a lattice word is represented by an image. We can use the lattice word genie table generated by Hiero. Hiero: (http://n4te.com/hiero/hiero.jnlp), we can also use bmfont (http://www.anglecode.com/products/bmfont) on Windows platforms to generate dot matrix words from TrueType. It provides more functions than Hiero.

(2) Hiero Introduction

Hiero Main Interface

 

 

Select the font in the system from the font on the left, or load the font in the file, and set the font size, simhei, italic, and so on. Then select the effects on the right, select what you like, and then set the width and height in rendering. Then we can select reset cache, which is as follows:

 

 

Then, click Save bmfont files of file, for example:

 

 

 

In this way, we can get the bmfont file, the image used by a PNG sprite table and a fnt control file.

(3) how to use cclabelbmfont to parse and display

 

 

Write the following code in Initialization:

 

Cclabelttf * label = [cclabelttf labelwithstring: @ "I'm Andy from cclabelttf class" fontname: @ "marker felt" fontsize: 33]; Limit * label1 = [limit labelwithstring: @ "I'm Andy" fntfile: @ "Andy. fnt "]; cclabelbmfont * label2 = [cclabelbmfont labelwithstring: @" I'm andy2 "fntfile: @" andy2.fnt "]; // ask ctor the window sizecgsize size = [[ccdirector shareddire] winsize]; // position the label on the center of the screenlabel1.position = CCP (size. width/2, size. height/2 + 60); label. position = CCP (size. width/2, size. height/2); label2.position = CCP (size. width/2, size. height/2-60); // Add the label as a child to this layer [self addchild: label1]; [self addchild: Label]; [self addchild: label2];

 

In this way, we can get the display result of a simulator like that. This lesson describes scenario switching and dot matrix words, mainly scene animation implementation and how to make the dot matrix words we want. Now, let's talk about it here. Thank you for your support.

AttachedSource code:

Http://files.cnblogs.com/huangdongcheng/SceneTransition.zip

Http://files.cnblogs.com/huangdongcheng/HelloCocos.zip

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.