THIS IS A TEMPLATE, NOT A GAME!!!! Overview: This template was designed for the purpose of simplifying the making of games that utilize clones for fighting. In a nutshell, the reds go to the closest blues, and vice versa. To move around the map, use WASD. Press space to start, and click to place enemies.
I am proud to say that all code was made entirely by me! Read on for explanation of how the move () steps CUSTOM BLOCK works. The formula that Scratch uses to calculate steps can be replicated with Scratch blocks by doing the following two equations, which can also be edited to change variables as if they were the X and Y positions of a sprite: Set X to: (X+(sin of (direction) * A)) Set Y to: (Y+(cos of (direction) * A)) I these equations, A represents the amount of steps taken. To use this in my project, I substituted the X and Y for x and y, which are variables containing the positions of sprites on the map instead of the shown screen. We need this because if another clone is trying to track this clone's position and therefor move towards it, without this custom block, it would try to move towards the tracked clone's position on the the screen instead of the entire map. This is because Scratch sprites cannot go offscreen, and in this project, instead of them going offscreen, they simply hide when they touch the edge, giving the illusion of offscreen activity.