For this homework you will create a version of the Quiz App that displays the questions in 3D as they move off into the distance like the introductory stories in the Star Wars films, all while playing the Star Wars theme music. A Next button will cycle through the questions. A video of the app in action is at https://www.eecs.wsu.edu/~holder/courses/MAD/hw12/QuizAppHW12.mp4. See screen shots below. Specifically,
- Create a new Single View project, embed the view in a Navigation Controller, and set the title and prompt in the navigation bar. Drag in a SceneKit View and set its auto layout constraints to the edge of the navigation bar at the top and the edge of the view at the bottom, left and right. Add an outlet to this SceneKit View to the ViewController.
- Add a SceneKit Scene File to the project and name is “QuizScene.scn”. In the scene editor add two 3D Text objects: one for the question and one for the Next button. You will need to modify the color, position and angle of these 3D Text objects either in the scene editor or programmatically.
- Similar to HW2, add a Question class to the project. In the ViewController, initialize a quiz array containing at least three questions. You may want to add some newlines ‘\n’ in your question and answer strings if they are long, e.g., “The earth is which planet from the sun?.\n This will be…”.
- Also similar to HW2, add a method for displaying a question with the question number, prompt, and all answers, each on a separate line. The question as a whole should be centered and start somewhere near the bottom of the screen. See the code snippet below for how I positioned the question once the whole thing is in the string quizString.
- To the question text object add an infinitely-looping MoveBy action. You can tweak the dx/dy/dz and duration of the action to get the desired Star Wars effect.
- Create a Blink sequence action (fadeout, fadeIn) that is run on the Next text object whenever the user taps Next.
- Override the touchesEnded method to identify when the user taps the Next button. This should trigger the Blink action and advance to the next question, which should start at the bottom-center position again. Tapping Next on the last question should move to the first question in the quiz array.
- Finally, set up an AVAudioPlayer to continually loop through the Star Wars theme music. You can find an MP3 at https://archive.org/details/StarWarsThemeSongByJohnWilliams (see Download Options).
- We will test your app only in portrait mode on an iPhone 8 simulator, so the app does not have to adapt to different orientations or device sizes.
- And may the force be with you!