Replying to Computer Programming.. True Basic
I know there is someone on NS that uses True basic, I've taken a break from mixing some music and now i need to get to work on some computer programming.
Before you read! If you are not a programmer i don't expect you to understand the code! Don't bother even replying.
Psedocode:
The Program: This program has the user try to hit a target by firing an artillery gun. Some of the graphics and code necessary for this program will be as follows:
*Create a gun and target graphic
*Place target graphic randomly on right side of the screen
*Design explosion logic to determine if target is destroyed
*Create explosion graphic
*Add score board showing number of shots, etc….
*Improve user input prompts for gun angle
*Add windage factor to make greater challenge
*Add opening with instructions
*Add closing with record holder feature
*Create randomly designed mountain obstacle(s) between gun and target and prevent shot from going “through” mountain
*Extras:
*Allow explosions to “blow up” mountain
*Add another gun and target and allow two user game, shooting back and forth at one another
*Other Ideas?
Subroutines:
Setup-initial set up of variables
Placemountain – place random mountain on the screen
Placetarget – place target in random spot on the right side of the screen
Shootloop – take your shots at target
Windchange – set up wind variations
Aimgun – aims gun at target
Showgun – shows gun on screen
Checkcolor – sets trajectory color
Trajectoryinput – assigns the trajectory
Showtrajectory – shows the trajectory on the screen
Explosion - shows small explosion
Majorexplosion – shows major explosion on direct hit
Sub Setup
Set the Window to -10, 1000, 1, 1000
OPTION ANGLE degrees
Set velocity and ground variables to 100
Set up number of shots, and target size
Subs(Placetarget and Placemountain)
For the mountain, make sure you have a right base, left base, and peak randomly set.
For the target, you decide on the size, but do not have it overlay the mountain
To be able to move the gun with the mouse:
Use the command GET MOUSE x,y,s
The variable s is the state of the mouse when the cursor is at position (x,y). The possible values of the status are
S = 0 mouse button not pressed
S = 1 mouse button held down while dragging
S = 2 mouse button clicked at (x,y)
S = 3 mouse button released at (x,y)
Sub Shootlopp
Need to set random windage and loop for a certain number of shots
Need to call wind change, aimgun, and showtrajectory
Need to determine if target is hit and call appropriate explose routines
*Let Windage = ????? Minus or Plus, plus is with you, and minus is against you
*Loop for number of shots
*Call wind_change
*Call Aim_gun
*Call Show_Trajectory
*Check target and show explosions
+K For help on graphics, or anything for that matter.
Click to expand post