package;
import gecko.components.draw.DrawComponent;
import gecko.components.draw.SpriteComponent;
import gecko.Screen;
import gecko.Gecko;
import gecko.systems.draw.DrawSystem;
import gecko.Assets;
class Game {
public function new(){
Gecko.currentScene.addSystem(DrawSystem.create());
Assets.load([
"car_green_small_1.png"
], _onAssetsLoaded).start();
}
private function _onAssetsLoaded() {
var container = Gecko.currentScene.createEntity();
container.transform.size.set(200, 350);
container.transform.position.set(Screen.centerX, Screen.centerY);
container.addComponent(DrawComponent.create());
for(x in 0...5){
for(y in 0...5){
var car = Gecko.currentScene.createEntity();
car.transform.parent = container.transform;
car.transform.localPosition.set(x * 40, y * 70);
car.transform.anchor.set(0,0);
car.addComponent(SpriteComponent.create("car_green_small_1.png"));
}
}
Gecko.onUpdate += function(delta:Float) {
container.transform.rotation += 1 * delta;
};
}
}
Source Code