Animating a "character" within iOS app that's not SpriteKit - ios

I am in talks with a client to do an app, but in it, they are wanting it to revolve around a little character that follows you throughout the app (think Clippy, from the old days of Microsoft Word :)).
One thought I had was, can I use an SKSprite/Node inside an iOS app not using the SpriteKit framework?
Or is this a matter of animating through an array of UIImages?
Those were my first thoughts - does anyone know the best direction to go in for something like this? I need basic animations for a character throughout the whole app.

Depending on the detail of animation needed, you could do it with just CoreAnimation and possibly selectively choosing the image to display in an UIImageView. For example, see the answers to this question: rotate a UIView around its center but several times

Simple answer is, No, out of the box you can't use a class from a framework and choose to not use the framework. Though I'm not exactly sure what that question means. An SKSpriteNode renders via an SKScene node, and an SKScene node renders via an SKView, which is rendered by a View Controller.
You could do something fancy like dedicate the SKView as only part of the screen, and have a standard UIKit view as the other part, or only have the SKView appear on the screen when you needed it I guess.

Related

Is there a way to layout my entire level in an .sks file, but only load whats currently in view?

I've seen this concept mentioned around the internet but can't find any specifics on how to do it.
I want to lay out my entire level in an .sks file but load only whats in the view of the player/frame at any given moment. In my game I have platforms that go up and down forever, simple roving enemies, and collectable coins that float in the air while bobbing up and down. Since these actions are using
SKAction.repeatForever
They are continuously going even when not in view of player. The only other option I see is giving every action a "key" and then placing invisible sprites through out the level that when contacted start and stop certain actions. While doable it seems it could get very convoluted very fast.
Is there a more straightforward way to lay out my entire scene, but only load what's currently in view? I'm not sure what to call this concept which is probably the reason I can't find much on it.
Any insight is appreciated!
There is no easy way to do it. My personal method is to load your SKS into an SKScene that is not attached to the root node at all (the SKView) and use SKCameraNode's containedNodeSet to move all nodes from the loaded scene over to the scene that is viewable to the user. You would then need to implement methods to continuously swap between the two scenes.
If your concern is only actions, then you can avoid the swapping and just pause all nodes not in the containedNodeSet and unease the ones that are inside of it.

Is there a way to overlay frames in SpriteKit?

As the title states, is there a way to stop the canvas / SKScene from clearing the contents of the current frame, and just draw over the current frame? Now the contents of the scene/frame are cleared every update cycle, i would like to just draw over the previous frame.
I have worked with OpenFrameworks and other visual programming frameworks, and the way it worked there was; you draw stuff on the update call, on the next update call you set a background again to 'clear' the previous frame.
I have looked through the whole documentation of SpriteKit and couldn't find anything. I also tried to emulate the effect by pushing more nodes onto the scene, having them follow one step behind the 'new' nodes. This was, as i expected, way to heavy on CPU / RAM.
No code, i know, i'm sorry, but the stuff i use is pretty basic. Any one of you have any thoughts on this?
Hope to hear from you, thanks.
You should be able to do this by setting the clearsContextBeforeDrawing property on your SKView to NO.
clearsContextBeforeDrawing is a property of UIView, which SKView is a subclass of.
I wouldn't consider this to technically be Sprite Kit providing the behavior, but I believe it's what you're looking for.
Note: I didn't actually test this, so it's possibly that this won't actually work. It would theoretically work perfectly for UIKit.

Is it posible to insert a UITextView (or other UIKit view) into an augmented reality SCNScene?

Weird crazy question I know. My current setup is a SCNScene with a camera controlled by the device's gyroscope. I'm able to add and light normal nodes, however I would like to add 2D UIView objects into the scene like UITextViews or maybe some buttons. The views would need to be inside the scene and thus become no longer visible if the camera moves away from them.
Firstly, is this even possible? Or would this be way more difficult to implement than rebuilding an editable textview as a node? Could this be achieved by categories or...?
I just talked to the scenekit people here at WWDC. He said that as of now it is completly impossible to do it in a nice, functional way. The only options he offered as a possible solution is to create the UIView element somewhere off screen or behind the scene and continuously take screenshots of the object and apply those images as a texture to a SCNNode. He also pointed out the performance will be very poor with this because taking screenshots is heavy and you can't get going very quick with it. So I guess this is a no-go until UIView adds support because, according to the engineer, it's impossible to implement this because of a UIView limitation and not a SceneKit one.

How do I animate a view on touch?

My scenario is common I think. I want to animate a focus reticle (just like Apple's default app and some of the other camera apps out there). Is this all done in drawRect:? Or can I use the animation framework right from the touch handler?
Following some of the examples around github (and the internet) I went ahead and just subclassed UIView (drawRect:) and a little simplistic "animateWithDuration:".

scrolling and pan/zoom in single scene cocos2D

I am currently working on my first IOS app and have sort of hit a 'brick wall' if you will. I am using Cocos2D for most of my graphical interface do to my preference and ease when working with chipmunk.
Currently I am trying to create a scene that has at least 2 layers displayed at once, split screen style. One layer I need to be a vertical scrolling menu, while the other layer I need to be a pan/zoom 'map' type layer. Being the noob that I am when it comes to Objective-C and Cocos2D I can not seem to figure out how to even attempt this. I have done some searching and came across the extensions for Cocos2D which offer the pan/zoom layer.
Any help or pointers to tutorials, references, sites, etc. would be greatly appreciated!

Resources