博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SpriteKit-(SKNode)
阅读量:7028 次
发布时间:2019-06-28

本文共 3517 字,大约阅读时间需要 11 分钟。

1.初始化

+ (instancetype)node;+ (nullable instancetype)nodeWithFileNamed:(NSString*)filename;

2.返回边界边框

- (CGRect)calculateAccumulatedFrame;

3.坐标

//节点的父节点的位置坐标系统@property (nonatomic) CGPoint position;//z值的节点(用于排序)。负z是”到“屏幕,正面屏幕的z是“出去”。更大的zPosition将面前的一个较小的zPosition排序。@property (nonatomic) CGFloat zPosition;//绕z轴旋转(弧度)@property (nonatomic) CGFloat zRotation;//x比例@property (nonatomic) CGFloat xScale;//y比例@property (nonatomic) CGFloat yScale;

4.一些属性

//速度@property (nonatomic) CGFloat speed;//透明度@property (nonatomic) CGFloat alpha;//控制节点的行为是否更新或暂停@property (nonatomic, getter = isPaused) BOOL paused//是否隐藏@property (nonatomic, getter = isHidden) BOOL hidden;//控制节点是否接收触摸事件@property (nonatomic, getter=isUserInteractionEnabled) BOOL userInteractionEnabled;//父节点@property (nonatomic, readonly, nullable) SKNode *parent;//子节点@property (nonatomic, readonly) NSArray
*children;//节点名称@property (nonatomic, copy, nullable) NSString *name;//节点所在的场景@property (nonatomic, readonly, nullable) SKScene* scene;//物理身体连接的节点,同步,旋转,和地位@property (nonatomic, retain, nullable) SKPhysicsBody *physicsBody;//一个可选的字典,可用于您自己的数据存储在一个节点。默认为零。@property (nonatomic, retain, nullable) NSMutableDictionary *userData;//运动学约束,用于解决本土知识@property (nonatomic, copy, nullable) SKReachConstraints *reachConstraints;//可选的一系列SKConstraints和物理约束是评估每一帧后操作。节点的转换将被改变,以满足约束条件。@property (nonatomic, copy, nullable) NSArray
*constraints;

5.设置x,y的大小

- (void)setScale:(CGFloat)scale;

6.添加删除,移动,遍历精灵

- (void)addChild:(SKNode *)node;- (void)insertChild:(SKNode *)node atIndex:(NSInteger)index;- (void)removeChildrenInArray:(NSArray
*)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.如果有父节点

- (BOOL)inParentHierarchy:(SKNode *)parent;

8.运行动作,获取动作,移除动作

- (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.填写坐标返回上面的精灵

- (BOOL)containsPoint:(CGPoint)p;- (SKNode *)nodeAtPoint:(CGPoint)p;- (NSArray
*)nodesAtPoint:(CGPoint)p;

10.移动精灵

- (CGPoint)convertPoint:(CGPoint)point fromNode:(SKNode *)node;- (CGPoint)convertPoint:(CGPoint)point toNode:(SKNode *)node;

11.插入精灵

- (BOOL)intersectsNode:(SKNode *)node;

12.两个精灵是否相同

- (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
*)obstaclesFromSpriteTextures:(NSArray
*)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
*)obstaclesFromNodeBounds:(NSArray
*)nodes;/* Returns an array of GKPolygonObstacles from a group of SKNode's physics bodies in scene space. For use with GPObstacleGraph in GameplayKit */+ (NSArray
*)obstaclesFromNodePhysicsBodies:(NSArray
*)nodes;

14,获取触碰精灵的位置

- (CGPoint)locationInNode:(SKNode *)node;

 

转载于:https://www.cnblogs.com/hxwj/p/5369040.html

你可能感兴趣的文章
语音识别对比分析
查看>>
Linux命令之 wc
查看>>
在virtualbox中安装的ubuntu系统 共享数据空间分配的数据
查看>>
WinRAR4.11激活
查看>>
Oracle常用单行函数
查看>>
运行浏览器的最高版本
查看>>
PHP中解决ajax请求session过期退出登录问题
查看>>
拆分功能:第一步,建立 会员管理系统
查看>>
我的友情链接
查看>>
CXF+Spring+Hibernate实现RESTful webservice服务端示例
查看>>
HTML网络效果收集---HTML
查看>>
css @语法,@规则 @import @charset @font-face @fontdef @media @page
查看>>
asp.net系统过滤器、自定义过滤器
查看>>
CSS3 Animation
查看>>
重新认识java-忽视的注释
查看>>
Sierpinski三角
查看>>
Dos下查看端口
查看>>
深入探讨Java类加载器
查看>>
Go 开发 HTTP
查看>>
textview的滚动
查看>>