# New example space\_shooter: space ship shooting rockets, destroying rocks, flying on a tiling background

**URL:** https://forum.castle-engine.io/t/new-example-space-shooter-space-ship-shooting-rockets-destroying-rocks-flying-on-a-tiling-background/1301
**Category:** News
**Created:** [August 11, 2024, 4:43pm UTC](https://forum.castle-engine.io/t/new-example-space-shooter-space-ship-shooting-rockets-destroying-rocks-flying-on-a-tiling-background/1301 "2024-08-11T16:43:45Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [August 11, 2024, 4:43pm UTC](https://forum.castle-engine.io/t/new-example-space-shooter-space-ship-shooting-rockets-destroying-rocks-flying-on-a-tiling-background/1301/1 "2024-08-11T16:43:45Z")

</div>

| [![Space shooter example](https://forum.castle-engine.io/uploads/default/original/2X/4/4456f9722d071c6d482893c4ac38184941e7294d.png)](https://castle-engine.io/wp/wp-content/uploads/2024/08/screenshot.png "Space shooter example") |

Enjoy a new example in our engine: [examples/space\_shooter](https://github.com/castle-engine/castle-engine/tree/master/examples/space_shooter). Features:

- 

- Background (drawn efficiently as one quad, with texture repeating to infinity).

- Rockets (fired by the player’s cannons). Each rocker has a collider and can detect when it hit an enemy. Rocket can be “armed” (destroys enemies) or “not” (just a ball that bounces off enemies).

- Enemies, played by the _Mighty Rotating Rocks_! They just move slowly towards the player. You can shoot them to destroy.

Technically:

- The player is just a `TCastleScene` inside a `TCastleViewport`, with input events handled in `TViewMain`.

- Using `TCastleComponentFactory` to create rockets and rocks. Each of them is defined by a [reusable design](https://castle-engine.io/reuse_design).

- Using [behaviors](https://castle-engine.io/behaviors) to define various behaviors of rocks and rockets.

- Using [physics](https://castle-engine.io/physics) to handle collisions between rockets and rocks.

- Special component [TTilingBackground](https://github.com/castle-engine/castle-engine/blob/master/examples/space_shooter/code/gametilingbackground.pas) to draw a background that (seems to) repeat to infinity. This is a reworked version of an old example `background_tiling`.
