Working with Sprites

 1、An SKSpriteNode object can be drawn either as a rectangle with a texture mapped onto it or as a colored, untextured rectangle.

  SpriteNode可以是一个包含了texture的结点也可以是一个无texture的色块。

 2、anchorPoint属性用于指定中心位置(旋转轴),默认是(0.5,0.5)。

 3、centerRect属性用于实现拉伸的九宫格。The default value is a rectangle that covers the entire texture。

 4、color和colorBlendFactor用于实现node颜色与texture颜色的混合。The color blend factor defaults to 0.0。

 5、blendMode用于决定与framebuffer中颜色的混合方式。

 6、TextureAtlas用于用于将多个texture聚合为一张图。

 7、preloadTexture方法用于预加载函数。

Texture Atlas

  To avoid making multiple drawing passes, Sprite Kit uses texture atlases to collect related images together. You specify which assets should be collected together, and Xcode builds a texture atlas automatically. Then, when your game loads the texture atlas, Sprite Kit manages all the images inside the atlas as if they were a single texture. You continue to use SKTextureobjects to access the elements contained in the atlas.

  During build time, the compiler looks for any folders with the naming format of name.atlas. After those folders have been identified, all of the images within the folders are combined into one or more large image files. Texture atlases are automatically available to apps that include the Sprite Kit framework.

  After the app is built, new folders are created with a .atlasc suffix and placed in your app bundle’s Resource folder. Those new images are automatically rotated and trimmed to fit the maximum number of images into a single file, one whose images and orientation are tracked by a property list (.plist) associated with the folder. You do not need to change your code in order to use the texture atlas feature.

  When generating the .atlasc folders and image files, the following rules apply:

  • Each compiled image has a maximum size of 2000 x 2000 pixels.

  • After an image has reached its maximum size, a new image is created.

  • Images for the same device are kept together—for example, all iPhone images are in one file (~iphone.1.png), and all iPad images are in another file (-ipad.1.png).

Adding Actions to Nodes

 1、结点的runAction方法用于启动一个action。

 2、runAction:withKey:给action定义一个名字,用于以后引用。

 3、组合类型有3种,sequence、group(Run Actions in Parallel)、repeating action。

 4、The wait action is a special action that is usually used only in sequences. This action simply waits for a period of time and then ends, without doing anything; you use them to control the timing of a sequence.

  SKAction *wait = [SKAction waitForDuration: 0.5];

 5、The removeNode action is an instantaneous action, so it takes no time to execute. You can see that although this action is part of the sequence, it does not appear on the timeline in Figure 3-1. As an instantaneous action, it begins and completes immediately after the fade action completes. This action ends the sequence.

  SKAction *removeNode = [SKAction removeFromParent];

 6、Call the nodeAtPoint: method to find the first descendant that intersects the point, or use thenodesAtPoint: method to receive an array of all of the nodes that intersect the point.

Building Your Scene

 1、可以通过z值或默认以顺序来显示node,ignoreSiblingOrder可以指定不管list-order。

 2、高级搜索通过提供\,\\,*来提供更高级的node查找服务。

Transitioning Between Two Scenes

 1、使用SKTransition的示例:

  

  When the transition occurs, the scene property is immediately updated to point to the new scene. Then, the animation occurs. Finally, the strong reference to the old scene is removed. If you need to keep the scene around after the transition occurs, your app needs to keep its own strong reference to the old scene.

 2、pausesIncomingScene & pausesOutgoingScene 决定在场景转换时,动画是否继续。

 3、willMoveFromView & didMoveToView,用于监测scene被加载/移除到一个SKView。

