Skip to content

Create your AI with a simple RTS game(Game of Thrones inspired). Ideal for practice your basic programing skill.

Notifications You must be signed in to change notification settings

Menda0/game-of-codes

Repository files navigation

Description

The objective of this game is to train your basic programing skill creating a AI for this RTS game(Game of thrones based :D). Create groups with your friends and peer-program AI to fight with each others.

You can check the gamehere.

Run

open index.html

Developing you AI

Create a ai.js in ai folders

Extend Player Class like this.

function WalkingDeadPlayer(name){
	Player.call(this,name)
}

To add logic create an update function

Now you can iterate from your units and call them for action this

this.update = function(){
	for(var i in this.units){

		var unit = this.units[i];
		unit.attackFirstAvailableTarget();

		if(unit.reachTarget()){

			var x = randomIntBetween(20,1100);
			var y = randomIntBetween(20,600);

			unit.goTo(x,y);
		}

	}
}

Dont forget to add you AI to game in main.js like this.

var walking_dead_player1 = new WalkingDeadPlayer("The walking dead");
world.addPlayer(walking_dead_player1);

About

Create your AI with a simple RTS game(Game of Thrones inspired). Ideal for practice your basic programing skill.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages