Access another class property
Let pipe be a class class Pipe{ constructor(x = camera.x + width, y = player.h * int(random(-5, 0)), w = player.w * int(random(1, 13)), h = (player.h - y) - ((((player.h - y) / player.h) - int(random(1, (((player.h - y) / player.h) - 1)))) * player.h)){ this.x = x this.y = y this.w = w this.h = h } draw(){ image(pipeImg, this.x, this.y, this.w, this.h) if(this.y >= 0){ this.h = player.h-this.y } } } class Spike{ constructor(){ this.x = new Pipe().x this.y = new Pipe().y this.w = new Pipe().w this.h = new Pipe().h } draw(){ rect(this.x, this.y, this.w, this.h) } } What i wanted to do is obtain class Pipe property which are x, y etc. Thereafter, place that in class Spike property. How can i do that? https://code.sololearn.com/WlU5rd9oDq9V/?ref=app