Working with Sprites的更多相关文章

  1. CSS Sprites优缺点

    利用CSS Sprites能很好地减少网页的http请求,从而大大的提高页面的性能,这也是CSS Sprites最大的优点,也是其被广泛传播和应用的主要原因: CSS Sprites能减少图片的字节, ...

  2. 神奇的CSS sprites,制作特效的新方法

    本文主要内容简译自Dava Shea的英文文章 CSS Sprites: Image Slicing’s Kiss of Death,如果觉得博主讲的含糊不清的话,可以看作者原文. 熟悉了常规切图的我 ...

  3. CSS3与页面布局学习笔记(五)——Web Font与CSS Sprites(又称CSS精灵、雪碧图)技术

    一.web font web font是应用在web中的一种字体技术,在CSS中使用font-face定义新的字体.先了解操作系统中的字体: a).安装好操作系统后,会默认安装一些字体,这些字体文件描 ...

  4. Css Sprites 多张图片整合在一张图片上

    CSS Sprites原理: CSS Sprites其实就是把网页中一些背景图片整合到一张图片文件中,再利用CSS的"background-image","backgro ...

  5. compass Sprites 雪碧图 小图片合成[Sass和compass学习笔记]

    demo 源码 地址 https://github.com/qqqzhch/webfans 什么是雪碧图? CSS雪碧 即CSS Sprites,也有人叫它CSS精灵,是一种CSS图像合并技术,该方法 ...

  6. CSS Sprites+CSS3 Icon Font

    CSS Sprites+CSS3 Icon Font CSS Sprites在国内很多人叫CSS精灵,是一种网页图片应用处理方式.它允许你将一个页面涉及到的所有零星图片都包含到一张大图中去,这样一来, ...

  7. 使用CSS3的background-size优化Sprites图显示

    当我的Sprites图像是300px,如何指定background-size为32px呢?其实不难,只需要一点点数学计算,这是一个很初级的过程. 在我们的实例中,我们使用媒体社交图标.我想让他们都按1 ...

  8. cocos2dx day 2 - Sprites

    1.Sprite 对sprite设置anchor point,对应的位置 // DEFAULT anchor point for all Sprites mySprite->setAnchorP ...

  9. 使用CSS sprites减少HTTP请求

    sprites是鬼怪,小妖精,调皮鬼的意思,初听这个高端洋气的名字我被震慑住了,一步步掀开其面纱后发觉很简单的东西,作用却很大 神马是CSS 小妖精 CSS sprites是指把网页中很多小图片(很多 ...

  10. CSS Sprites (CSS图像拼合技术)教程工具

    什么是CSS Sprites? “Sprite”(精灵)这个词在计算机图形学中有它独特的定义,由于游戏.视频等画质越来越高,必须有一种技术可以智能的处理材质和贴图,并且要 同时保持画面流畅.“Spri ...

随机推荐

  1. Tomcat遇到”Error listenerStart”或”Error filterStart”问题且无详细日志时的log配置.

    昨天部署web应用到Tomcat之后,无法成功启动,并且控制台没有详细的错误信息,顶多就两行提示信息,例如:严重: Error listenerStart严重: Context [/lizongbo] ...

  2. BigDecimal四舍五入

    /*由数字字符串构造BigDecimal的方法 *设置BigDecimal的小数位数的方法 */ import java.math.BigDecimal; //数字字符串 String StrBd=& ...

  3. Asp.Net生命周期系列四

    上回我们说的当一个Http请求来到HttpModule这里的时候,Asp.Net内部并未对这个Http请求做出任何的处理,我们可以对这个Http请求添加一些我们需要的信息,以方便我们控制这个Http请 ...

  4. Java中String 的equals 和==详解

    一.Java中数据存储区域包括: 1.寄存器:最快的存储区,由编译器根据需求进行分配,我们在程序中无法控制. 2. 栈:存放基本类型的变量数据和对象的引用,但对象本身不存放在栈中,而是存放在堆(new ...

  5. LA 4255 (拓扑排序 并查集) Guess

    设这个序列的前缀和为Si(0 <= i <= n),S0 = 0 每一个符号对应两个前缀和的大小关系,然后根据这个关系拓扑排序一下. 还要注意一下前缀和相等的情况,所以用一个并查集来查询. ...

  6. hdu4604 deque

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4604 思路:就是模拟一下,求每一个开始的非上升和非下降序列.然后求重复的数,由于求出来可能不会是我们想 ...

  7. DOM应用

    父级.removeChild(子节点);父级.appendChild(子节点);父级.insertBefore(子节点, 在谁之前); 创建元素: <script> window.onlo ...

  8. 解决VS2013/VS2010简体中文版无法使用ReSharper快捷键的问题

    对于简体中文版VS2013,若应用ReSharper快捷键失效,按下面方法修复: 1) 首先在ReSharper设置里,应用你的快捷键设置 2) 关闭VS2013,然后用记事本打开“%LOCALAPP ...

  9. linux上改变mysql数据文件的位置

    用软连接改变了/var/lib/mysql的位置,并设置好mysql.mysql的权限,但是发现还是不能启动. 发现/var/log/mysqld.log 150308 16:16:02 [Warni ...

  10. 文件IO一些注意的地方

    两个各自独立的进程各自打开同一个文件,则每个进程都有各自的文件表项.这是因为每个进程都有它自己对该文件的当前偏移量.但是对一个给定的文件只有一个v节点表项.lseek()只修改文件表项中的当前文件偏移 ...