Skip to content

Instantly share code, notes, and snippets.

@edmundito
Created August 17, 2019 23:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edmundito/ab5818ae57bd3c23a4b06b565c2b579b to your computer and use it in GitHub Desktop.
Save edmundito/ab5818ae57bd3c23a4b06b565c2b579b to your computer and use it in GitHub Desktop.
Black Hole code for AGS
// http://frankforce.com/?p=6378
function u(float t) {
DrawingSurface* surface = Room.GetDrawingSurfaceForBackground();
for (int i = 0; i < 2000; i++) {
surface.DrawingColor = Game.GetColorFromRGB( 99*i, 2*i, i )
float fi = IntToFloat(i);
int x;
int y;
float F;
int K;
if (i > 0) {
F = 260.0*(t+9.0)/fi + Maths.Sin(fi*fi);
x = FloatToInt(960.0 + fi*Maths.Sin(F));
y = FloatToInt(500.0 + 0.2 * (2.0*fi*Maths.Cos(F) + 20000.0/fi));
K = FloatToInt(Maths.Sin(fi) * 9.0)
}
else {
x = 0;
y = 0;
K = 20000;
}
surface.DrawRectangle(x, y, K, K);
}
surface.Release();
}
int loops = 0;
function repeatedly_execute_always() {
float t = IntToFloat(loops) / IntToFloat(GetGameSpeed());
u(t);
loops++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment