Install Asset
Install via Godot
To maintain one source of truth, Godot Asset Library is just a mirror of the old asset library so you can download directly on Godot via the integrated asset library browser
Quick Information

This asset shows one way to build with Godot a 2D space shooter side-scrolling game with a wraparound world, like the one in the classic Defender arcade game.More details here: https://github.com/JSolde/Godot-demo-2D-Side-Scrolling-and-Wraparound-Shooter
Demo of a side-scrolling shooter game à la 'Defender' with Godot
This asset shows one way to build with Godot a 2D space shooter side-scrolling game with a wraparound world, like the one in the classic Defender arcade game.
Actually, my original intention was to make a faithful recreation of the mythic Williams Electronics Defender game (launched in 1980) adapted for modern PC platforms to be able to play it on PC while keeping the same game experience as the arcade without the hassle to deal with ROMs and emulators. I requested the legal permissions to do so to Warner Bros. Games, that are the current owners of the intellectual property of the game, but unfortunately they rejected to provide me any license to publish a game based on Defender's IP, not even for non-commercial use. I found other people that have made a Defender clone changing the visuals to avoid the licensing issues I guess. Check out for instance the 'Refender' game using the AGK app studio kit (https://forum.thegamecreators.com/thread/212460).
As my Defender clone for PC project was already quite advanced and I did not want to throw away the work I did, I thought it could be useful to share a sample game using the 'self wraparound' mechanics I developed with Godot. This was in fact one of the main challenges of the game as I realized that Godot does not provide this capability out of the box: https://godotforums.org/d/18108-how-to-create-a-self-wrapping-2d-world-defender
The type of self wraparound world I made does not take into account any physics, so it does not work with move_and_slide(), move_and_collide(), etc... All the objects like enemies, bullets, etc... are extensions of Area2D node.
I took the initial idea about how to implement it from Andrew Wilkes' "Godotia" game (https://github.com/andrew-wilkes/godotia), that consists basically on scrolling the background as the player moves by updating scroll_offset.x of the parallax node according to the player's speed. To make the seamless wraparound of the world I engineered a dirty trick to constrain the positions of the objects of the game (player, enemies, bullets,...) within the length of the terrain and changing the position coordinates when needed.
Note: I found a project of a Defender clone with Godot that is using a different technique : https://github.com/Toxe/godot-defender-clone, and probably there will be others.
I'm new to Godot and I'm using this project to learn, so please any suggestion for improvement will be much appreciated.
Structure of the demo game:
Scenes:
main.tscn : main scene, populates player, enemies and handles the toggle key 'L' (to show labels with position values and lines from enemies to player for education purposes)
- Node2D (Main)
- Parallax2D
- Node2D (Sky)
- Parallax2D
- Node2D (Terrain)
- Sprite2D (earth)
- Sprite2D (space-station)
- Parallax2D
The earth and lunar space-station sprites are placed at a fixed coordinate of the terrain so you can check easily when the world wraps around.
- Node2D (Main)
terrain.tscn : Builds a terrain procedurally and it will be the parent scene for enemies and shots.
sky.tscn : It is used as a second Parallax background made only with one particles node.
player.tscn : Spawned by main scene, it handles all the inputs and movement of the parallax backgrounds.
player_shot.tscn : Player shot scene instantiated from player scene and added to terrain scene.
enemy.tscn : Enemy scene that will be populated as a terrain child from main scene. The enemy scene has a simple random motion defined in the _process() function based on several random parameters. Its gd script contains the function vector_to_player() to evaluate the direction and distance from each enemy to the player so they can direct their shots to it. Note that in a wraparound world there are always 2 distances between 2 objects, distance to the right and to the left. The code chooses always the shorter one.
map.tscn : Draws a map scanner on the top of the window to show the relative position of the enemies in the terrain like in the original Defender game.
enemy_shot.tscn : Enemy shot scene instantiated from enemy scene and added to terrain scene.
explosion.tscn : I included this scene as a bonus to show how to make explosions and 'materializations' (unexplosions) of the enemies like the ones of the Defender game. It is used when spawning and killing enemies and the player. It can be used as a component to be added to any scene.
pause.tscn : This node is just to make the game pause/unpause when pressing the 'P' key. It also handles the 'Esc' key.
Note: I have used Godot Parallax2D from Godot 4.3 but it can also be used with ParallaxBackground + ParallaxLayer nodes so it should be able to run in lower versions of Godot. The version for 4.2 included in this repo works this way but it works better with 4.3 as 4.2 has a small glitch that fails to show some sprites in the wraparound world boundary. I tested it also on Godot 4.4.1.
Autoload:
globals.gd: Contains the global variables and also the function scroll_correction(node) that makes the trick to reposition the nodes when needed as the background wraps around. It must be called in the _process() function of the nodes that run as child of the terrain scene.
Assets:
- enemy_ship.png
- enemy_map.png
- enemy_shots.png
- enemy_thrust.png
- moon_surface.png
- earth.png*
- player_missile.png
- player_shots.png
- player_map.pmg
- spaceship.png
- space_station.png**
- thrust.mp3
- shoot_sound.mp3
- enemy_spawn.mp3
- explosion.mp3
* Image credit: NASA / Apollo 17.
** Designed by Freepik (www.freepik.com)
Note: Assets obtained from different sources (freepik, pixabay, craftpix,...)
Demo game dynamics:
- The game starts with the player and 10 enemies.
- The player moves with the cursor keys and can shoot to the enemies with shift key.
- The enemies shoot to the player at random intervals.
- A new enemy is spawned every 10 seconds if there are less than 10 enemies in the world.
- If the player dies it will respawn automatically.
- The game never ends as it is just a sample demo to show how to build such a scrolling shooter game. Just press 'Esc' to finish.
- Key 'L' toggles the visualization of labels and lines for education purposes.
- Key 'P' toggles pause game.
- Key 'Esc' to quit the game.
Demo game sample:
https://github.com/user-attachments/assets/b56ed2e7-d070-41cb-99bd-6baa35405d72
The "real game":
As I mentioned in the beginning, I started working on a faithful clone of the Defender using this technique, but as I could not get the licensing from Warner Bros to use their IP I have not made it public. I'm sharing some visuals of the game as a testimony that the wraparound technique presented here allows to replicate the same behavior as the original arcade game. I may finally make my own 'Refender' 😉.
Views of my Defender clone
These are some pics of my game:
https://github.com/user-attachments/assets/3fc98872-afa5-45e6-9e6b-18f458edb56f
https://github.com/user-attachments/assets/69d1f166-df88-4c0e-bf31-54f1839574d8
Notes:
- At present it is only single player (the original arcade allows 2 players to play the same match in alternate turns).
- To get a thorough understanding of the original arcade game I found these really valuable documents that helped a lot to recreate the behavior of the enemies and the whole game experience.
- "Defender: The Last Word", by Doug Mahugh (https://www.dougmahugh.com/defender/).
- "The Video Master's Guide to Defender", by Nick Broomis (https://www.digitpress.com/library/books/book_vmg_defender.pdf).
This asset shows one way to build with Godot a 2D space shooter side-scrolling game with a wraparound world, like the one in the classic Defender arcade game.
More details here: https://github.com/JSolde/Godot-demo-2D-Side-Scrolling-and-Wraparound-Shooter
Reviews
Quick Information

This asset shows one way to build with Godot a 2D space shooter side-scrolling game with a wraparound world, like the one in the classic Defender arcade game.More details here: https://github.com/JSolde/Godot-demo-2D-Side-Scrolling-and-Wraparound-Shooter