Parallax gaming7/25/2023 This of course means that every pixel in every polygon and sprite has to be calculated and plotted individually, which is a nightmare. To scroll right for example, you might have to copy every column of pixels one column to the left, leaving a junk column on the right-most side of the screen which could be replaced with new content. Other platform programmers were not so lucky. To scroll up and down, you added or subtracted the number of bytes a single row of pixels occupied in screen memory. Coders for machines like the Archimedes were lucky: by cunningly altering the start address of video memory by 1, 2 or 4 bytes (depending on the number of colours per pixel – 256, 65536 or 16.7 million), you could give the instant impression of scrolling left or right by 1 pixel. Scrolling was really rough on the nerves of programmers back in the days of 8 and 16-bit home computers. If you don’t want a historical lesson, feel free to skip to the next section. In this article we will learn how to add scrolling to our project, as well as so-called parallax backgrounds which are background images which also scroll, but slower than the foreground level, giving a “2.5D” impression of depth.Īs usual we’ll be using Simple2D to cut down on messy DirectX drawing code, and as usual the maths and concepts apply to all game engines. While it is perfectly acceptable to have a platform game with each level or section based on a single screen, some games require a larger world, and to display this we need to allow the world to scroll (from side to side, up and down or both) on-screen. Start with 2D Platform Games Part 1: Collision Detection for Dummies if you just stumbled upon this page at random!ĭownload source code and compiled EXE for the code in this article. This article builds upon the demo project created in 2D Platform Games Part 2: Collision Detection Tweaks. The Redistributable Package can be freely bundled with your own applications. IMPORTANT! All of the articles in this series require you to have either Visual Studio 2010 or the Visual C++ 2010 Redistributable Package (4.8MB) installed in order to be able to try the pre-compiled EXEs provided with the examples.
0 Comments
Leave a Reply. |