文章插图
Objective-C和Sprite Kit游戏开发从入门到精通【Objective-C和Sprite Kit游戏开发从入门到精通】《Objective-C和Sprite Kit游戏开发从入门到精通》是于2017年1月清华大学出版社出版的一本图书 , 作者是曹化
前言为什幺要写这本书这是一个真实的故事 。儿时与兄弟们玩街机和FC游戏的场景仍历历在目 , 不知不觉中就玩到了20世纪90年代 。在学习和使用计算机过程中 , 发现除了能敲出自己的名字 , 还可以玩一些那幺有吸引力的游戏——海阔开空、千军万马 , 数不清的战斗!数不清的不眠之夜!玩果然是天性!图书简介本书是一执行绪序员凝聚自己多年开发经验的结晶之作 , 深入浅出地讲解Objective-C语言、Foundation框架、SpriteKit框架 , 以及其他开发iOS和Mac游戏所需要的基础知识 , 帮助读者零基础实践iOS和Mac游戏开发 。目录第1章準备工作·····11.1本书内容················11.2使用Xcode··············21.3第一个Objective-C程式··················41.4获取帮助················7第2章Objective-C开发基础·········82.1代码档案················92.2注释·122.3变数·122.4常量·132.5整数·152.5.1取值範围················152.5.2算术运算················162.5.3NSLog()函式与格式化输出·············172.5.4组合运算符·············172.5.5增量与减量运算·······182.5.6二进制与位运算·······182.6浮点数··················232.7布尔类型···············242.7.1BOOL类型··············242.7.2布尔运算················252.8字元·262.9指针·282.10自定义函式··········292.10.1返回值类型···········302.10.2函式名·················302.10.3参数302.10.4参数指针··············312.11static关键字··········322.12块(block)··········332.13枚举···················352.14结构···················372.15随机数················382.16预处理················382.16.1#define和#undef指令392.16.2条件编译指令········392.16.3#import指令···········40第3章代码流程控制·················413.1比较运算···············413.2条件语句···············423.2.1if语句423.2.2?:运算符·················433.3选择语句···············443.4循环语句···············463.4.1for语句结构············463.4.2while语句结构·········473.4.3do-while语句结构·····473.4.4break语句···············483.4.5continue语句···········483.5goto语句与标籤······493.6异常处理···············49第4章面向对象编程·················514.1面向对象编程基础···514.2类与对象···············534.2.1接口部分················534.2.2实现部分················544.2.3创建对象(实例化)·554.2.4类的成员················564.3方法(任务)·········584.3.1创建方法················584.3.2description方法与NSLog()函式·········614.4属性·614.4.1使用@proeprty和@synthesize指令·····624.4.2使用setter和getter方法···················634.5初始化方法············644.6继承·654.6.1成员的访问·············654.6.2重写属性和方法·······674.6.3继承关係中的初始化·674.7分类·694.7.1命名分类················704.7.2匿名分类················714.8对象複製与传递······714.8.1对象的複製·············714.8.2对象作为参数··········72 4.9动态处理类和对象···724.9.1对象类型判断··········724.9.2方法存在判断··········734.9.3动态调用方法··········74第5章协定·········755.1创建协定···············755.2实现协定···············765.3可选成员···············775.4实现多个协定·········785.5对象深複製(实现NSCopying协定)··················79第6章数组、集合与字典···········826.1C风格数组·············826.2不可变数组(NSArray类型)·········846.2.1创建NSArray对象·····846.2.2数字对象(NSNumber类)·············846.2.3使用NSValue类········856.2.4数组成员操作··········866.2.5保存与载入·············876.3可变数组(NSMutableArray类型)··886.3.1创建NSMutableArray对象···············896.3.2添加成员················896.3.3删除成员················906.3.4替换成员················906.4集合(Set)···········916.4.1不可变集合(NSSet类)················916.4.2可变集合(NSMutableSet类)·········926.5字典(NSDictionary)··················936.5.1创建字典对象··········936.5.2常用成员················936.5.3NSMutableDictionary类··················94第7章字元串······967.1C风格字元串··········967.2不可变字元串(NSString类)·········977.2.1创建NSString对象·····977.2.2返回字元数量··········987.2.3截取子字元串和字元·987.2.4大小写转换·············997.2.5转换为C风格字元串··997.2.6字元串比较与匹配··1007.2.7转换为数值···········1017.2.8保存与读取···········101 7.3可变字元串(NSMutableString类)···················1027.3.1创建NSMutableString对象·············1027.3.2NSMutableString常用成员·············1027.4使用NSURL类······103第8章本地化字元串················1058.1判断系统语言类型·1058.2NSLocalizedString··1068.3NSLocalizedStringFromTable·········1078.4综合套用·············108第9章日期与时间···················1099.1NSDate类············1099.1.1获取时间信息········1109.1.2时间的计算和比较··1109.2NSDateComponents类·················1119.3NSCalendar类·······1129.4时区与区域设定····1139.4.1NSTimeZone类·······1139.4.2NSDateFormatter类·1149.4.3NSLocale类···········1159.5封装CDate类········1159.5.1初始化方法···········1179.5.2时间、区域和时区··1189.5.3日期与时间数据·····1199.5.4测试1209.6获取中国农曆信息·1209.6.1初始化方法···········1219.6.2年份与名称···········1229.6.3月份与名称···········1239.6.4日期与名称···········1249.6.5属相1259.6.6测试125第10章档案与目录·················12710.1获取系统信息·····12710.1.1获取文稿目录(Documents)·······12810.1.2获取临时目录与GUID················12810.1.3更多系统信息······12910.2NSData与NSMutableData类········13010.3使用NSFileManager类···············13010.3.1档案或目录是否存在·················13110.3.2複製档案和目录···13110.3.3删除档案和目录···132 10.3.4移动、重命名档案和目录···········13310.3.5档案与目录的属性13310.4档案操作···········13410.4.1读取档案内容······13410.4.2写入档案············13410.4.3比较档案内容······13510.4.4检测档案读写许可权13510.5目录操作···········135第11章归档······13711.1归档与解档········13711.1.1实现NSCoding协定13711.1.2使用NSKeyedArchiver类和NSKeyedUnarchiver类···············13911.2利用归档複製对象···················140第12章通知中心与对话框········14212.1通知中心···········14212.2OSX对话框········14612.3iOS对话框··········14712.3.1回顾UIAlertView类15012.3.2使用UIAlertController类··············15212.3.3iPad中的UIAlertController···········154第13章SpriteKit基础··············15613.1第一个SpriteKit项目················15613.1.1启动界面············15913.1.2视图··················16113.1.3创建场景············16213.2iOS设备与系统信息··················16313.2.1设备类型与iOS版本···················16313.2.2萤幕尺寸············16413.3颜色·················16713.4节点树··············16813.6.2坐标转换············17413.7场景切换(SKTransition)·········17413.8游戏循环···········17613.9场景(SKScene)中显示对话框··17813.10Mac中的SpriteKit项目·············18013.10.1项目初始化········18013.10.2回响滑鼠与键盘··18113.10.3萤幕与尺寸········182 第14章精灵、纹理与角色控制···18514.1SKSpriteNode类···18514.1.1创建精灵节点······18514.1.2NSBundle类·········18714.1.3组合节点············18814.2SKTexture类·······18914.2.1截取纹理内容······18914.2.2精灵动画——翻滚的小行星·········19114.2.3更多的小行星······19114.3移动与碰撞········19214.3.1场景初始化·········19314.3.2碰撞检测与游戏状态·················19714.4触摸控制···········20014.4.1触摸回响方法······20014.4.2控制太空船·········20114.4.3单击··················20214.4.4手势··················20214.5Mac中的太空船···20714.5.1处理滑鼠操作······21014.5.2处理键盘控制······21214.5.3在update:方法中处理键盘控制·····213第15章动作与声音播放···········21615.1基本动作类型·····21715.1.1移动··················21715.1.2尺寸与缩放·········21815.1.3显示和隐藏·········21915.1.4旋转··················22015.1.5等待··················22115.2动作的组合········22115.2.1动作组···············22115.2.2动作序列············22215.2.3动作重複············22215.2.4动画动作············22315.3声音播放···········22315.3.1使用动作播放声音22315.3.2使用AVAudioPlayer播放声音········22415.4动作的使用········22415.4.1执行动作············22515.4.2通过键(Key)执行动作············22515.4.3取消所有动作······22615.4.4判断节点是否有动作执行···········22615.4.5修改动作速度······226 第16章更多节点类型··············22716.1SKShapeNode······22816.1.1基本图形节点······22916.1.2根据路径创建图形节点··············23016.2SKVideoNode······23116.3SKCropNode·······23216.4SKEffectNode······23316.5SKEmitterNode与粒子效果·········23416.5.1在Xcode中创建粒子··················23416.5.2下雪场景············23516.5.3模拟爆炸············23616.5.4SKEmitterNode类·23816.6节点的组合········240第17章SpriteKit游戏常用算法···24217.1两点距离···········24217.2碰撞测试···········24317.3角度·················24517.4视线·················24617.5躲避障碍物········249第18章综合测试——Mac版坦克大战25118.1场景初始化········25218.1.1创建坦克············25418.1.2创建敌人············25418.1.3创建岩石············25518.2坦克的操作········25518.2.1坦克的动作·········25618.2.2滑鼠和键盘控制···25718.2.3自动执行············25818.3敌人的AI···········25918.4处理已发射炮弹··26118.5自己动手···········262第19章加速计与陀螺仪···········26319.1自动回响···········26419.2调用数据···········26719.3游戏控制方法小结···················26919.3.1触控萤幕···············26919.3.2键盘与滑鼠·········270第20章网路状态27120.1检测网路状态·····27120.2监视网路状态·····272第21章GameCenter排行榜·····27421.1配置排行榜········274 21.2在套用中处理排行榜················27521.2.1GameCenter登录状态················27521.2.2提交成绩············277第22章套用内购买·················28022.1準备测试用户和设备················28022.2创建App内购买···28122.3在项目中使用App内购买···········28222.3.1检测访问限制与网路·················28222.3.2执行购买操作······28522.3.3恢复已购项目······28722.3.4在场景(SKScene)中执行购买操作···28722.3.5在场景(SKScene)中执行恢复操作··290
- 数据漫游打开和关闭有什么影响
- 国力仁和
- 昭和基地
- 宝宝膝盖书·经典的世界童话:狼和七只小羊
- 2017年陈哲远和李兰迪主演网路剧 秘果
- 医学数字成像和通信
- 中华人民共和国和阿富汗王国边界条约
- 射洪县仁和镇 仁和
- 破戒和尚
- 内蒙古呼和浩特市赛罕区下辖乡 太平庄乡