spritekit-(Sknode)

Source: Internet
Author: User
Tags spritekit

1. Initialization

+ (instancetype) node; + (Nullable Instancetype) Nodewithfilenamed: (nsstring*) filename;

2. Return border border

-(CGRect) calculateaccumulatedframe;

3. Coordinates

// The position coordinate system of the parent node of the node @property (nonatomic) cgpoint position; // Z-values of the nodes (for sorting). Negative Z is the "to" screen, and Z of the front screen is "out". The larger zposition will be in front of a smaller zposition sort.  @property (nonatomic) cgfloat zposition; // rotate around Z axis (radians) @property (nonatomic) cgfloat zrotation; // x Scale @property (nonatomic) cgfloat XScale; // y scale @property (nonatomic) cgfloat Yscale;

4. Some properties

//Speed@property (nonatomic) cgfloat speed;//Transparency@property (nonatomic) cgfloat Alpha;//controls whether the behavior of the node is updated or paused@property (nonatomic, getter =ispaused) BOOL paused//whether to hide@property (nonatomic, getter =Ishidden) BOOL hidden;//controls whether the node receives touch events@property (Nonatomic, getter=isuserinteractionenabled) BOOL userinteractionenabled;//parent Node@property (Nonatomic,ReadOnly, nullable) Sknode *parent;//child Nodes@property (Nonatomic,ReadOnly) nsarray<sknode*> *children;//Node name@property (nonatomic, copy, nullable) NSString *name;//the scene where the node resides@property (Nonatomic,ReadOnly, nullable) skscene*scene;//the physical body connects nodes, synchronizes, rotates, and positions@property (Nonatomic, retain, nullable) Skphysicsbody *Physicsbody;//an optional dictionary that can be used to store your own data in one node. The default is zero. @property (Nonatomic, retain, nullable) nsmutabledictionary *UserData;//kinematic constraints to address local knowledge@property (nonatomic, copy, nullable) Skreachconstraints *reachconstraints;//An optional series of skconstraints and physical constraints are evaluated after each frame operation. The transformation of the node will be changed to satisfy the constraint condition. @property (nonatomic, copy, nullable) nsarray<skconstraint*> *constraints;

5. Setting the size of X, y

-(void) Setscale: (cgfloat) scale;

6. Add Delete, move, traverse Wizard

-(void) AddChild: (Sknode *) node; -(void) Insertchild: (Sknode *) node Atindex: (Nsinteger) index; -(void) Removechildreninarray: (nsarray<sknode*> *) nodes; -(void) Removeallchildren; -(void) removefromparent; -(void) Movetoparent: (Sknode *) parent; -(Nullable Sknode *) Childnodewithname: (NSString *) name; -(void) Enumeratechildnodeswithname: (NSString *) name Usingblock: (void (^) (Sknode *node, BOOL * stop)) block;

7. If there is a parent node

-(BOOL) Inparenthierarchy: (Sknode *) parent;

8. Run the action, get the action, remove the action

-(void) Runaction: (Skaction *) action; -(void) Runaction: (skaction *) Action completion: (void (^) ()) block; -(void) Runaction: (skaction *) Action Withkey: (NSString *) key; - (BOOL) hasactions; -(Nullable skaction *) Actionforkey: (NSString *) key; -(void) Removeactionforkey: (NSString *) key; -(void) removeallactions;

9. Fill in the coordinates to return to the above wizard

- (BOOL) Containspoint: (Cgpoint) p; -(Sknode *) Nodeatpoint: (Cgpoint) p; -(nsarray<sknode*> *) Nodesatpoint: (Cgpoint) p;

10. Mobile Wizard

-(Cgpoint) Convertpoint: (cgpoint) point fromnode: (Sknode *) node; -(Cgpoint) Convertpoint: (cgpoint) point tonode: (Sknode *) node;

11. Inserting Sprites

-(BOOL) Intersectsnode: (Sknode *) node;

12. Two sprites are the same

-(BOOL) Isequaltonode: (Sknode *) node;

13.GKPolygonObstacle

/*Returns An array of gkpolygonobstacles from a group of Skspritenode ' s textures in scene space. for use with gpobstaclegraph in Gameplaykit*/+ (nsarray<gkpolygonobstacle*> *) Obstaclesfromspritetextures: (nsarray<sknode*>*) Sprites accuracy: (float) accuracy;/*Returns An array of gkpolygonobstacles from a group of Sknode ' s transformed bounds in scene space. for use with gpobstaclegraph in Gameplaykit*/+ (nsarray<gkpolygonobstacle*> *) Obstaclesfromnodebounds: (nsarray<sknode*>*) nodes;/*Returns An array of gkpolygonobstacles from a group of Sknode ' s physics bodies in scene space. for use with gpobstaclegraph in Gameplaykit*/+ (nsarray<gkpolygonobstacle*> *) Obstaclesfromnodephysicsbodies: (nsarray<sknode*>*) nodes;

14, get the position of touch elf

-(Cgpoint) Locationinnode: (Sknode *) node;

spritekit-(Sknode)

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.