I'm not sure exactly what the problem is but.
1. Try not to use goto unless you have to. Use functions or gosubs to group blocks of code you want to reuse.
disable escapekey
do
cls
input "press y to play or n to quit ", s$
if s$ = "y" then gosub _game
if s$ = "n" then end
loop
_game:
box 0,0,32,32
get image 1,0,0,32,32,1
sprite 1,0,0,1
repeat
cls
if leftkey() then sprite 1,sprite x(1)-1,sprite y(1),1
if rightkey() then sprite 1,sprite x(1)+1,sprite y(1),1
if upkey() then sprite 1,sprite x(1),sprite y(1)-1,1
if downkey() then sprite 1,sprite x(1),sprite y(1)+1,1
until escapekey()
delete sprite 1
return
Using gosubs, funtions or loops groups blocks of code together and makes it easier to keep organised. With goto it's easy to end up with code that jumps all over the place and is very difficult to follow and debug.
2. Assign images numbers and load them all outside the game loop.
`images
`Beta = 10
`handgun = 11
`
Load Image "Player 1 Beta.bmp", 10
Load Image "Player 1 Handgun.bmp", 11
I suspect this is what is causing your problem. Sprite 2 has image no 101. In the weapon change bit you delete image 101. Sprite 2 no has no image which may cause the problem.
If you have the images loaded you just need to swap the sprites image number.
Either by using the sprite command
`image no 1 red box
ink rgb(255,0,0),0
box 0,0,32,32
get image 1,0,0,32,32,1
`image no 2 white box
ink rgb(255,255,255),0
box 0,0,32,32
get image 2,0,0,32,32,1
sprite 1,200,200,1
do
cls
print "press return to swap image"
sprite 1,200,200,sprite image(1)
if returnkey()
if sprite image(1) = 1
sprite 1, 200, 200, 2
else
sprite 1, 200, 200, 1
endif
repeat
`
until returnkey() = 0
endif
loop
Or store the image number in a variable
`image no 1 red box
ink rgb(255,0,0),0
box 0,0,32,32
get image 1,0,0,32,32,1
`image no 2 white box
ink rgb(255,255,255),0
box 0,0,32,32
get image 2,0,0,32,32,1
sprite_image = 1
do
cls
print "press return to swap image"
sprite 1,200,200,sprite_image
if returnkey()
if sprite_image = 1
sprite_image = 2
else
sprite_image = 1
endif
repeat
`
until returnkey() = 0
endif
loop
dbhelp - online dbpro help files with user comments