Skip to content

Instantly share code, notes, and snippets.

@ananace
Created July 2, 2026 12:33
Show Gist options
  • Select an option

  • Save ananace/3ec613385aa786ef822f6e7be3028bbc to your computer and use it in GitHub Desktop.

Select an option

Save ananace/3ec613385aa786ef822f6e7be3028bbc to your computer and use it in GitHub Desktop.
ESA 2026 - Colobot
extern void object::ESA()
{
int angle = 26;
float scale = 0.6;
for (int i = 0; i < 4; ++i)
{
DrawE(angle, scale, KeyB);
angle -= 26;
DrawS(angle, scale, KeyC);
angle -= 26;
DrawA(angle, scale, KeyA);
angle -= 26;
angle -= 12;
}
DrawRing(5 - scale * 1, 50, KeyD);
DrawRing(5 + scale * 5, 100, KeyD);
}
void object::DrawRing(float radius, int points, int category)
{
float slice = 360.0 / points;
for (int i = 0; i < points; ++i)
{
point dir = new point(cos(slice * i), sin(slice * i), 0);
dir.x *= radius;
dir.y *= radius;
produce(dir, 0, category);
}
}
void object::DrawE(float angle, float scale, int category)
{
point dir = new point(cos(this.orientation + angle), sin(this.orientation + angle), 0);
point dirRight = new point(cos(this.orientation + angle - 90), sin(this.orientation + angle - 90), 0);
for (int i = 0; i <= 3; ++i)
{
point pos = this.position;
pos.x += dir.x * 5;
pos.y += dir.y * 5;
int it = 0;
// Draw an E
/*
* +---
* |
* |--
* |
* +---
*/
// Left line
if (i == 0)
{
pos.x -= dirRight.x * scale;
pos.y -= dirRight.y * scale;
DrawLine(pos, dir, scale, 5, category);
}
// Top line
else if (i == 1)
{
pos.x += dir.x * 4 * scale;
pos.y += dir.y * 4 * scale;
DrawLine(pos, dirRight, scale, 2, category);
}
// Mid line
else if (i == 2)
{
pos.x += dir.x * 2 * scale;
pos.y += dir.y * 2 * scale;
DrawLine(pos, dirRight, scale, 1, category);
}
// Bottom line
else if (i == 3)
{
DrawLine(pos, dirRight, scale, 2, category);
}
}
}
void object::DrawS(float angle, float scale, int category)
{
point dir = new point(cos(this.orientation + angle), sin(this.orientation + angle), 0);
point dirRight = new point(cos(this.orientation + angle - 90), sin(this.orientation + angle - 90), 0);
point dirLeft = new point(cos(this.orientation + angle + 90), sin(this.orientation + angle + 90), 0);
for (int i = 0; i <= 4; ++i)
{
point pos = this.position;
pos.x += dir.x * 5;
pos.y += dir.y * 5;
int it = 0;
// Draw an S
/*
* +--
* |
* +-+
* |
* --+
*/
// Bottom line
if (i == 0)
{
pos.x -= dirRight.x * scale;
pos.y -= dirRight.y * scale;
DrawLine(pos, dirRight, scale, 3, category);
}
// Mid line
else if (i == 1)
{
pos.x += dir.x * scale * 2 - dirRight.x * scale;
pos.y += dir.y * scale * 2 - dirRight.y * scale;
DrawLine(pos, dirRight, scale, 3, category);
}
// Top line
else if (i == 2)
{
pos.x += dir.x * scale * 4 - dirRight.x * scale;
pos.y += dir.y * scale * 4 - dirRight.y * scale;
DrawLine(pos, dirRight, scale, 3, category);
}
// Left line
else if (i == 3)
{
pos.x += dir.x * scale * 3 - dirRight.x * scale;
pos.y += dir.y * scale * 3 - dirRight.y * scale;
DrawLine(pos, dir, scale, 1, category);
}
// Right line
else if (i == 4)
{
pos.x += dir.x * scale * 1 + dirRight.x * scale;
pos.y += dir.y * scale * 1 + dirRight.y * scale;
DrawLine(pos, dir, scale, 1, category);
}
}
}
void object::DrawA(float angle, float scale, int category)
{
point dir = new point(cos(this.orientation + angle), sin(this.orientation + angle), 0);
point dirRight = new point(cos(this.orientation + angle - 90), sin(this.orientation + angle - 90), 0);
for (int i = 0; i <= 4; ++i)
{
point pos = this.position;
pos.x += dir.x * 5;
pos.y += dir.y * 5;
int it = 0;
// Draw an A
/*
* +-+
* | |
* +-+
* | |
* | |
*/
// Left line
if (i == 0)
{
pos.x -= dirRight.x * scale;
pos.y -= dirRight.y * scale;
DrawLine(pos, dir, scale, 5, category);
}
// Right line
else if (i == 1)
{
pos.x += dirRight.x * scale;
pos.y += dirRight.y * scale;
DrawLine(pos, dir, scale, 5, category);
}
// Mid line
else if (i == 2)
{
pos.x += dir.x * scale * 2;
pos.y += dir.y * scale * 2;
DrawLine(pos, dir, scale, 1, category);
}
// Top line
else if (i == 3)
{
pos.x += dir.x * scale * 4;
pos.y += dir.y * scale * 4;
DrawLine(pos, dir, scale, 1, category);
}
}
}
void object::DrawLine(point start, point dir, float scale, int length, int type)
{
point at = start;
for (int i = 0; i < length; ++i)
{
produce(at, 0, type);
at.x += dir.x * scale;
at.y += dir.y * scale;
}
}
extern void object::GoFast()
{
point pos;
object item = radar(SpaceShip);
// For non-NG+, mission 1-2, before you're given the spaceship
if (item == null) {
produce(this.position, 0, ResearchCenter);
produce(this.position, 0, BotFactory);
return;
}
// Produce all main mission objectives at the spaceship
produce(item.position, 0, BlackBox);
produce(item.position, 0, TrackedBuilder);
produce(item.position, 0, WheeledGrabber);
produce(item.position, 0, WingedGrabber);
produce(item.position, 0, UraniumOre);
produce(item.position, 0, TNT);
produce(item.position, 0, LeggedGrabber);
produce(item.position, 0, WingedOrgaShooter);
produce(item.position, 0, LeggedOrgaShooter);
produce(item.position, 0, Thumper);
produce(item.position, 0, Shielder);
produce(item.position, 0, Subber);
produce(item.position, 0, KeyA);
produce(item.position, 0, KeyB);
produce(item.position, 0, KeyC);
produce(item.position, 0, Me);
repeat(4) {
produce(item.position, 0, TitaniumOre);
}
produce(mkPoint(1.5, 99), 0, RadarStation);
produce(mkPoint(-52.5, 147), 0, RadarStation);
// Delete all main targets
deleteAll(Target2);
deleteAll(AlienAnt);
deleteAll(AlienWasp);
deleteAll(TargetBot);
deleteAll(AlienWorm);
deleteAll(AlienSpider);
deleteAll(609);
deleteAll(AlienQueen);
// Kill the first self - leaving the one at the spaceship
item = radar(Me);
delete(item.id, 0);
// Launch the ship
takeoff();
}
// Create a new point with the given X/Y coords
point object::mkPoint(float x, float y)
{
point pos;
pos.x = x;
pos.y = y;
return pos;
}
// Delete all objects of a given category
void object::deleteAll(int category)
{
object item;
while (true)
{
item = iterObjects(category);
if (item == null) break;
delete(item.id, 0);
}
}
// Find the first object of given category in the scene
object object::iterObjects(int category)
{
// Run at maximum speed
ipf(10000);
int i = 0;
object item;
while (true)
{
item = retobject(i++);
if (item == null) break;
if (item.category == category) return item;
}
return null;
}
@ananace

ananace commented Jul 5, 2026

Copy link
Copy Markdown
Author

Replacement data/textures/objects/human.png:
human

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment