Sort of started working on Title Screen.

This commit is contained in:
Robbie Antenesse 2016-04-14 17:48:18 -06:00
parent 736c955f1c
commit eecc18e330
1 changed files with 7 additions and 21 deletions

View File

@ -3,29 +3,15 @@ function titleScreen () {
OS.SetRoom(rm_TitleScreen); OS.SetRoom(rm_TitleScreen);
} }
rm_TitleScreen.DoFirst = function () {
//Hide cursor when playing (only use if masking the cursor with another object)
//OS.canvas.style.cursor = "none";
// Create objects on room start. This is best practice unless you need persistent objects.
Game.player = this.AddObject(OS.P["UFO"]);
Game.ball = this.AddObject(OS.P["Ball"]);
Game.cowboys = Math.floor(RandomRange(5, 50));
for (var i = 0; i < Game.cowboys; i++) {
this.AddObject(OS.P["Cowboy"]);
}
}
rm_TitleScreen.Do = function () { rm_TitleScreen.Do = function () {
if (Game.cowboys <= 0) { // Menu options.
OS.SetRoom(rm_TitleScreen);
}
} }
rm_TitleScreen.DrawAbove = function () { rm_TitleScreen.DrawBelow = function () {
// Draw the number of cowboys remaining // Fill background color because I can't figure out how to make OversimplifiedJS change the bg color on room change!
if (Game.ball !== null) { var tmp = Oversimplified.context.fillStyle;
OS.context.font = "18px Impact"; Oversimplified.context.fillStyle = "#D9BEA5";
OS.context.fillText(Game.cowboys, 15, 30); Oversimplified.context.fillRect(0, 0, Oversimplified.camera.width, Oversimplified.camera.height);
} Oversimplified.context.fillStyle = tmp;
} }
rm_TitleScreen.DoLast = function () { rm_TitleScreen.DoLast = function () {
// Clear Objects on room exit. This is best practice unless you need persistent objects. // Clear Objects on room exit. This is best practice unless you need persistent objects.