Petit Computer Wiki
Petit Computer Wiki
Advertisement

Here's an example program which you can use to help add credits to your game. In order to use it, you should understand GRPs, DATA, GOSUBs, and the general process of handling data. The first link provides commented code which helps you understand the credits system. The second link provides the code without comments in case they get in the way. In order to use the credits, you need to do the following:

  • Alter the DATA section so that it's your credits instead of the default
  • Count the number of credits lines and then change the "CREDITLINES" variable near the top from 15 to the number of lines
  • Surround the large "FOR" loop which actually performs the credits with a label and a return so that you can GOSUB into the credits
  • Remove ACLS:CLEAR and PNLTYPE "OFF" if you don't need it.
  • Remove the ACLS:END that appears above PRINTLINE
  • Append this program (after saving it) to the program you wish to have credits.
  • Move the "CREDITLINES=XXX", DIM CREDITS ETC, and the RESTORE chunk up to the beginning of your program (or somewhere near the beginning which will only run once)
  • Whenever you want the credits to show up, just use GOSUB and the label you created to jump into it. Make sure you set up everything you need, like clearing the screen or setting fonts or whatever. Also, after the GOSUB, make sure you clean everything up.

Remember, the first link provides commented code; the second link provides clean code.

https://db.tt/djeWFKhz https://web.archive.org/web/20151106193950/https://dl.dropboxusercontent.com/u/4753340/Online%20posting/petit%20computer/credits/creditsc.png

Creditsc qrs


https://db.tt/Oov0uMyS https://web.archive.org/web/20151106193952/https://dl.dropboxusercontent.com/u/4753340/Online%20posting/petit%20computer/credits/credits.png

Credits qrs

The first two examples are simpler, but require you to know the amount of lines in the credits ahead of time. This last link provides an example where you just end the credits DATA with "<END>", and it'll do everything automatically; you won't have to count the credit lines. However, it's a bit more complicated, so if you're trying to understand how it works, I'd start with the first link (above). If you already know how it works and how to add it to your program, but you want one that's easier to add to the credits, use this last link.

https://db.tt/27rxD5PU https://web.archive.org/web/20151106194201/https://dl.dropboxusercontent.com/u/4753340/Online%20posting/petit%20computer/credits/credits2.png

Credits2 qrs
Advertisement