Level Idea: Find The Enemy's Position

This might be the hardest one to design and maybe not really possible, but here it goes:

Requirement:

  1. Remove Mouse:Hover showing coordinates of the map.
  2. Place Tower A and Ogre’s Campfire at the same X-axis.

Level: A great amount of supply is being transferred between two towers located at A and B respectively. An Ogre Campfire is hidden at C. There is a human soldier handling the shipment starting at A and going B and then back to A and back to B, infinitely.
A sneaky ninja Ogre starts at point B and moves to point C, firstly to define a stealing route and then back to B, steal the load and back to C, infinitely.
The human has no attacking ability and the towers can never see the sneaky ninja. The collision between the Ogre and the Human will happen everytime that:

(2n +1)*x - 2n*y < t
//x = AB segment
//y = BC segment
//t = Sprite Tolerance (Ogre's Range attack)

This means that the Ogre will attack the Human once everytime that the given formula above returns true, which impacts on the level having a time limit given by the ogre being able to kill the human after a certain amount of time.

Mission: Using the given Sine of the angle formed at ABC, the player will use the human’s position to find a specific position at BC. If the Ogre is located at the said position, both towers will slap him on the face, ending once for all this stealing madness.

Solution:

var sine = SINE_OF_ABC; // I can help calculate this value once the level has been made.

var towers = getNearestTowers();
// The tower to which the delivery is being made (destination)
var towerB = towers[1];

// Get human position
var team = getNearestTeam();
var deliveryGuy = team[0];

var x = deliveryGuy.position.x;
var y = deliveryGuy.position.y;

// Pythagoras Theorem's application in a Cartesian Plane
var distance = math.sqrt(pow(towerB.position.x - x, 2), pow(towerB.position.y - y, 2));

// Find the triangle's relative height.
var height = sine*x;

// Find a possible target location
var targetX = x;
var targetY = y-height;

// Check if ogre is at given point.
if(isTarget(targetX, targetY))
   this.attack(targetX, targetY);

The idea has been designed so it can be applied dynamically. The level designer can pick whatever point he/she prefers to place the towers and the Ogre’s Capfire, as long as (respecting requirement 2), it forms a rectangle triangle.

1 Like