36 lines
907 B
ActionScript 3
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));
|
|
}
|
|
}
|