I'm building a SpriteKit based game and would like to have a heads up display to show various unit statistics (Example below on left). A user taps on a unit and can bring up a panel that hovers over the screen and is relevant to the current unit. The user can dismiss the panel at any time and go back to gameplay.
I've looked at the sprite kit programming guide, and see that it is limited to a one line label nodes that are built in Sprite Kit. I'm also aware of this answer on adding a UITextField within didMoveToView:
However, reading the documentation it appears that didMoveToView: gets called once the scene loads. I've also seen that scene transitions are possible, but the panel that I'm thinking of does not require a full screen transition.
How would I implement a HUD panel like below using UIView and SpriteKit elements in iOS? Are there any open source projects that can give me a head start on this task?
Simply make a UIKit app as you would normally.
The SpriteKit SKView and the SKScene you present within should be just one of your views in the hierarchy.
I think in SpriteKit really should just implement actual game scenes, all the menu / overlaying HUD can be done in UIKit. That is what it stands for.
Related
I am pretty new at SceneKit and the first thing I noticed is the time it takes to load a DAE environment and characters. I've been looking for ways to show a loading screen while the environment is loading but none of them seem to work.
Whenever I push from menu screen to game screen, it would show around half of the menu screen and half of the game's screen with the UIKit components, and after about 3 seconds, then it shows the game screen without finishing the push animation transition. This is obviously not a good user experience so I would like to know how to add a loading screen until the environment shows up and preferably not freeze the UI because I want to find opponents in the backend as well as the user be able to cancel.
I currently have the entire views of game screen load in viewDidLoad. If you could provide an loading page example either a view or viewController that would be appreciated.
I created a custom UIKit progress bar to add some better affects and called a progressUpdate to move the bar. A gameNodes (sharedInstance) class where I cache and share node information with other classes. gameNodes->loadModels() does a call back every N/Total to update the bar. In gameViewController->viewDidLoad, I loaded the models after I created UIKit components and aligned them. I tried a splash screen to help, but I must have done it wrong because it never really worked. There is some wait time because scenekit had to load (in my case), so it wasn't perfect on all devices. However, it did produce what I felt like was reasonable feedback as the models were loading.
I made a simple game with swift spritekit and I was planning to implement a button that will display a dialog box and was searching around on tutorials on custom dialog but found none that helped me. I know how to make a simple dialog with with a UIView, but the problem is I have no clue how to make a custom dialog box that gives you options to transition to main menu, restart the game and such. I've found How can I pause a game in SpriteKit and SceneKit - SWIFT but still not enough.
I managed to make a dialog box with a UIView but I cannot transition to other gamescene, and I also cannot customize the looks of it that suits my games atomsphere. If there is some tips or samples that are easyto percieve will be great since I started swift just recently. I would love to hear from you!
The solution was quite simple, I was able to implement a custom dialog that would transition to the main menu after using the SKScene parameter that has been passed into the init() within the class that extends the UIView.
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.
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.
I have some ideas,I have already drawn the scenes roughly and put them into corona.
This is how I would think it would work.
1.I have all the major scenes
2.In each major scene ,there are mini scenes,which lead to smaller scenes with puzzles.
3.I create a game.lua module so it would handle the game logics,and keep track of them.
Example:
A.Door is opened,puzzle number one is solved.
B.Send a costume event to the game module.
4.I need a separate module for inventory box so it acts as an overlay over other scenes.
It also interacts with game module.
.
I know you might say,wait till you get started,but Am I on the right Track?
Do you have better suggestions or know any code examples(Corona Sdk,Lua,Moai,GiderosMobile)?
.
Thanks in advance
I am making a game more or less on this style using Corona, there are a beta on google play.
Corona SDK offers a API named Storyboard, that API allow you to code each scene as a lua module, and allows also you to load a scene as a "overlay".
I guess that you would make each of your scenes a full Storyboard scene, and the inventory a "overlay" scene.
The difference between overlay to a normal scene, is that when you load a overlay it triggers a event on the scene that was open instead of unloading that scene (And when the overlay is unloaded, it triggers another event)
So yes, at least if you do it in Corona, you are in the right track!