There's a few things for you to learn. Format your codes so it's easier for both you and others to follow.
sync on
sync rate 0
backdrop on
set text opaque
MyX# = 1
MyY# = 1
xx# = ShotX# + 65
yy# = ShotY# + 14
joo# = 0.1
noob = 0
color backdrop rgb(0,0,0)
load image "fighter1.bmp",1
load sound "raygun-01.wav",50
load image "laser.bmp",97
load image "SideScroll_Bkg01.bmp",96
sprite 96,1,358,96
CREATE ANIMATED SPRITE 99, "Explosion64.bmp", 16, 1, 2
create animated sprite 98, "Asteroids7siy.png", 8, 1, 3
do
xx# = ShotX# + 65
yy# = ShotY# + 14
ShotX# = MyX#
ShotY# = MyY#
sprite 1,MyX#,MyY#,1
sprite 97,xx#,yy#,97
hide sprite 97
XPos#=sprite x(97)
YPos#=sprite y(97)
REM ASTEROIDI
play sprite 98, 1, 8, 150
sprite 98, 120,120,3
REM RÄJÄHDYS
PLAY SPRITE 99, 1, 16, 100
sprite 99,200,200,2
if upkey() = 1 and MyY# > 1
inc MyY#,-joo#
rem move sprite 1,0.07
endif
if downkey() = 1 and MyY# < 449
dec MyY#,-joo#
rem move sprite 1,-0.07
endif
if spacekey() = 1
show sprite 97
play sound 50
sprite 97,XPos#,YPos#,97
endif
sync
loop
Use more sub routines insted of just listing out your codes to keep it looking cleaner and size down your main loop. Something like this. I didn't understand what all your variables are for so I might have misplaced them in the wrong sub.
sync on
sync rate 0
backdrop on
color backdrop rgb(0,0,0)
gosub Setup
REM Main Loop
do
gosub Ship
gosub Shot
gosub Asteroid
gosub Keys
sync
loop
Setup:
set text opaque
MyX# = 1
MyY# = 1
xx# = ShotX# + 65
yy# = ShotY# + 14
joo# = 0.1
noob = 0
load image "fighter1.bmp",1
load sound "raygun-01.wav",50
load image "laser.bmp",97
load image "SideScroll_Bkg01.bmp",96
sprite 96,1,358,96
CREATE ANIMATED SPRITE 99, "Explosion64.bmp", 16, 1, 2
create animated sprite 98, "Asteroids7siy.png", 8, 1, 3
return
Ship:
sprite 1,MyX#,MyY#,1
sprite 97,xx#,yy#,97
hide sprite 97
play sprite 98, 1, 8, 150
sprite 98, 120,120,3
return
Shot:
ShotX# = MyX#
ShotY# = MyY#
xx# = ShotX# + 65
yy# = ShotY# + 14
XPos#=sprite x(97)
YPos#=sprite y(97)
return
Astroid:
PLAY SPRITE 99, 1, 16, 100
sprite 99,200,200,2
return
Keys:
if upkey() = 1 and MyY# > 1
inc MyY#,-joo#
endif
if downkey() = 1 and MyY# < 449
dec MyY#,-joo#
endif
if spacekey() = 1
show sprite 97
play sound 50
sprite 97,XPos#,YPos#,97
endif
return
You can structure it even farther into phases or states or what ever you want to call it. This makes searching for a specific task much faster.
sync on
sync rate 0
backdrop on
color backdrop rgb(0,0,0)
Phase = 0
REM Main Loop
do
if Phase = 0 then gosub Phase0
if Phase = 1 then gosub Phase1
if Phase = 2 then gosub Phase2
sync
loop
Phase0:
REM Setting up the game
gosub Setup
Phase = 1
return
Phase1:
REM Game Section
gosub Ship
gosub Shot
gosub Asteroid
gosub Keys
return
Phase3:
REM Ending the game
REM Erase any used sprite or images 1-2000
for lp = 1 to 2000
if image exist(lp) = 1 then delete image lp
if sprite exist(lp) = 1 then delete sprite lp
if sound exist(lp) = 1 then delete sound lp
next lp
end
return
Setup:
set text opaque
MyX# = 1
MyY# = 1
xx# = ShotX# + 65
yy# = ShotY# + 14
joo# = 0.1
noob = 0
load image "fighter1.bmp",1
load sound "raygun-01.wav",50
load image "laser.bmp",97
load image "SideScroll_Bkg01.bmp",96
sprite 96,1,358,96
CREATE ANIMATED SPRITE 99, "Explosion64.bmp", 16, 1, 2
create animated sprite 98, "Asteroids7siy.png", 8, 1, 3
return
Ship:
sprite 1,MyX#,MyY#,1
sprite 97,xx#,yy#,97
hide sprite 97
play sprite 98, 1, 8, 150
sprite 98, 120,120,3
return
Shot:
ShotX# = MyX#
ShotY# = MyY#
xx# = ShotX# + 65
yy# = ShotY# + 14
XPos#=sprite x(97)
YPos#=sprite y(97)
return
Astroid:
PLAY SPRITE 99, 1, 16, 100
sprite 99,200,200,2
return
Keys:
if upkey() = 1 and MyY# > 1
inc MyY#,-joo#
endif
if downkey() = 1 and MyY# < 449
dec MyY#,-joo#
endif
if spacekey() = 1
show sprite 97
play sound 50
sprite 97,XPos#,YPos#,97
endif
return
And lastly about your laser moving right slowly. See if this helps, this is the most I can do without running it myself. You might have to fix some loose variables.
sync on
sync rate 0
backdrop on
color backdrop rgb(0,0,0)
Phase = 0
REM Main Loop
do
if Phase = 0 then gosub Phase0
if Phase = 1 then gosub Phase1
if Phase = 2 then gosub Phase2
sync
loop
Phase0:
REM Setting up the game
gosub Setup
Phase = 1
return
Phase1:
REM Game Section
cls 0
gosub Asteroid
gosub Shot
gosub Ship
gosub Keys
return
Phase3:
REM Ending the game
REM Erase any used sprite or images 1-2000
for lp = 1 to 2000
if image exist(lp) = 1 then delete image lp
if sprite exist(lp) = 1 then delete sprite lp
if sound exist(lp) = 1 then delete sound lp
next lp
end
return
Setup:
ShipX# = 1
ShipY# = 1
LaserX# = 0
LaserY# = 0
ShipSpeed# = .1
LaserSpeed# = .1
load image "fighter1.bmp",1
load sound "raygun-01.wav",50
load image "laser.bmp",97
load image "SideScroll_Bkg01.bmp",96
sprite 96,1,358,96
create animated sprite 99, "Explosion64.bmp", 16, 1, 2
create animated sprite 98, "Asteroids7siy.png", 8, 1, 3
return
Ship:
sprite 1,ShipX#,ShipY#,1
return
Laser:
sprite 97,LaserX#,LaserY#,97
if Laser = 1
LaserX# = LaserX# - LaserSpeed#
if LaserY# > 640 then Laser = 0
endif
return
Astroid:
sprite 98, 120,120,3
play sprite 98, 1, 8, 150
sprite 99,200,200,2
play sprite 99, 1, 16, 100
return
Keys:
if upkey() = 1 & Ship > 1
ShipY# = ShipY# - ShipSpeed#
endif
if downkey() = 1 & Ship < 449
ShipY# = ShipY# + ShipSpeed#
endif
if spacekey() = 1 & Laser = 0
play sound 50
Laser = 1
LaserX# = ShipX#
LaserY# = ShipY#
endif
return