The ccsprite object is replaced by SP.
Summary is not separate from each other, logic ~
SP: setscalex (value) x axis horizontal scaling Value Ratio
SP: setscaley (value) Y axis horizontal scaling Value Ratio
SP: setposition (CCP (x, y) sets the position of the genie at the CCP (x, y) Point.
SP: setopacity (value) sets the sprite's transparency to the value.
SP: setrotation (angle): Set the Rotation Angle of
What is anchor point? It is hard to understand because we usually look at an image to determine the position of the Image Based on the image center. In cocos2d, the position of an image is determined by two dimensions: position, the center of the image, and anchor point. As long as we figure out their relationships, we will naturally be able to solve them.
Their relationship is as follows:
Actualposition. x = position. x + width * (0.5-anchor_point.x); acturalposition. Y = position. Y + height *
(). Therefore, the converted coordinate system is the same as the convertToNodeSpace above, the results are the same. The convertToWorldSpaceAR test: CCSprite * sprite1 = CCSprite: spriteWithFile ("CloseNormal.png"); sprite1-> setPosition (ccp (20, 40 )); sprite1-> setAnchorPoint (ccp (0, 0); this-> addChild (sprite1); CCSprite * sprite2 = CCSprite: spriteWithFile ("CloseNormal.png "); sprite2-> setPositio
. That is to say, electric lights and other electrical appliances inherit and implement our standard switch interface, and our switch manufacturer does not need to care about what kind of equipment it wants to control, but only about the Standard switch standard. This is the principle of dependency inversion.
It seems that the browser does not depend on the Web server, but only on the HTTP protocol. This principle is too important. The division of labor and standardization of society are the emb
Cocos2dx mask layer failed on android phone, cocos2dxandroid
1. Use CCClippingNode (OK on the simulator, not on the mobile phone) to achieve multiple cut areas
Local layer = CCLayerColor: create (ccc4 (0,110 ))
--/* Create a cropping node */
Local pClip = CCClippingNode: create ()
PClip: setInverted (true) --; // sets whether to reverse. It determines whether the circle is transparent or black.
PClip: setAlphaThreshold (0.0)
Self: addChild (pClip)
--/* Add the LayerColor layer to the cropping n
, you only need to deal with one batchNode, and only one Node is displayed on the interface.
//// Maid. m // 31_cocos2D getting started /// Created by beyond on 14-9-27. // Copyright (c) 2014 com. beyond. all rights reserved. // # import "maid. h "@ interface participant scene () {// demonstrate the built-in particle effect CCParticleSystem * _ participant system; // display the particle effect name CCLabelTTF * _ label ;} @ end @ implementation maid # pragma mark-Override parent class method-(
When I look at the introduction of the coordinate system of the network (http://www.tairan.com/archives/5739/), I don't understand why the blogger should explain it to converttoworldspace. I think it's possible to explain this: explain Converttoworldspace. His example changes, as follows:Auto *sprite1 = Sprite::create ("Helloworld.png"); Sprite1->setposition (CCP ( -, +)); Sprite1->setanchorpoint (CCP (0,0)
:.................... Static Vector
Cpp File
Bool GameBaseScene: init (){.................... // Before adding a role, you must prevent the role from being blocked by addPathMark (); addPlayer ();.......................... Return true ;}
Implement the addPathMark method in GameBaseScene. cpp.
Void GameBaseScene: addPathMark () {// This method creates Six Paths to block Sprite and add it to the current scenario Sprite * mark1 = Sprite: create (PATH_MARK_1 ); sprite * mark2 = Sprite: create
Use progresstdx in Cocos2d-X to achieve some simple results, cocos2dx authoritative guide
I introduced the usage of ProgressTimer in the previous blog. This blog decided to write some simple results using Progress,
Program example: progresst1 achieves effect 1
First, add two images to the Resource folder under the project directory.
Then define a Progress class
Add the following code in Progress. h.
#ifndef _Progress_H_#define _Progress_H_#include "cocos2d.h"USING_NS_CC;class Progress : publ
Thanks for the comments and attention, welcome to reprint and share.Hard work and perseverance.
first, the whole ccactioninterval action acceleration or deceleration, this is very simple as long as a code can be.
Ccdirector::shareddirector ()->getscheduler ()->settimescale (2);//play at twice times the current speed
Ccdirector::shareddirector ()->getscheduler ()->settimescale (0.5);//play at 0.5 times times the current speed
acceleration or deceleration of individual actions
There ar
Made
To scroll the text in a certain area, use CCClippingNode to make a cropping area. The text in this area can be displayed, and the text cannot be seen after the area is displayed.
Bool TestLayer: init () {CCSize size = CCDirector: sharedDirector ()-> getVisibleSize (); // create the text to be displayed, text = CCLabelTTF :: create ("text \ nbaibai \ n White \ nbaibai \ nhaha \ nahha \ n", "", 30); text-> setPosition (ccp (100, -120); // draw the
Cocos2dx uses CCClippingNode In the cropping area to implement rolling subtitles.
To scroll the text in a certain area, use CCClippingNode to make a cropping area. The text in this area can be displayed, and the text cannot be seen after the area is displayed.
Bool TestLayer: init () {CCSize size = CCDirector: sharedDirector ()-> getVisibleSize (); // create the text to be displayed, text = CCLabelTTF :: create ("text \ nbaibai \ n White \ nbaibai \ nhaha \ nahha \ n", "", 30); text-> setPositio
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