In this tutorial I will teach you about the prototype i made for my aurdino (prototype) game with whoopee cushions.
for this tutorial you need the following:
- Aurdino (obviously) i used the yuo but others should work fine too.
- 3x pressure sensor
- 3x whoopee cushion
- 30k resistor
- a few male and female jumpers
- 2 sided tape
- 3D program (I used 3ds max but any 3D modeling program should do fine)
Step 1: Connecting the Aurdino
Connecting the aurdino for this project isn't really that hard just follow the example above and do this 3 times.
Use port A0, A1 and A2.
use the female and male jumpers for the pressure sensor so that it becomes a long cable.
(Tip: you can use some tape to connect the 2 cables)
Step 2: Script Aurdino
download the code and paste it in the aurdino software.
this script tells you how hard you press the 3 sensors.
if you press the sensor with a value of 500 or higher it should stop working after 2 sec.
this is so that people are forced tho continually press on the whoopee cushion.
Step 3: Unity Player
Make in unity a player and a terrain.
Make sure that the player has also the tag player on it.
Look at the example above what for components the player need.
You might need to change the COM in the script.
My aurdino had COM5 but it could be that yours has another number.
You can find the COM number in the aurdino software. (see example above)
You can now control the player with the 3 pressure sensors.
Step 4: (Optional) Make 3D Models
Now it's time to be creative open your 3d modelling program and make a model for
- the player
- a road tile
- the obstacle(s)
Export your files to an FBX and put them in your unity file.
Make sure that your new player get all the components from your old player
(and don't forget to change the tag to player).
If you don't feel like it or you just don't know how to 3D model.
You can use unity and make a few squares.
Step 5: Make an Infinite Road in Unity
before you start watching the video you might want to make a few different road tiles and attach the obstacle(s) on different places. In my prototype i had 7 different tiles.
Use this video to help you make an infinite road in unity. You can cut out the parts about the vertical parts since this game only uses an horizontal line.
If you're a bit more experienced in unity you can use the code that i made from this tutorial. since you should already know where to put the scripts.
When your finished with the tutorial don't forget to add box colliders on the sides off your tile so that you won't fall off the road. Also put colliders on your obstacles or else you will go right trough them.
Step 6: Final Step
Use the 2 sided tape to stick the sensors on the whoopee cushions.
Just make sure you don't stick them on the little hole or else the whoopee cushion won't work anymore.
I recommend to stick them a few centimeters from the left or right from the hole but any place should do fine.
now turn the cousins 180 degrees and hit that play button.