How to Make a Destruction Physics Game on iPad
Knocking things over is one of the oldest joys in games. Stack some crates, drop something heavy, and watch it all come down. hyperPad's physics engine handles the falling, sliding, and tumbling for you, so you can build a destruction game on your iPad with a handful of Behaviors.
For inspiration, try Breaking Stuff Simulator on the hyperPad Hub. It's a creator-made game built around exactly this kind of play.
What you'll build
| Player action | What happens |
|---|---|
| Tap above the tower | A heavy ball drops from that spot |
| The ball hits the tower | Crates break apart and tumble |
| A crate hits the floor | The score goes up and the crate disappears |
| Run out of balls | The round ends and shows your score |
Build the tower
- Create a side-view Project so gravity pulls things down.
- Make a floor from an Object set with Make Wall. Tag it
floorin Object Tags. - Add a crate Graphic and set it with Make Physics.
- Duplicate the crate and stack copies into a tower. Start with three columns and four rows.
- Press play once without doing anything. The tower should stand still. If it wobbles and falls by itself, space the crates so they sit flat on each other.
Tag every crate crate so one set of Behaviors can handle all of them.
Make pieces that break apart
A tower of loose crates falls over. A tower that breaks feels better. Join some crates with Weld Attach when the Scene starts.
A weld glues two Objects together, but it isn't unbreakable. A strong enough hit pulls the pieces apart. That's the effect you want: the tower holds its shape until the ball lands, then splits into chunks.
Try welding pairs of crates rather than the whole tower. You'll get a mix of big chunks and single crates, which looks more natural.
Drop the wrecking ball
Place an invisible spawner Object above the tower and a heavy ball Object off screen. Give the ball Make Physics and a high mass with Set Mass.
On a large invisible touch area that covers the sky, add Started Touching. Then:
- Use the touch position from Started Touching with Move to Point, set to a duration of 0, to move the spawner to where the player tapped.
- Use Spawn on Object to create a ball at the spawner.
The ball falls and hits whatever is under it. A higher tap gives it more time to speed up, so players learn to aim.
Score when crates hit the floor
On the crates, add a Collision Event that checks for the floor tag. Connect it to:
- Add to Score on your score Label
- Play Sound for a thud
- Start Particles for a puff of dust
- Wait for half a second, then Destroy Object
Destroying crates after they land keeps the Scene from filling up with pieces. It also keeps the game running smoothly on older iPads.
The bottom row starts on the floor. Place those crates on a low platform instead, so they only score when they actually fall.
Make the hit feel heavy
Small effects make a big difference:
- Shake Screen when the ball first touches a crate
- A short slow-motion moment with Set Time Scale, then back to normal
- A louder sound for the first hit and quieter ones for the pieces that follow
Use slow motion sparingly. Once per drop is plenty.
Limit the balls
Store the remaining balls in an Attribute, starting at 3. Subtract one each drop and show it in a Label. When it reaches 0, wait a few seconds for things to settle, then show your results with Load Overlay.
Tune it
| What you notice | Try this |
|---|---|
| The ball bounces off without damage | Raise the ball's mass or drop it from higher |
| The tower collapses at the slightest touch | Add more welds or raise crate friction with Set Friction |
| Welds never break | Make the ball heavier or weld fewer pairs |
| The game slows down | Destroy crates sooner and use fewer, larger pieces |
Build towers players want to break
The tower is your level design. Try a tall, thin tower that sways, a wide wall with a weak spot near the bottom, or a castle with a single crate holding up the roof. Give players a target score for each one. The fun is in spotting the weak point and hitting it with the last ball.
