Asset - Project TMC World Wrap Startup Project With Defender Loop Demo


TMC Founder
GMC Elder

TMC World Wrap Startup Project With Defender Loop Demo

Outputs: All

Type: Template/Starter Project

Included: Scripts, Example Sprites, Example Objects and Demo Room

Demo: https://onedrive.liv...45D1EA9168D!749

Marketplace: https://marketplace....rap-startup-kit


Version 2: Added Vertical and Horizontal Support

View Code For Vertical, And Both Horizontal and Vertical: http://gmc.yoyogames...46980&p=4802672

Read the Design Notes:http://gmc.yoyogames...46980&p=4803428


World Wrap Startup Kit Project with Defender Demo as example

Supports horizontal, vertical or both and cornered wrapping

The project was designed to help you understand and code for games that require seamless world wrapping from left to right; also know as Defender Loop screen. Though support is there for all side warping.

The problems with looping the screen seamlessly is two fold:

1. the instances that are at the room edge have to be **seen** from the other side of the room.
2. your AIs need to be **aware** of the world wrapping and decide to give chase to the player or other object by wrapping from one side of the room to the other as the target across the room may actually be closer than something on the same side of the room.

To resolve the *first problem*, the API includes a **drawing** function which you can clone the code from to make your own world wrap compatible draw. The AI also include a world wrap **move** function similar to GM's native function which is in charge of detecting is an instances are at the edge and moving them from room edge to room edge.

For the *second problem*, the **AI world wrap awareness** the API include a world wrap aware *instance_nearest()* and a *coordinate conversion* function so that you can convert any coordinates to a coordinate off screen to force the AIs to use the alternative coordinate (using standard GM functions) to aim for and move to the coordinate.

The API is minimalist in nature as it includes only the things that you will require. Anything more and you would be confounded.

The demo includes a Defender clone which shows a few things:

1. How to Draw
2. How to Wrap
3. How to Aim
4. How to Drive to the closest Wrapped Point


1. Procedurally Generated Terrain
2. Minimap
3. Score and in between Level Bonus
4. Player control
5. Tried a true bullet and missile system with ahead targeting.


Screen Shots:

Last edited:
Hi all,
Is this still being supported? Reason being I bought it recently as it does say in the description that it's compatible with GMS2 but I'm having problems implementing it. I'm working on an asteroids game that is constantly evolving and the main game room is several times larger than the viewport which follows the player but I'd like it to seamlessly wrap in whicheber direction the player is currently flying.
Any help at all would be very gratefully received.
Thanks in advance.


TMC Founder
GMC Elder
I can take a look at it. everything is working fine with the demo and gms2.2.3.344

Send me a pm and I can give you a hand