Supporting Camera Background

After completing this chapter, you will be able to:

  • Implement background tiling with any image in any given camera WC bounds
  • Understand parallax and simulate motion parallax with parallax scrolling
  • Appreciate the need for layering objects in 2D games and support layered drawing


By this point your game engine is capable of illuminating 2D images to generate highlights and shadows and of simulating basic physical behaviors. To complete the engine development, this chapter focuses on the general support for creating the game world environment with background tiling and parallax and relieving ...

Get Build Your Own 2D Game Engine and Create Great Web Games: Using HTML5, JavaScript, and WebGL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.