Skip to content

Commit

Permalink
Changed the statics layout and bug position-y motion
Browse files Browse the repository at this point in the history
  • Loading branch information
ReiHuang committed Feb 11, 2016
1 parent 5dc1a68 commit 20795df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ button.End {
button.left {}

#Statics {
width: 80vmin;
width: 100vmin;
margin: 0 auto;
display: none;
font-weight: bold;
Expand Down Expand Up @@ -98,6 +98,7 @@ label {
}

#countdown {
width: 30vw;
font-family: sans-serif;
color: #000;
display: inline-block;
Expand Down
16 changes: 8 additions & 8 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ Enemy.prototype.update = function(dt) {
// which will ensure the game runs at the same speed for
// all computers.
this.x += (this.speed * dt);
if (this.x > 550) {
if (this.x > 505) {
this.x = this.col;
this.y += this.row;
this.speed = Math.floor(100 + (Math.random() * 200));
if (this.y > 226) {
this.y = 60;
if (this.y > 202) {
this.y = 83;
}
}

if (player.y >= this.y - 45 && player.y <= this.y + 45) {
if (player.x >= this.x - 45 && player.x <= this.x + 45) {
if (player.y >= this.y - 30 && player.y <= this.y + 30) {
if (player.x >= this.x - 42 && player.x <= this.x + 42) {
switch (roleIndex) {
case 0:
RyanYell.play();
Expand Down Expand Up @@ -146,9 +146,9 @@ Enemy.prototype.render = function() {

Enemy.prototype.Basic = function() {
this.col = -1;
this.row = getRandomInit(2, 3);
this.row = getRandomInit(1, 3);
this.x = 101 * this.col;
this.y = 83 * this.row;
this.y = 73 * this.row;

};
Enemy.prototype.RandomSpeed = function() {
Expand Down Expand Up @@ -486,7 +486,7 @@ document.addEventListener('keyup', function(e) {


var allEnemies = [];
for (var i = 1; i < 4; i++) {
for (var i = 1; i < 3; i++) {
allEnemies.push(new Enemy());
};

Expand Down

0 comments on commit 20795df

Please sign in to comment.