This page shows you how to make some fun changes to the Bang On! source code. This allows you a glimpse of how the code works and shows how easy it is to make games in TNT Basic.
To do any of these hacks you will need to have downloaded both TNT Basic and the Nag On! source code.
First, open the Bang On! source code in Hieroglyph, you should make a backup copy of Bang On! in case you make any mistakes! Then follow one of the following guides:
This is a very simple operation. First of all, you need to go to the "Play Game" procedure, this can be done by clicking in the procedure pop-up (the button with the small 'P' on it in the bottom left hand corner of the window) and selecting the "Play Game" procedure. After you have found the "Play Game" procedure you need to locate this line...
gLives=3
You can now simply set the value of gLives to whatever you like and that is how many lives you will have next time you play!!
This is almost the same as the above task (same procedure) except you will need to change this line...
gCurrentLevel=0
Whatever you set the gCurrentLevel variable to is the level you will start on!!
This is actually easier than you might think. Just follow these steps...
That's it! The next time you play Bang On! there will be another level. It is also possible to change the order of the levels by changing the order of the maps.
The current controls for Bang On! are...
Left - Left Arrow
Right - Right Arrow
Jump - Up Arrow
Fire - Space
This can be configured to any keys on the keyboard, providing you change the appropriate values.
The controls are handled in the "Move" procedure. Under the section highlighted with the comment "Little Green Blob", there should be a piece of code that looks like this...
if colBottom gGreenBlobYVelocity=0 if Up gGreenBlobYVelocity=gGreenBlobYVelocity-10.0 end if else ' Apply gravity gGreenBlobYVelocity=gGreenBlobYVelocity+0.5 end if if Left gGreenBlobXVelocity=gGreenBlobXVelocity-0.2 else if Right gGreenBlobXVelocity=gGreenBlobXVelocity+0.2 end if if Pressed(49) and gGreenBlobReload=0 if gGreenBlobWeaponType=kFireBall SpawnFireBall(gGreenBlobX,gGreenBlobY-10) gGreenBlobReload=10 else if gGreenBlobWeaponType=kSpiral SpawnSpiral(gGreenBlobX,gGreenBlobY,kSpiral) gGreenBlobReload=15 else if gGreenBlobWeaponType=kGrapplingHook SpawnSpiral(gGreenBlobX,gGreenBlobY,kGrapplingHook) gGreenBlobReload=18 end if end if
The controls are all visible in this small section (look for the keywords Up, Left, Right and Pressed). Look up the function "Pressed" in the TNT Basic help system (by pressing Command - ? and then searching for "Pressed") and it should be possible to replace any of the keywords with tests for other buttons.
The speed of the bubbles is controlled by how strong the gravity applied to them is. If the gravity is strong then they will fall towards the ground more quickly and therefore move much faster. So, all you need to do is change the gravity and you will have changed their speed.
You need to find the place in the code where gravity is actually applied to the bubbles. Go to the procedure "Move" which handles the movement of everything in the game. Now you need to find the section that handles the bubbles, luckily this is highlighted with a comment and the start of it looks like this...
' Bubbles int bubbleFound=false for n=0 to kBubbles-1 if gBubbleValid[n]
Towards the bottom of this section there is a piece of code that looks like this...
if gGameInMotion=0 gBubbleYVelocity[n]=gBubbleYVelocity[n]+0.1 ' Apply gravity end if
The number 0.1 is the gravity value, by raising and lowering this number you can raise and lower gravity. You can even stop it completely by setting it to 0.
If you have studied physics then you will already know that gravity is an acceleration.
In order to understand what acceleration is you first need to take a look at what velocity is. Velocity is a how quickly an object is moving. In the case of a bubble in Bang On!, the bubble starts off stationary in the air and then starts to move downwards, slowly at first but then faster and faster as it falls. So, the velocity of the bubble is increasing as time passes, this process is called accelerating.
In terms of numbers, this is what is happening to the bubble...
| Time | Height | Velocity | Acceleration |
| 0 | 10 | 0 | 0.1 |
| 1 | 10 | 0.1 | 0.1 |
| 2 | 9.9 | 0.2 | 0.1 |
| 3 | 9.7 | 0.3 | 0.1 |
| 4 | 9.4 | 0.4 | 0.1 |
| 5 | 9.0 | 0.5 | 0.1 |
| 6 | 8.5 | 0.6 | 0.1 |
| 7 | 7.9 | 0.7 | 0.1 |
| 8 | 7.2 | 0.8 | 0.1 |
| 9 | 6.4 | 0.9 | 0.1 |
As you can see, the acceleration of the bubble is constant throughout the whole process. However, velocity increases as time goes on, this is because the acceleration is added to the velocity when time advances. Since the velocity is increasing so do the differences in height between each time frame. In the first two frames the height does not change at all, this is because the velocity is 0 in the first frame.