aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.html4
-rw-r--r--res/bg.mp3bin1667051 -> 5307608 bytes
-rw-r--r--res/bg.pngbin9692 -> 9336 bytes
-rw-r--r--res/int.pngbin6446 -> 106332 bytes
-rw-r--r--res/logo1.pngbin5785 -> 6843 bytes
-rw-r--r--res/logo2.pngbin5254 -> 5245 bytes
-rw-r--r--res/player.pngbin3542 -> 0 bytes
-rw-r--r--res/players/player1.pngbin0 -> 9772 bytes
-rw-r--r--res/players/player10.pngbin0 -> 10590 bytes
-rw-r--r--res/players/player11.pngbin0 -> 10426 bytes
-rw-r--r--res/players/player2.pngbin0 -> 10009 bytes
-rw-r--r--res/players/player3.pngbin0 -> 11298 bytes
-rw-r--r--res/players/player4.pngbin0 -> 9158 bytes
-rw-r--r--res/players/player5.pngbin0 -> 9723 bytes
-rw-r--r--res/players/player6.pngbin0 -> 8424 bytes
-rw-r--r--res/players/player7.pngbin0 -> 11034 bytes
-rw-r--r--res/players/player8.pngbin0 -> 8908 bytes
-rw-r--r--res/players/player9.pngbin0 -> 7346 bytes
-rw-r--r--src/engine.js18
-rw-r--r--src/gameobject.js10
-rw-r--r--src/objecttypes.js14
-rw-r--r--src/player.js7
-rw-r--r--src/settings.js3
23 files changed, 41 insertions, 15 deletions
diff --git a/index.html b/index.html
index 77b3837..c72896f 100644
--- a/index.html
+++ b/index.html
@@ -2,7 +2,7 @@
<html>
<head>
<meta charset="UTF-8">
- <title>viivaintegraalipeli</title>
+ <title>Jouluinen hallituspeli</title>
<style>
body {
position: fixed;
@@ -30,4 +30,4 @@
<script type="text/javascript" src="src/platformer.js"></script>
<center>Huom! 16.11. asianomistajan pyynnöstä grafiikkaa parannettu.<center>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/res/bg.mp3 b/res/bg.mp3
index 9a5d616..30255b5 100644
--- a/res/bg.mp3
+++ b/res/bg.mp3
Binary files differ
diff --git a/res/bg.png b/res/bg.png
index 1363e77..9c83347 100644
--- a/res/bg.png
+++ b/res/bg.png
Binary files differ
diff --git a/res/int.png b/res/int.png
index 6eddea2..476723a 100644
--- a/res/int.png
+++ b/res/int.png
Binary files differ
diff --git a/res/logo1.png b/res/logo1.png
index 1630ac7..230db08 100644
--- a/res/logo1.png
+++ b/res/logo1.png
Binary files differ
diff --git a/res/logo2.png b/res/logo2.png
index 2e8b7b9..75ace39 100644
--- a/res/logo2.png
+++ b/res/logo2.png
Binary files differ
diff --git a/res/player.png b/res/player.png
deleted file mode 100644
index dd53460..0000000
--- a/res/player.png
+++ /dev/null
Binary files differ
diff --git a/res/players/player1.png b/res/players/player1.png
new file mode 100644
index 0000000..f49a795
--- /dev/null
+++ b/res/players/player1.png
Binary files differ
diff --git a/res/players/player10.png b/res/players/player10.png
new file mode 100644
index 0000000..37b462b
--- /dev/null
+++ b/res/players/player10.png
Binary files differ
diff --git a/res/players/player11.png b/res/players/player11.png
new file mode 100644
index 0000000..5a59c72
--- /dev/null
+++ b/res/players/player11.png
Binary files differ
diff --git a/res/players/player2.png b/res/players/player2.png
new file mode 100644
index 0000000..62498a7
--- /dev/null
+++ b/res/players/player2.png
Binary files differ
diff --git a/res/players/player3.png b/res/players/player3.png
new file mode 100644
index 0000000..6c3d0cf
--- /dev/null
+++ b/res/players/player3.png
Binary files differ
diff --git a/res/players/player4.png b/res/players/player4.png
new file mode 100644
index 0000000..b3e1dd9
--- /dev/null
+++ b/res/players/player4.png
Binary files differ
diff --git a/res/players/player5.png b/res/players/player5.png
new file mode 100644
index 0000000..90ca0c0
--- /dev/null
+++ b/res/players/player5.png
Binary files differ
diff --git a/res/players/player6.png b/res/players/player6.png
new file mode 100644
index 0000000..875cdc7
--- /dev/null
+++ b/res/players/player6.png
Binary files differ
diff --git a/res/players/player7.png b/res/players/player7.png
new file mode 100644
index 0000000..b4a5451
--- /dev/null
+++ b/res/players/player7.png
Binary files differ
diff --git a/res/players/player8.png b/res/players/player8.png
new file mode 100644
index 0000000..9f2f8ca
--- /dev/null
+++ b/res/players/player8.png
Binary files differ
diff --git a/res/players/player9.png b/res/players/player9.png
new file mode 100644
index 0000000..5f2a8b9
--- /dev/null
+++ b/res/players/player9.png
Binary files differ
diff --git a/src/engine.js b/src/engine.js
index 30d7d7a..b75886a 100644
--- a/src/engine.js
+++ b/src/engine.js
@@ -56,8 +56,19 @@ Engine.prototype.makeStageClickable = function() {
this.clickLayer.touchstart = this.clickLayer.mousedown = this.buttonPressed.bind(this);
}
+Engine.prototype.randomizePlayer = function() {
+ this.removeSprite(player.sprite);
+ var number = Math.floor((Math.random() * Settings.PLAYER_COUNT) + 1);
+ var newTexture = PIXI.Texture.fromImage("res/players/player" + number + ".png");
+ player.sprite = new PIXI.Sprite(newTexture);
+ this.unitsContainer.addChild(player.sprite);
+}
+
Engine.prototype.activateMenu = function() {
this.state = MENU;
+
+ this.randomizePlayer();
+
player.score = 0
console.log("changed to menu!");
logo1.sprite.visible = true;
@@ -97,6 +108,10 @@ Engine.prototype.activateGameOver = function() {
this.sound.play("explosion")
}
+Engine.prototype.removeSprite = function(sprite) {
+ this.unitsContainer.removeChild(sprite);
+}
+
Engine.prototype.removeIntegral = function(integral) {
var i = this.gameObjectList.indexOf(integral);
this.gameObjectList.splice(i, 1);
@@ -198,6 +213,7 @@ Engine.prototype.setupGameObjects = function() {
// add player to gameobjectlist
this.gameObjectList = [];
+
this.unitsContainer.addChild(player.sprite);
this.menuContainer.addChild(logo1.sprite);
this.menuContainer.addChild(logo2.sprite);
@@ -214,4 +230,4 @@ Engine.prototype.setupGameObjects = function() {
this.stage.updateLayersOrder();
}
-var engine = new Engine(); \ No newline at end of file
+var engine = new Engine();
diff --git a/src/gameobject.js b/src/gameobject.js
index 0b50553..43218b1 100644
--- a/src/gameobject.js
+++ b/src/gameobject.js
@@ -1,12 +1,16 @@
function GameObject(texture) {
- this.texture = PIXI.Texture.fromImage("res/" + texture + ".png");
- this.sprite = new PIXI.Sprite(this.texture);
+ this.updateTexture(texture);
this.initPosition();
this.active = true;
this.objectType = "gameobject";
}
+GameObject.prototype.updateTexture = function(name) {
+ this.texture = PIXI.Texture.fromImage("res/" + name + ".png");
+ this.sprite = new PIXI.Sprite(this.texture);
+}
+
GameObject.prototype.initPosition = function() {
this.sprite.anchor.x = 0.5;
this.sprite.anchor.y = 0.5;
@@ -17,4 +21,4 @@ GameObject.prototype.initPosition = function() {
GameObject.prototype.update = function() {
-} \ No newline at end of file
+}
diff --git a/src/objecttypes.js b/src/objecttypes.js
index d7b0df4..e9f69f0 100644
--- a/src/objecttypes.js
+++ b/src/objecttypes.js
@@ -53,15 +53,15 @@ scoreBg.beginFill(0xAAAAAA, 1.0);
scoreBg.visible = false;
// score display
-var scoreText = new PIXI.Text("W", { font: '35px Arial', fill: 'black', align: 'left' });
+var scoreText = new PIXI.Text("W", { font: '35px Arial', fill: 'white', align: 'left' });
scoreText.visible = false;
scoreText.update = function() {
- this.text = "W = " + player.score + " J";
+ this.text = "Tomia vältelty " + player.score + " tuntia";
}
scoreText.moveToCorner = function() {
- this.position.x = Settings.STAGE_WIDTH * 0.7;
- this.position.y = Settings.STAGE_HEIGHT * 0.1;
+ this.position.x = Settings.STAGE_WIDTH * 0.5;
+ this.position.y = Settings.STAGE_HEIGHT * 0.05;
}
scoreText.moveToCenter = function() {
@@ -71,14 +71,14 @@ scoreText.moveToCenter = function() {
scoreText.moveToCorner();
// gameover screen title text
-var gameOverText = new PIXI.Text("Nettovoiman tekemä työ:", { font: '35px Arial', fill: 'black', align: 'center' });
+var gameOverText = new PIXI.Text("Onneksi olkoon!", { font: '35px Arial', fill: 'black', align: 'center' });
gameOverText.visible = false;
gameOverText.position.x = Settings.STAGE_WIDTH * 0.5 - gameOverText.width / 2;;
gameOverText.position.y = Settings.STAGE_HEIGHT * 0.4 - gameOverText.height / 2;;
// move the gameover bg box now that we now the width of the text
var yDiff = scoreText.position.y - gameOverText.position.y + gameOverText.height;
-scoreBg.drawRect(gameOverText.position.x - 10, gameOverText.position.y - 10, gameOverText.width + 20, -yDiff);
+scoreBg.drawRect(Settings.STAGE_WIDTH * 0.2, gameOverText.position.y - 10, Settings.STAGE_WIDTH * 0.6, -yDiff);
// integral sign
function Integral(y) {
@@ -104,4 +104,4 @@ Integral.prototype.initPosition = function() {
Integral.prototype.update = function() {
this.sprite.position.x += this.speed;
-} \ No newline at end of file
+}
diff --git a/src/player.js b/src/player.js
index 64f00f8..e3a43b4 100644
--- a/src/player.js
+++ b/src/player.js
@@ -64,4 +64,9 @@ Player.prototype.update = function() {
}
}
-var player = new Player("player"); \ No newline at end of file
+Player.prototype.updateSprite = function(sprite) {
+ this.sprite = sprite;
+}
+
+var number = Math.floor((Math.random() * Settings.PLAYER_COUNT) + 1);
+var player = new Player("players/player" + number);
diff --git a/src/settings.js b/src/settings.js
index b515171..e0c8609 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -2,6 +2,7 @@ var Settings = function() {}
Settings.STAGE_WIDTH = 800;
Settings.STAGE_HEIGHT = 600;
Settings.STAGE_BGCOLOR = 0xA0A0A0;
+Settings.PLAYER_COUNT = 11;
var lastTime = Date.now();
var dt = 0.0;
@@ -12,4 +13,4 @@ function updateDeltaTime() {
lastTime = current;
dt = current - last;
-} \ No newline at end of file
+}