package org.drools.games.invaders6;

import org.drools.games.Run

import org.drools.games.invaders.Ship
import org.drools.games.invaders.Invader1

import org.drools.games.invaders.InvadersConfiguration
import org.drools.games.invaders.Invader1

global InvadersConfiguration conf

dialect "mvel"

rule InitShip agenda-group "Init" when
    Run()
then
    ship = new Ship();
    ship.width = conf.shipWidth;
    ship.height = conf.shipHeight;
    ship.speed = conf.shipSpeed;
    ship.x = (conf.windowWidth/2) - (conf.shipWidth/2);
    ship.y = conf.windowHeight-10 - conf.shipHeight;
    insert( ship );
end

rule InitInvader agenda-group "Init" when
    i : Integer() from [1, 2, 3, 4, 5, 6]
    Run()
then
    invader = new Invader1();
    invader.width = conf.invader1Width;
    invader.height = conf.invader1Height;
    invader.speed = conf.invader1Speed;
    invader.x = 90 * i;
    invader.y = 40 + conf.invader1Height;
    insert( invader );

end