Sprybug Posted February 6, 2019 Share Posted February 6, 2019 (edited) Hey Guys! Random Terrain asked me to make a tutorial series on how to make a game scroll like Princess Rescue. Let me begin by saying it's not as hard as you think. I've heard that some people have had a hard time doing it while still having cpu time to play with. Yes, horizontal screen scrolling can eat up those precious cpu clocks, but if you are making a simple game, you may still be able to do it all within one screen draw. Princess Rescue on the other hand, required 3 screen draws per full game cycle, where as Zippy took only 2 (I refined the method a little). I will be using the Princess Rescue method for the example for simplification reasons, so you can learn and you can take what you learn and build upon it if you'd like. So let's start with this before we even start programming. Let's make a level first! Before we can make a level, we need to know how it's constructed. At the standard kernel, standard resolution, you have a 32x11 playfield block screen. That is 32 across and 11 down. Let's say going across the screen is a row and going from top to bottom is a column. Each column will take 2 bytes of data because it's going to require 11 bits for the 11 playfield blocks you can have in a column. Since we're going to have the ability to scroll in either direction, we will need to use the regular Data statement for the data table. With this, you can use a variable pointer to read data at any point in the level. However, this will limit how much data you can have in one table to 256 bytes, meaning that our level can only be 128 playfield blocks wide, or 4 screens wide. To kind of get around this limitation, I added the feature of going down a pipe at the end of the first half of a level, which sends you to the 2nd half of the level, contained in its own 256 byte table, making each level 512 bytes in total. With this in mind, we are going to design our level in 128 characters across, and you can do this in a TEXT EDITOR! This is how I designed all of my Princess Rescue levels. I used good old fashioned EDIT.COM, however you can use any text editor that saves out a plain Jane text file. Keep in mind that the dimensions of whatever text editor you use, won't look like what will be in your game and will look really stretched out. An X represents a playfield block and a . (period) represents no block. Your text file will be 128x12 characters. What's with the 12th row you ask? The bottom 12th row is your spawn in data. Remember, each column is 11 bits for playfield blocks, meaning we have 5 bits leftover for other things, like information on what item will be scrolled in, using the player 2 sprite. That 12th row will contain rather a . (period) for nothing will spawn there when scrolled in, or a value from 0-F that your program will take and do what it needs with it. Included in this post is a ZIP file that contains the program I wrote in QB64 called TXT2LEV that will take your text file data and convert it into a DAT file that you can open in, let's say Notepad, and then copy and paste the data into a data table in your code. It's a simple program. When you run it, it will ask for the filename of the file you want to convert. Just put the filename MINUS the txt extensions, so for example, level1.txt, you would just type in level1. It will immediately convert and then ask if you want to do another. Since we're doing just 1 level, press N. Be sure all these files are in the same folder! When you unzip this file, just make a new directory somewhere on your hard drive, and put everything there, including your levels that you create. Also included is the 2nd half of the first level of Princess Rescue, so you can see how I did it. You'll notice for the spawn data, I used a long series of the same number/letter. This is because you can only scroll on one thing at a time, and if something else was on the screen it wouldn't scroll it on. So, to remedy this I made the spawn points consecutive to almost insure that one will eventually scroll on. Your Batari BASIC program will determine how high or low it will show up in the column, so you don't need to worry about that right now. Have fun making your level. The next lesson we'll talk about taking your data file that you created, put it in your program, and then writing up some code to interact with it. TXT2LEV.zip Click below for the next lesson! http://atariage.com/forums/topic/288001-horizontal-level-scrolling-in-batari-basic-tutorial-lesson-2/ Edited February 7, 2019 by Sprybug 14 Quote Link to comment https://forums.atariage.com/topic/287969-game-level-horizontal-scrolling-in-batari-basic-tutorial-lesson-1/ Share on other sites More sharing options...
+mksmith Posted February 6, 2019 Share Posted February 6, 2019 Very interesting thanks Sprybug - would love to do a scroller (either way) down the track! Looking forward to the rest of your tutorial! Quote Link to comment https://forums.atariage.com/topic/287969-game-level-horizontal-scrolling-in-batari-basic-tutorial-lesson-1/#findComment-4214541 Share on other sites More sharing options...
+Lewis2907 Posted February 7, 2019 Share Posted February 7, 2019 Sprybug, Thanks I will check out this weekend as I have been trying to get something like this. I'm sure people will ask about multisprite and DPC options. Quote Link to comment https://forums.atariage.com/topic/287969-game-level-horizontal-scrolling-in-batari-basic-tutorial-lesson-1/#findComment-4214584 Share on other sites More sharing options...
Lillapojkenpåön Posted March 1, 2020 Share Posted March 1, 2020 (edited) Does anybody know how I could make data like this for a higher definition playfield with more rows? TXT2LEV only works with 12 row text files. EDIT: I've also asked for help here Edited March 6, 2020 by Lillapojkenpåön Quote Link to comment https://forums.atariage.com/topic/287969-game-level-horizontal-scrolling-in-batari-basic-tutorial-lesson-1/#findComment-4470728 Share on other sites More sharing options...
ZippyRedPlumber Posted May 27, 2020 Share Posted May 27, 2020 Is it possible to make the level loop itself until you reach a certain criteria i.e, collect this many X or destroy all Y? 1 Quote Link to comment https://forums.atariage.com/topic/287969-game-level-horizontal-scrolling-in-batari-basic-tutorial-lesson-1/#findComment-4548208 Share on other sites More sharing options...
ZippyOasys Posted November 20 Share Posted November 20 Anyone know how to add enemies in scrolling playfield data? Quote Link to comment https://forums.atariage.com/topic/287969-game-level-horizontal-scrolling-in-batari-basic-tutorial-lesson-1/#findComment-5569024 Share on other sites More sharing options...
LatchKeyKid Posted November 25 Share Posted November 25 Thanks for bumping this as I was curious how the scrolling works in Princess Rescue. I'll have to bookmark this for future reference when I better understand the info. Quote Link to comment https://forums.atariage.com/topic/287969-game-level-horizontal-scrolling-in-batari-basic-tutorial-lesson-1/#findComment-5571895 Share on other sites More sharing options...
ZippyOasys Posted Sunday at 04:51 PM Share Posted Sunday at 04:51 PM @Sprybug How many playfields does it take to make a full game cycle? Quote Link to comment https://forums.atariage.com/topic/287969-game-level-horizontal-scrolling-in-batari-basic-tutorial-lesson-1/#findComment-5580999 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.