TMC World Wrap Startup Project With Defender Loop Demo
Type: Template/Starter Project
Included: Scripts, Example Sprites, Example Objects and Demo Room
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
3. Score and in between Level Bonus
4. Player control
5. Tried a true bullet and missile system with ahead targeting.