Talking about Game development, HTML5, Javascript, Monetize and Phaser.
Ever wanted to build a portfolio of mobile and desktop HTML5 games? Of course you do, since mot of my blog readers. I am showing you a course which will guide you through the creation of HTML5 games with the awesome Phaser framework, which are completely cross-platform, and can run both on desktop computers and mobile phones from day one. In addition to building the games, you’ll also learn how to build your games as native applications using PhoneGap Build, to publish them on Apple App Store or Google Play. I am talking about HTML5 Game Development Mini-Degree published by Zenva, the e-learning company which taught game development to over 250,000 students from all over the world.
// this is called up to 60 times per second
gameScene.update = function(){
// don't execute if we are terminating
if(this.isTerminating) return;
// check for active input (left click / touch)
if(this.input.activePointer.isDown) {
// player walks
this.player.x += this.playerSpeed;
}
// treasure overlap check
let playerRect = this.player.getBounds();
let treasureRect = this.goal.getBounds();
if(Phaser.Geom.Intersects.RectangleToRectangle(playerRect, treasureRect)) {
console.log('reached goal!');
// end game
return this.gameOver();
}
// get enemies
let enemies = this.enemies.getChildren();
let numEnemies = enemies.length;
for(let i = 0; i< numEnemies; i++) {
// enemy movement
enemies[i].y += enemies[i].speed;
// check we haven't passed min or max Y
let conditionUp = enemies[i].speed < 0 && enemies[i].y <= this.enemyMinY;
let conditionDown = enemies[i].speed > 0 && enemies[i].y >= this.enemyMaxY;
// if we passed the upper or lower limit, reverse
if(conditionUp || conditionDown) {
enemies[i].speed *= -1;
}
// check enemy overlap
let enemyRect = enemies[i].getBounds();
if(Phaser.Geom.Intersects.RectangleToRectangle(playerRect, enemyRect)) {
console.log('Game over!');
// end game
return this.gameOver();
}
}
};

Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.