Cocos2d game development: Cocos2d v3 & quot; hello world & quot; + display spacecraft

Source: Internet
Author: User

V3 RC4 Image

Show a ship

Add the SpaceCargoShip.png file in Chapter1 to the project.

Code in init:

 
  1. CCSprite *spaceCargoShip = [CCSprite spriteWithImageNamed:@"SpaceCargoShip.png"];
  2. [spaceCargoShip setPosition:ccp(200.0f,150.9f)];
  3. [self addChild:spaceCargoShip];

Add the following two lines in the above Code to see the animation effect.

 
  1. id moveAction = [CCActionMoveTo actionWithDuration:5.0f position:ccp(0,100.0f)];
  2. [spaceCargoShip runAction:moveAction];
 
  1. CGSize size =[[CCDirector sharedDirector] viewSize];
  2. NSLog(@"%f , %f",size.width,size.height);

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.