Hi Campers,
I am working on a rain simulation which involves using sliders to control various properties of the rain. I have made two different objects, a vertical slider and a horizontal slider. I then create new sliders by making a new instance of them like:
function VerticalSlider(x,y,color){
this.x = x
this.y = y
this.color = color
//etc
}
windSpeedSlider = new Slider(10,100,"blue")
What I would like to do is have something called Slider, which VerticalSlider and HorizontalSlider can inherit properties from. Something like:
function Slider(x,y,color){
this.x = x
this.y = y
this.color = color
//etc
}
function VerticalSlider inherits Slider(x,y,color){
//things specific to vertical sliders, but not sliders in general
}
I watched two videos about the prototype chain and experimented a little, but I can’t seem to find the right syntax to achieve this goal. Can someone suggest what to do?