You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
805 B
38 lines
805 B
class NewBall extends Item{
|
|
|
|
//Class for the new ball objects appearing on the game board
|
|
//Inherits following properties from Item:
|
|
/*
|
|
id: string
|
|
|
|
pos: Vector
|
|
radius: number
|
|
color: Serialized.Color
|
|
settings: Settings.Item
|
|
time: TimeProcess
|
|
*/
|
|
|
|
constructor(settings: Settings.NewBall){
|
|
super(settings)
|
|
}
|
|
|
|
destroy(): void{
|
|
let index = game.newBalls.indexOf(this)
|
|
game.newBalls.splice(index, 1)
|
|
}
|
|
|
|
serialized(): Serialized.NewBall{
|
|
let newBall = super.serialized() as Serialized.NewBall
|
|
return newBall
|
|
}
|
|
|
|
show(): void{
|
|
p.push()
|
|
p.translate(this.centerX, this.centerY)
|
|
p.fill(this.color.fill)
|
|
p.stroke(this.color.stroke)
|
|
p.ellipse(0, 0, this.size, this.size)
|
|
p.pop()
|
|
}
|
|
|
|
} |