Let's see how the first version of gameplay can look like. There isn't any facilitis for player to control robots for now, but in the final product there will be a few:
- code template;
- code prompt;
- user's code libraries
- another window with 10 buttons:
- each button can executes user script,
- each button has a shortcut key defined by user,
- user can change a position of each button,
- user can paint an icon of each button.
For now each script has to be writen and then executed, but with facilitis above player will be able to control the robot using keyboard, of course if he defined well scripts and shortcut keys for these 10 buttons, I'm writing above.
It has to be said, that robots in gameplay video below has only AI implemented when them are patroling, but they "don't know" what they should do in other situation.
You can also listen the music from original soundtrack for Apparatus in this video.
I implemented these commands so far:
robot.walk(3); //robot walk 3 step foward
robot.turnback(); //robot turns back
robot.turnLeft();
robot.turnRight(); //it's obvies
robot.aim(45); //robot aims 45 degrees up
robot.aim(-30); //robot aims 30 degrees down
robot.aim(); //robot aims exacly foward (0 degrees)
robot.shoot(); //robot shoots once
robot.shoot(4); //robot shoots four times
robot.unaim(); //robot stops aiming
robot.jump(); //robot jumps
robot.wait(1000); //robot waits 1 sec.= 1000 ms
robot.getX();
robot.getY(); //returns robot position coordinates
robot.getDirection(); //returns 1 if robot looks right and -1 if robot looks left
robot.getName(); //returns robot unit name
robot.walkIf("robot.getX() < 500"); //robot walks foward unless its X-position is bigger or equal 500
Standard construction:
- if-construction:
if (condition1) {
//code executed if condition1...
} else if (condition2) {
//code executed if condition2 and not condition1...
} else if (condition3) {
//code executed if condition3 and not condition1 and not condition2...
} else {
//code executed if none of conditions is true...
}
- while-construction:
while (condition) {
//code executed repeatly unless condition is false...
}
Example with while-construction:
robot.turnRight();
while(robot.getX() < 1000) {
robot.walk(2);
}
- for-consturction
//Example with for-construction:
for (var i=1; i < 10; i = i+2) {
robot.walk(i);
robot.turnback();
}
Xxample above means that robot will walk i-steps and turns back, so it starts 1-step, turns back, 3-step (becouse 1+2=3), turns back, ..., 9-steps and turns back.
Fallow us on FB as well.