Skip to content

Space Cruiser is a pixel art-style game where the player is a pilot who has been selected for a space exploration program. It was submitted and accepted on Swift Student Challenge 2023.

Notifications You must be signed in to change notification settings

thaxz/SpaceCruiser-WWDC23

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 

Repository files navigation

Space Cruiser - WWDC Scholarship Application [ACCEPTED]

This Swift Playgound App was created for WWDDC23 Swift Student Challenge

Introduction

Space Cruiser is a pixel art-style game where the player is a pilot who has been selected for a space exploration program. The player's mission is to visit different planets to gather information about them. The spaceship is controlled by tilting your device, which adds a level of immersion to the game. The player must navigate through each planet's unique environment and maintain control of your ship for a specific amount of time before moving on to the next one.

Project

This app was built with SwiftUI and utilizes the framework of CoreMotion, as well as the MVVM architecture. Space Cruiser's logic involves piloting a spacecraft and the device's motion is used to control the ship's rotation. The formula for rotating the player involves checking if the motionManager is available and then using the gravity data to calculate the device's orientation based on its accelerometer. To be more specific, using the 'atan2(:)' function to calculate the angle between the device's (x, y) accelerations and subtracting π to get radians from it. Then, the resulting angle is then converted to a CGFloat and used to set the spaceship rotation property, finally is a CGAffineTransform that applies a rotation transformation to the spachip.

How to play

First, download the code project and open the app in Xcode/Playground. After that, since this game needs accelerometer's data, you need to built on an actual iOS device.

Credits

About

Space Cruiser is a pixel art-style game where the player is a pilot who has been selected for a space exploration program. It was submitted and accepted on Swift Student Challenge 2023.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages