Dart DocumentationsnakeBonus

Bonus class

class Bonus
{
num x, y, size;

Bonus(x, y, {size: 10})
{
  this.x = x;
  this.y = y;
  this.size = size;
}

draw()
{
    ctx.beginPath();
    ctx.lineWidth = 2;
    ctx.fillStyle = "red";
    ctx.strokeStyle = "red";
    ctx.arc(this.x, this.y, this.size, 0, PI*2, false);
    ctx.fill();
    ctx.closePath();
    ctx.stroke();
}

}

Constructors

new Bonus(x, y, {size: 10}) #

Bonus(x, y, {size: 10})
{
 this.x = x;
 this.y = y;
 this.size = size;
}

Properties

num size #

num x, y, size

num x #

num x

num y #

num x, y

Methods

dynamic draw() #

draw()
{
   ctx.beginPath();
   ctx.lineWidth = 2;
   ctx.fillStyle = "red";
   ctx.strokeStyle = "red";
   ctx.arc(this.x, this.y, this.size, 0, PI*2, false);
   ctx.fill();
   ctx.closePath();
   ctx.stroke();
}