Skip to content

Instantly share code, notes, and snippets.

@snggeng
Last active June 7, 2017 12:02
Show Gist options
  • Save snggeng/444df39a9c78bee260dbe88e9c31f387 to your computer and use it in GitHub Desktop.
Save snggeng/444df39a9c78bee260dbe88e9c31f387 to your computer and use it in GitHub Desktop.
Spawn enemy in game.js
// Setup event listeners
function setupEvents() {
// Add event listeners for different types of events in the game
// code omitted for brevity
}
// Spawn enemy
function spawnEnemy(){
var enemy = new Enemy();
assets.push(enemy)
}
// Startup the game
function init(){
setupEvents();
spawnEnemy();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment