Unity 2D Space Shooter Tutorial Extra – Accelerometer Input and Virtual Shoot Button

Unity 2D Space Shooter Tutorial

In this tutorial we’ll  expand on our Unity 2D Space Shooter Tutorial series. We’ll set IOS (or Android) as our target platform.

We’ll implement:

1) Getting input from the accelerometer to control and move the player spaceship.

2) And also we’ll implement a virtual shoot button for the player.

 

To keep things simple and the code cleaner, we’re going to assume that the game project is specific for IOS (or Android).

If you want your Unity project to target multiple platforms you can use Unity’s platform defines to compile and execute a section of code for a specific platform.


#if UNITY_STANDALONE_WIN
Debug.Log("Windows Only");
#elif UNITY_IPHONE || UNITY_ANDROID
Debug.Log("iPhone or Android Only");
#else
Debug.Log("Any other platform");
#endif

 

About:

In this series of tutorials we’ll be making a 2D space shooter game made in Unity3D 5.1 and we’ll be programming in C#. This is a series of tutorials aimed for beginners who want to learn game development in Unity3D. We’ll assume you have some knowledge in a programming language, and that you are somewhat familiar with Unity’s interface.

 

Unity 2D Space Shooter Tutorial Part 1. (Project Setup and Player Animation)

Unity 2D Space Shooter Tutorial Part 2. (Player Input Movement)

Unity 2D Space Shooter Tutorial Part 3. (Player Bullet and Player Shooting)

Unity 2D Space Shooter Tutorial Part 4. (Enemy Animation and Enemy Spawner)

Unity 2D Space Shooter Tutorial Part 5. (Enemy Bullet and Enemy Shooting)

Unity 2D Space Shooter Tutorial Part 6. (Explosion Animation and Collision Detection)

Unity 2D Space Shooter Tutorial Part 7. (Lives UI, Play Button, and Game Manager)

Unity 2D Space Shooter Tutorial Part 8. (Score UI, SFX, and Bg Music)

Unity 2D Space Shooter Tutorial Part 9. (Game Scrolling Background)

Unity 2D Space Shooter Tutorial Part 10. (Timer UI and Game Title)

 

Additional Optional Tutorials To Expand On The Space Shooter Tutorial.

Unity 2D Space Shooter Tutorial Extra – IOS/Android Accelerometer Input and Shoot Virtual Button.

 

Watch in HD by Clicking in the video settings.

 

Additional Notes:

The shoot button sprite can be downloaded here: shoot_button02.png

 

References:

Unity – Manual: Platform Dependent Compilation

Unity – Manual: Unity Remote 4

blog comments powered by Disqus