[英]How to make a view scrollable to view the full scene with sprites with Swift and SpriteKit?
I have a Scene which now fills in the view: 我有一个场景,现在会填充视图:
scene.size = skView.bounds.size scene.scaleMode = .AspectFill
I fill in the scene with sprites from bottom to top and in my up they need to go further up - outside the view. 我用从下到上的精灵填充场景,在我的场景中,它们需要进一步向上移动-在视图之外。
So my scene should have the same width as a view but height should be... around 3000 fixed. 因此,我的场景应与视图具有相同的宽度,但高度应...固定为3000。
Sprite will fill in the screen and i want to scroll up to be able to view the whole scene. Sprite将填满屏幕,我想向上滚动才能查看整个场景。
Would you please give me an advice on how to "construct" that? 您能给我建议如何“构建”它吗?
You should create a node that acts as the World for the scene in your project and simply shift the y coordinate downwards to give the illusion of being able to see the scene that is further up. 您应该创建一个节点,充当项目中场景的世界,并简单地将y坐标向下移动,以产生能够看到更远的场景的幻觉。
Here is a quick road map: 这是一个快速的路线图:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.