Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Player = new Class({
- Extends : LibCanvas.Interfaces.Drawable,
- radius : 15,
- color : '#080',
- initialize : function () {
- // Элемент libcanvas присвоится после создания игрока
- // и после вызова метода initialize, потому необходимо
- // подождать это славное событие (по аналогии с domready)
- this.bind('libcanvasSet', function (){
- this.shape = new LibCanvas.Shapes.Circle({
- // центр мышки - объект LibCanvas.Point, указан по ссылке как центр
- // текущего круга, потому круг всегда будет следовать за указателем
- center : this.libcanvas.mouse.point,
- radius : this.radius
- });
- });
- },
- draw : function () {
- if (this.libcanvas.mouse.inCanvas) {
- this.libcanvas.ctx.fill(this.shape, this.color);
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement