class Owl{
constructor(props){
this.ctx = props.ctx
this.x = props.x
this.y = props.y
this.rotate = props.rotate,
this.scale = props.scale
this.visible = props.visible
}
drawRightBrow(){
this.ctx.save()
this.ctx.rotate(-Math.PI/5)
this.ctx.strokeStyle = "white"
this.ctx.beginPath()
this.ctx.moveTo(0,0)
this.ctx.lineTo(100,0)
this.ctx.stroke()
this.ctx.closePath()
this.ctx.restore()
}
drawRightEye(){
this.ctx.save()
this.ctx.rotate(-Math.PI/5)
this.ctx.translate(40,0)
this.ctx.fillStyle = "gold"
this.ctx.beginPath()
this.ctx.arc(0,0,20,0,Math.PI)
this.ctx.stroke()
this.ctx.fill()
this.ctx.closePath()
this.ctx.fillStyle = "red"
this.ctx.beginPath()
this.ctx.arc(0,0,10,0,Math.PI)
this.ctx.stroke()
this.ctx.fill()
this.ctx.closePath()
this.ctx.restore()
}
drawLeftBrow(){
this.ctx.save()
this.ctx.rotate(Math.PI/5)
this.ctx.strokeStyle = "white"
this.ctx.beginPath()
this.ctx.moveTo(0,0)
this.ctx.lineTo(-100,0)
this.ctx.stroke()
this.ctx.closePath()
this.ctx.restore()
}
drawLeftEye(){
this.ctx.save()
this.ctx.rotate(Math.PI/5)
this.ctx.translate(-40,0)
this.ctx.fillStyle = "gold"
this.ctx.beginPath()
this.ctx.arc(0,0,20,0,Math.PI)
this.ctx.stroke()
this.ctx.fill()
this.ctx.closePath()
this.ctx.fillStyle = "red"
this.ctx.beginPath()
this.ctx.arc(0,0,10,0,Math.PI)
this.ctx.stroke()
this.ctx.fill()
this.ctx.closePath()
this.ctx.restore()
}
draw(){
if(this.visible){
this.ctx.save()
this.ctx.translate(this.x,this.y)
this.ctx.rotate(this.rotate)
this.ctx.scale(this.scale,this.scale)
this.drawRightBrow()
this.drawLeftBrow()
this.drawRightEye()
this.drawLeftEye()
this.ctx.restore()
}
}
switchVisibility(){
if(this.visible){
this.visible = false
}else{
this.visible = true
}
}
}