Skip to content

Instantly share code, notes, and snippets.

@jonleung
Created May 31, 2015 19:24
Show Gist options
  • Save jonleung/8c698eb87306247663e5 to your computer and use it in GitHub Desktop.
Save jonleung/8c698eb87306247663e5 to your computer and use it in GitHub Desktop.

So I want to implement the game Agar.io http://agar.io/

In the game, you are an ellipse. You go around and eat other ellipses. When you eat more ellipses, you get bigger.

I know how to get an ellipse to move around IF I import an image of an ellipse (like this:

 game.load.image('sprite', 'assets/ellipse.png')

But then I don't know how to get the ellipse to change size when it eats more, specifically, I don't know how to do the sizing component.

What I am expecting is something like this.

sprite = game.add.ellipseSprite(100, 245, 'sprite');
sprite.onEat(function() {
	this.width += 10;
});
...
	
	

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment