sknode

Subclassing SKNodes created with SpriteKit .sks scene file

↘锁芯ラ 提交于 2019-11-29 06:02:05
(this is for XCode 6 and iOS 8 beta 4) Love the new SceneKit editor. I'm successfully loading the scene from .sks file into a custom SKScene class. However, objects inside it are instantiated as default classes (SKNode, SKSpriteNode, etc), and i'm not sure how to bind them to be instantiated as custom subclasses instead. Currently, I'm getting around that by creating custom classes and linking to sprite nodes as a property, and that works ok I wrote a little helper delegate to deal with this: https://github.com/ice3-software/node-archive-delegate . It uses the NSKeyedUnarchiverDelegate to

SKNode convertPoint toNode & fromNode confusion?

爱⌒轻易说出口 提交于 2019-11-28 16:27:42
问题 I am a little confused by how the SKNode methods convertPoint:fromNode: and convertPoint:ToNode: are working, I have looked at the docs but its not that obvious what they do. For example, this ( see diagram below ) is a small test I did using convertPoint:fromNode: The black area is the SKScene background, the blue area is an SKSpriteNode parented to the SKScene , the red area is another SKSpriteNode parented to the blue sprite. The anchor points for both sprites are shown by the small green

applyImpulse towards CGPoint SpriteKit

守給你的承諾、 提交于 2019-11-28 06:40:59
问题 I'm kind of a newb in SpriteKit, game dev, as a matter of fact I'm just learning. So I got to a point where I what to move a bunch of nodes towards a users tap location. So far I fought that I might calculate a virtual right triangle and get sin and cos of angles based on the sides. Unfortunately that left me with a very strong impulse that doesn't really consider the user tap location. Any ideas? Thanks in advance. 回答1: Look up the shooting projectiles section in the tutorial by Ray

SKNode scale from the touched point

可紊 提交于 2019-11-27 01:58:39
问题 I have added UIPinchGestureRecognizer to my scene.view to scale my content. I actually scale the parent node where all my visible contents reside. But I have problem though with scaling point. The thing is node scale from the lower-left corner. It's definitely not what I want. Do I have to write lots of code to be able to scale from the point where pinching occurs? Could you please give some hints as to what way to follow. 回答1: I have been working on the same problem and my solution is shown