如何使相机跟随播放器? [英] How to make camera follow the player?

查看:205
本文介绍了如何使相机跟随播放器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都有一个代码在swift中使相机跟随播放器?
是否创建相机节点,如:

var camera = SKSpriteNode()

Anybody have a code in swift to make camera follow the player? Whether to create camera node, like:
var camera = SKSpriteNode() ?

推荐答案

上面的答案实际上是错误的,苹果文档为你提供了一个相机节点的整个实现(虽然我一直通过Objective-C读它)。我会链接你和其他人,在这个答案的文档,所以你可以学习它,而不是只是复制和粘贴一些代码。希望这有助于!

The above answer is actually wrong, Apple docs provides you with a whole implementation for a camera node (although I've always read it through Objective-C). I'll link you, and others, to the doc in this answer so you can learn it instead of just copy and pasting some code. Hope this helps!

https://developer.apple.com/library/prerelease/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Actions/Actions.html

这篇关于如何使相机跟随播放器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