16
Classic Main Forum / Re: How did you accomplish the rising water?
« on: August 13, 2017, 04:57:54 AM »
I'm not sure what it is you're trying to accomplish here, as surely the water should rise irrespective of the player's position, unless this is inside a gani script?
What I do is store a tile width and height of the fill area, as well as a filled width and height, and calculate the showpoly x/y/position like so:
What I do is store a tile width and height of the fill area, as well as a filled width and height, and calculate the showpoly x/y/position like so:
Code: [Select]
function updatePoly() {
temp.x = this.x + this.getWaterX();
temp.y = this.y + this.getWaterY();
this.showpoly(200, {temp.x, temp.y, temp.x + this.filledWidth, temp.y, temp.x + this.filledWidth, temp.y + this.filledHeight, temp.x, temp.y + this.filledHeight});
}
function getWaterX()
return (this.waterWidth - this.filledWidth) / 2;
function getWaterY()
return (this.waterHeight - this.filledHeight) / 2;