action ccactioninstant
Ccactioninstant inherits from ccfinitetimeactionIs an instant execution class. That is, the interval between the executed actions is zero.
Example:
// Instantly flip Y Action ccsprite * sp = ccsprite: Create ("icon.png"); ccflipy * flipy = ccflipy: Create (true); SP-> runaction (flipy ); //
Common actions are as follows:
/// Flip ccflipx: Create ('whether to Flip left or right bool '); ccflipy: Create ('whether to flip up or down bool'); // set the coordinate ccplace :: c
, such as Ccmoveby * Moveby = ccmoveby::create (0, CCP (100, 100)); This sentence means that the call wizard moves the x-axis (right) at the original location Point 100, moving 100 along the y-axis (UP). And if it is ccmoveto, it will move to the CCP (100, 100) this point.
However, in the actual game development process, may use more complex action effect, when we need to combine some objects, we need to us
The following operations are used to implement cyclic scrolling of background images:
There are two main background images that rotate cyclically: the width of the two selected background images is 1024, so # define BGIMG_WIDTH 1024 is defined.
The Code is as follows:
Declare two background image genie in the header file of HelloWorld. h.
#import "cocos2d.h"// HelloWorldLayer@interface HelloWorldLayer : CCLayer { CCSprite *bagSprite1; CCSprite *bagSprite2;}
Some Code implemented in the. m
Mathematical functions:
Ccp (x, y); // create a vector ccpFromSize (s) with coordinates x and y; // create a vector with the width of size s as x and height as y
Addition, subtraction, multiplication, division, and operation of CCPoint
CcpAdd (v1, v2); // equivalent ccp (v1.x + v2.x, v1.y + v2.y); ccpSub (v1, v2); // equivalent ccp (v1.x-v2.x, v1.y-v2
introduced first. We found that there is a string of text on the first Action UI of ActionsTest in TestCPP. It is the mark of the red box in the figure. We need to use the content displayed at this position.650) this. width = 650; "src =" ../attachment/201305/203726104 .png" align = "middle" border = "0" alt = ""/>Well, we know what to pay attention. In VS2010, we will search for text keys marked by red boxes.650) this. width = 650; "src =" ../attachment/201305/203944417 .png" border = "0" alt
the return value of its init () function is viewed. If init is successful, the object is added to the Auto Release pool. Otherwise, null is returned. Therefore, if you use this structure to define the class, you need to implement the init () function. All the interface elements are completed in the init () function, and then some callback functions are provided below. update () is used to complete random flight of the plane. 1. background [cpp] CCSprite * sl = CCSprite: create (s_loading); sl->
game interface and add the sprite to the Gamepause scene layer//Get the size of the window ccsize visiblesize = ccdirector:: Shareddirector ()->getvisiblesize (); Ccsprite *BACK_SPR = Ccsprite::createwithtexture (Sqr->getsprite ()->gettexture ()); Back_spr->setposition (CCP (VISIBLESIZE.WIDTH/2,VISIBLESIZE.HEIGHT/2)); The placement position, which is relative to the center position. Back_spr->setflipy (TRUE); Flip because UI coordinates a
Mathematical explanation of Cocos2d macros
The following text is reproduced from: Success.
/** Returns opposite of point.
@ Return CGPoint@ Since v0.7.2*/Static inline CGPointCcpNeg (const CGPoint v) // calculate the symmetric point of the Origin{Return ccp (-v. x,-v. y );}
/** Calculates sum of two points.@ Return CGPoint@ Since v0.7.2*/Static inline CGPointCcpAdd (const CGPoint v1, const CGPoint v2) // calculate the sum of the two vectors{Return
error code errorlevel or return code.
GotoWhen the batch file runs here, it will jump to the label specified by Goto, which is generally used with if. For example:
Goto end
: End
Echo this is the end
The label is represented by a string. The row where the label is located is not executed.
ChoiceYou can run different commands by entering a single character. The/C: parameter should be added for use, and C: should be followed by a prompt to enter characters without spaces. Its return code is 1
My goal is to do an ADSL dial-up gateway, this network is closed by MPD as a VPN gateway daemon, using the PPTP protocol as a transport protocol, because this machine has a Samba server, so I can not open all my ports, I must block all the unwanted ports. That's why it took a long time to study what the PPTP protocols need to pass through those ports on the firewall and those protocols. The purpose of the configuration has been told to you, the following is the process of configuration.
First f
later. Now, start cutting into the topic, but before you start, we suggest you take a look at the cocos2d-x Study Notes (22) -- map use 2 (TMX) in the section -- Z-Order, AnchorPoin, and anti-aliasing, we will first understand some concepts.
Step 1: first create a cocos2d-win32 project and name it MapTest2.
Step 2: Add a class in HelloWorldScene. h:[Html]Class MapTest2: public CCLayer{Protected:CCSprite * m_player;Public:MapTest2 ();~ MapTest2 ();Void repositionSprite (float dt );};
Add the fol
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.