Skip to Content
Swift游戏开发经典实例
book

Swift游戏开发经典实例

by Jonathon Manning, Paris Buttfield-Addison
January 2020
Intermediate to advanced
356 pages
6h 4m
Chinese
China Electric Power Press Ltd.
Content preview from Swift游戏开发经典实例
124
3
当设备靠近一颗行星时(在编写本书时,这是很可能的),它可能会感应到行星的
磁场。地球是一个强磁体,因此磁力计的数据不可能为零。此外,设备自身也有一
些带弱磁性的部件,因此也会增加磁力计读数。而且,当设备在磁场中移动时,磁
力计的读数也会比静止不动要强一些。
因此,我们不能把磁力计感应数据看成是绝对的“有一个磁体在附近”或者“附近
没有磁体”。我们应该实时的比较这些数据:如果磁力计的读数猛然增加或降低,
则才可以认为设备附近存在磁体。
磁力计在游戏中的应用并不多见,因此新玩法会有很大的发展空间。这些都有待于
读者去发现,你想到了什么探测金属的新玩法了吗?
3.19
利用输入改善游戏设计
问题
如何利用
iOS
中的输入方式(有些是独有的)创建更好的游戏?
解决方案
当我们在考虑游戏的输入方式时,应当思考一下通常我们会在哪种环境下玩
iOS
戏?显然,
iPhone
iPad
本来就属于移动设备,人们经常会在户外使用它们,比
如上班的时候,躺在电视机前的沙发中的时候,或者在嘈杂的地铁中上下班的时候。
因此,
iOS
游戏应当简单,易于操纵,应当尽可能地使用更直接的操纵方式,如拖曳、
触摸、手势。人的注意力非常不容易集中,他们不想为了操纵某些东西而伤透脑筋。
否则,他们立马换成别的游戏。无论如何,在火车上你不可能有足够耐心在一个游
戏上进行多次失败的尝试。
如果玩家能够直接拖拽角色移动,那么就不要让用户去按屏幕上的方向键。如果游
戏中需要玩家把登上太空船的敌人震开,那为何不让用户直接去摇晃设备,而非要
用一个标题为“摇晃”的按钮? ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

精通機器學習

精通機器學習

Aurélien Géron
FreeBSD® Unleashed

FreeBSD® Unleashed

Brian Tiemann, Michael C. Urban
深入淺出代數

深入淺出代數

Tracey Pilone, Dan Pilone
Swift学习手册

Swift学习手册

Jon Manning, Paris Buttfield-Addison, Tim Nugent

Publisher Resources

ISBN: 9787519840129