Files
simian/scripts/update.as
T
nick 4f6efceb98
CI / build-and-test (push) Successful in 2m5s
feat: re-init on hot reload.
2025-11-21 10:11:53 +13:00

36 lines
907 B
ActionScript 3

float x = 50;
float y = 100;
float r = 40.0f;
float theta = 0.0f;
float ix = 0.0f;
float iy = 0.0f;
Texture::Image img;
Texture::Texture2D tex;
void Init() {
Log(LOG_TRACE, "Initialization complete!");
Toast::Success("Script initialized successfully!");
img = Texture::LoadImage("assets/raylib_96x96.png");
Toast::Info("Image loaded successfully.");
tex = Texture::LoadTexture("assets/raylib_96x96.png");
Toast::Info("Texture loaded successfully.");
}
void Shutdown() {
Texture::Unload(img);
Texture::Unload(tex);
Log(LOG_TRACE, "Shutdown complete!");
}
void Update(float dt) {
x += 64 * dt;
theta += 2.0f * dt;
ix = 100+ r * Math::Cos(theta);
iy = 100+r * Math::Sin(theta);
if (x > 800) {
Log(LOG_TRACE, format("Reset happened at position {}", x));
x = 0;
Toast::Info(format("X position has been reset to {}", x));
}
}