Ios7 系列视频教程 主讲老师:廖珑程 邮箱地址: [email protected]. Sprite Kit 与...
-
Upload
ami-obrien -
Category
Documents
-
view
236 -
download
9
Transcript of Ios7 系列视频教程 主讲老师:廖珑程 邮箱地址: [email protected]. Sprite Kit 与...
![Page 2: Ios7 系列视频教程 主讲老师:廖珑程 邮箱地址: ios_coder@126.com. Sprite Kit 与 cocos 2d 的对比 内嵌入 ios 系统中 很好的支持纹理和粒子效果 很多其他引擎无法做到的事情,(视](https://reader031.fdocuments.net/reader031/viewer/2022013106/5697bfdd1a28abf838cb18ae/html5/thumbnails/2.jpg)
Sprite Kit 与 cocos 2d的对比• 内嵌入 ios系统中
• 很好的支持纹理和粒子效果
• 很多其他引擎无法做到的事情,(视频)
• 可移植性不好
• 对 OPENGL的支持不好
![Page 3: Ios7 系列视频教程 主讲老师:廖珑程 邮箱地址: ios_coder@126.com. Sprite Kit 与 cocos 2d 的对比 内嵌入 ios 系统中 很好的支持纹理和粒子效果 很多其他引擎无法做到的事情,(视](https://reader031.fdocuments.net/reader031/viewer/2022013106/5697bfdd1a28abf838cb18ae/html5/thumbnails/3.jpg)
Sprite kit 中的基本类
• SKView
• SKScene
• SKNode
• SKSpriteNode
![Page 4: Ios7 系列视频教程 主讲老师:廖珑程 邮箱地址: ios_coder@126.com. Sprite Kit 与 cocos 2d 的对比 内嵌入 ios 系统中 很好的支持纹理和粒子效果 很多其他引擎无法做到的事情,(视](https://reader031.fdocuments.net/reader031/viewer/2022013106/5697bfdd1a28abf838cb18ae/html5/thumbnails/4.jpg)
SKNode
SKSpriteNode SKScene
SKView
![Page 5: Ios7 系列视频教程 主讲老师:廖珑程 邮箱地址: ios_coder@126.com. Sprite Kit 与 cocos 2d 的对比 内嵌入 ios 系统中 很好的支持纹理和粒子效果 很多其他引擎无法做到的事情,(视](https://reader031.fdocuments.net/reader031/viewer/2022013106/5697bfdd1a28abf838cb18ae/html5/thumbnails/5.jpg)
SKTexture
• + (SKTexture *)textureWithImageNamed:(NSString *)name
• + (SKTexture *)textureWithRect:(CGRect)rect inTexture:
(SKTexture *)texture
• + (SKTexture *)textureWithCGImage:(CGImageRef)image
![Page 6: Ios7 系列视频教程 主讲老师:廖珑程 邮箱地址: ios_coder@126.com. Sprite Kit 与 cocos 2d 的对比 内嵌入 ios 系统中 很好的支持纹理和粒子效果 很多其他引擎无法做到的事情,(视](https://reader031.fdocuments.net/reader031/viewer/2022013106/5697bfdd1a28abf838cb18ae/html5/thumbnails/6.jpg)
SKTextureAtlas
• + (SKTextureAtlas *)atlasNamed:(NSString *)name
• - (SKTexture *)textureNamed:(NSString *)name
![Page 7: Ios7 系列视频教程 主讲老师:廖珑程 邮箱地址: ios_coder@126.com. Sprite Kit 与 cocos 2d 的对比 内嵌入 ios 系统中 很好的支持纹理和粒子效果 很多其他引擎无法做到的事情,(视](https://reader031.fdocuments.net/reader031/viewer/2022013106/5697bfdd1a28abf838cb18ae/html5/thumbnails/7.jpg)
SKNode
• Position
• xScale
• yScale
• Alpha
• Paused
• Hidden
• userInteractionEnabl
ed
• Parent
• Children
• + (instancetype)node
• - (void)addChild:(SKNode *)node
• (void)removeFromParent
• (void)removeAllActions
• - (BOOL)containsPoint:(CGPoint)p
![Page 8: Ios7 系列视频教程 主讲老师:廖珑程 邮箱地址: ios_coder@126.com. Sprite Kit 与 cocos 2d 的对比 内嵌入 ios 系统中 很好的支持纹理和粒子效果 很多其他引擎无法做到的事情,(视](https://reader031.fdocuments.net/reader031/viewer/2022013106/5697bfdd1a28abf838cb18ae/html5/thumbnails/8.jpg)
SKSpriteNode
• anchorPoint
• size
• + (instancetype)spriteNodeWithTexture:(SKTexture *)texture
size:
• + (instancetype)spriteNodeWithTexture:(SKTexture
*)textureSKNode
• + (instancetype)spriteNodeWithImageNamed:(NSString *)name
• + (instancetype)spriteNodeWithColor:(SKColor *)color size:
(CGSize)size
![Page 9: Ios7 系列视频教程 主讲老师:廖珑程 邮箱地址: ios_coder@126.com. Sprite Kit 与 cocos 2d 的对比 内嵌入 ios 系统中 很好的支持纹理和粒子效果 很多其他引擎无法做到的事情,(视](https://reader031.fdocuments.net/reader031/viewer/2022013106/5697bfdd1a28abf838cb18ae/html5/thumbnails/9.jpg)
( 0,0)
anchorPoint
X
YSKScene
![Page 10: Ios7 系列视频教程 主讲老师:廖珑程 邮箱地址: ios_coder@126.com. Sprite Kit 与 cocos 2d 的对比 内嵌入 ios 系统中 很好的支持纹理和粒子效果 很多其他引擎无法做到的事情,(视](https://reader031.fdocuments.net/reader031/viewer/2022013106/5697bfdd1a28abf838cb18ae/html5/thumbnails/10.jpg)
坐标判断
• -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
• -(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
• -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
• -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
• UITouch 类别
• locationInNode
• CGRectIntersectsRect(CGRect rect1, CGRect rect2)
• CGRectContainsRect(CGRect rect1, CGRect rect2)
• CGRectContainsPoint(CGRect rect, CGPoint point)
![Page 11: Ios7 系列视频教程 主讲老师:廖珑程 邮箱地址: ios_coder@126.com. Sprite Kit 与 cocos 2d 的对比 内嵌入 ios 系统中 很好的支持纹理和粒子效果 很多其他引擎无法做到的事情,(视](https://reader031.fdocuments.net/reader031/viewer/2022013106/5697bfdd1a28abf838cb18ae/html5/thumbnails/11.jpg)
SKAction
• + (SKAction *)moveTo:(CGPoint)location duration:
(NSTimeInterval)sec
• + (SKAction *)sequence:(NSArray *)actions
• + (SKAction *)group:(NSArray *)actions
• + (SKAction *)playSoundFileNamed:(NSString*)soundFile
waitForCompletion:(BOOL)wait
• + (SKAction *)repeatActionForever:(SKAction *)action
• + (SKAction *)waitForDuration:(NSTimeInterval)sec
• + (SKAction *)animateWithTextures:(NSArray *)textures
timePerFrame:(NSTimeInterval)sec