OK first off, it is a good idea to keep that GUN variable in the game, reson being, if you look at the two routtens and how they work.
rem load guns
_gun1:
IF gun# = 1 then Return
hide object 2
show object 1
gun# = 1
return
_gun2:
IF gun# = 2 then Return
hide object 1
show object 2
gun# = 2
return
At the end of each of these routeens you are saying hide object 1 show object 2, which is fine cos as the moment you have only 2 weapons. But if you had 3 or more weapons, how are you going to detect in these routeens which weapon is curently active so you know to tell the computer which weapon to hide?
The answer is simple and it is why I included your gun variable in my first code posting.
instead of saying in each of the routeens HIDE OBJECT 2 or HIDE OBJECT 1, write HIDE OBJECT gun
In each routeen, you change the variable of gun to the object number of the weapon that is being selected, there for no matter how many weapons you have in your game, if you say HIDE OBJECT gun, you will be telling the compture to hide the object number of gun, which will be the very last weapon you choosen, even if its object 54.
That wasent so much a bug in this current state of code, but a problem that would arrise the moment you added just 1 extra weapon to the selection list.
ok now for your problem, im not sure what you are saying is happerning, are you saying you run the game and then half way though loading, it just stops?or dose it drop out of the game all together.
Below is basicly YOUR code you provided, i have REM'ed out all the loading of Modles and bitmaps because i dont have them on my PC and that would obviously cause an error.
And it their place i have created in just the same kind of way, simple 3D objects (a cube and a plain)
Now when i run this code (which is YOUR code but without the modles, it works just fine on my PC.
Can you cut and past this verion onto your PC in a blank new project and see if when run, you get to switch between a cube and a plain in the middle of the screen by pressing 1 or 2.
If it dose then obviously the code is working fine as far as the main loops key detection and routtens is concerned, so i would look at your modles loading, matrix textureing and bitmaps. Are the names EXACTLY right? is the syntax for these commands being used correctly. I dont have DB pro just classic, so i cant be sure.
you will also noticed i changed your ROTATE -90 command to ROTATE 90 as i said before, my verswion od DB classic dosent like minus rotaion numbers.
let me know how you get on and elaborate on that problem you are haveing.
Rem ***** Main Source File *****
Sync On
Sync Rate 30
Hide mouse
Backdrop on
Set camera range 1,5000
Rem make matrix
Make matrix 1,10000,10000,20,20
Rem texture matrix
rem Load image "grass1.bmp",1
rem Prepare matrix texture 1,1,1,1
rem Fill matrix 1,0,1
rem load guns
`AK47
rem load object "ak47.x", 1
rem load image "ak47.bmp",2
Make Object plain 1,10,10
rem texture object 1,2
xrotate object 1,90
yrotate object 1,180
scale object 1, 20,20,20
`MP5
rem load object "mp5.x",2
rem load image "mp5.bmp",3
make object cube 2,10
rem texture object 2,3
xrotate object 2,90
yrotate object 2,179
scale object 2, 20,20,20
rem load guns
_gun1:
IF gun# = 1 then Return
hide object 2
show object 1
gun# = 1
return
_gun2:
IF gun# = 2 then Return
hide object 1
show object 2
gun# = 2
return
Rem Main loop
Do
If Inkey$()="1" then gosub _gun1
If Inkey$()="2" then gosub _gun2
Rem Refresh Screen
Sync
loop