I'd love to help, but to be honest, your code is getting pretty impenetrable despite being less than 100 lines.
Don't take this as a criticism, more as friendly advice from someone who had to learn all this the hard way ...
- Indent your code. It makes the logic easier to follow.
Bad:
for i=1 to 100
print i
for j=1 to 100
print j
next j
next i
Good:
for i=1 to 100
print i
for j=1 to 100
print j
next j
next i
Which is easier to read? Pick an indentation style that suits you and stick with it.
- Give your variables more meaningful names
You use 'magaz'. I would use 'MagazineCount' or something similar.
- Use functions or subroutines with meaningful names to break it up a little
You have this code buried in your main loop:
if upkey()=1 then move object 2, 2.0
if downkey()=1 then move object 2, -2.0
if rightkey()=1 then turn object right 2, 1.5
if leftkey()=1 then turn object left 2, 1.5
Replace it with a line 'gosub PlayerMovement', and then add the code to the bottom of your source file like so:
PlayerMovement:
if upkey()=1 then move object 2, 2.0
if downkey()=1 then move object 2, -2.0
if rightkey()=1 then turn object right 2, 1.5
if leftkey()=1 then turn object left 2, 1.5
return
- Don't make your code more complex than it needs to be
You have this:
if spacekey()=1 then magaz=5
if spacekey()=1 then rload=1
if spacekey()=1 and dude=1 then play sound 3
if spacekey()=1 then dude=0
if spacekey()=0 then rload=0
if spacekey()=0 then dude=1
I converted it to this:
if spacekey() = 1
magaz = 5
rload = 1
if dude = 1 then play sound 3
dude = 0
else
rload = 0
dude = 1
endif
This has the same effect as your code, but is easier to read.
- Don't use "magic numbers"
You have an object number 3 - I have no idea from your code what that object represents. If instead of using '3' everywhere you used a variable like 'bullet' which had a value of 3 then I know exactly what that means from reading the code.
There are no hard rules here. For example, if I had code with a single matrix in, I might leave the number '1' in place.
The golden rule is 'Make your code easy for you to read'.