# Full iPhone game Project (Pong Clone) ..I'm in a giving mood

This was my first Unity game. I decided to give the project up to the community as another resource to learn from. I currently have it up on the appstore, but as a free download.

It’s a clone of Pong.

The code for this game was written in Javascript. There isn’t a ton of commenting, but the code is relatively clean (for a first project), so it should be a fairly good resource to learn from. If you have any questions, feel free to ask.

It covers the use of menus, accelerometer and touch controls, 2D using 3D elements, and more. It’s a full game.

As far as licensing goes… consider it the same as any other resource in the Unity Resources section. If UT want’s to add it to the resources section, that is fine by me.

Its good of you to give this away!

Geoff

Thank you man, that’s very keen

Fantastic work!
I was just searching for help in creating touch controls for my iPhone project. This looks perfect

Thank you Kevin!

I really needed a push in the right direction…

Chepe

PS. Wish somebody had a sample, how to calibrate the accelerometer angle before the game starts …

That is in there too.

Thank you kevinr!

I can learn a lot from it.

Thank you again!

Kevin:

So, what does the calibration do exackly???

Thanks,

Chepe

awesome, thanks a lot for sharing!!

Every little bit helps in the journey becoming an game developer!

Hi:

I tried to change the speed of the accelerometer in the editor, but it keeps resetting to 3. Any ideas on why its doing that. So, I just modified the Player Controller Script and multiply the Iphone.Input.acceleration by 20. That seem to do the trick.

Chepe

``````//iphone accelerometer
if (useAccelerometer)
{

var accelerator : Vector3 = iPhoneInput.acceleration * 20;
if (accelAxis == 0)
smooth = Mathf.Lerp(smooth, (accelerator.x - accelCalib.x) * accelerometerSpeed * Time.deltaTime,  Time.time);
else
smooth = Mathf.Lerp(smooth, (accelerator.y - accelCalib.y) * accelerometerSpeed * Time.deltaTime, Time.time);
player1.Translate(0, smooth, 0);
``````

That’s because the acceleration speed is being overridden by the PlayerPref values. Accelerometer speed (sensitivity) is one of the user configurable settings in the options menu.

Cool! I’m going to grab this now and publish to the App Store Maybe I’ll add a paper plane in there somewhere…

Kevin:

Yes, I noticed now. I change it to 60 in the Settingsinfo instead, but the accelerometer speed doesn’t change. Don’t know why …

``````accelerometerSensitivity = PlayerPrefs.GetFloat("accelerometerSensitivity", 60.0);
``````

Thanks,

Chepe

That only changes the default value. Since the setting has already been set, it’s going to use that setting. What you want to do is edit the values in the GUI slider in the settings menu. Then you can go in and change the slider in game and adjust your speed as you see fit.

Many thanks KevinR - that’s very generous of you! I’m sure this will be extremely useful to lots of Unity iPhone newcomers.

haha, nice shot :lol:

Thanks Kevin! It works!!! Great Example!

Chepe