Skip to content

Commit ef41431

Browse files
committed
Use this.x, this.y as scrolling offsets when rendering each tile.
1 parent 69abe49 commit ef41431

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/pixi/extras/Tilemap.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ PIXI.Tilemap.prototype._renderTile = function(gl, shader, x, y, tile)
270270
gl.bufferData( gl.ARRAY_BUFFER, this.buffer, gl.STATIC_DRAW );
271271
gl.vertexAttribPointer( shader.aPosition, 4, gl.FLOAT, false, 0, 0 );
272272

273-
gl.uniform2f(shader.uScreenPosition, x, y);
273+
// draw the tile after applying the base coordinates (scrolling offset)
274+
gl.uniform2f(shader.uScreenPosition, x - this.x, y - this.y);
274275
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
275276
};
276277

0 commit comments

Comments
 (0)