Runtime Error 7007 - Object already exists at line 154
Rem Project: space game v 1.0
Rem Created: Monday, March 13, 2017
Rem ***** Main Source File *****
cls
sync on
sync rate 30
SET DISPLAY MODE 1024, 768,32
MAXIMIZE WINDOW
rem disable escapekey
backdrop on
color backdrop 0
rem variables
gosub _variables:
gosub _give_variabes:
INK rgb(0,255,0),rgb(0,0,0)
rem load musics
rem gosub _music: rem
rem blur
gosub _motion_blur: rem
rem load bittons
gosub _bittons: rem имена кнопок 101, 102, 103,
rem загрузка космоса
gosub _load_space_box:
rem loadcursor
rem gosub _load_cursor: rem имя курсора 10
do
sync
LOOP
end
remstart
do
gosub _esc:
if planeta = 0 then gosub _warp_to_star:
if planeta = 0 then gosub _warp_to_planet_orbit:
if planeta=1 then gosub _warp_to_space_from_orbit:
if planeta=1 then gosub _landing_on_panet:
if planeta =2 then gosub _warp_to_space_from_planet:
if galaxy_menu=1 then gosub _galaxy:
if menuopen=1 then gosub _menu:
if newgame=1 then gosub _generate_game:
gosub _playmusic: rem игра музыки
gosub _cursor: rem рисуем курсор
if planeta = 0 then gosub _skybox: rem позиция в космосе
if fight=1 then gosub _fight:
if planeta =1 then gosub _fly_planeta:
if planeta = 2 then gosub _land_planet:
LOOP
remend
_esc:
if ESCAPEKEY()=1
sound_change=1
menuopen=1
show sprite play_1
show sprite options_1
show sprite exit_1
ENDIF
return
_music:
load sound "sound\music\main.wav",1
load sound "sound\music\title.wav",2
loop sound 1
rem музыку не меняли
sound_change=0
return
_motion_blur:
alpha1 = 60
set camera to image 0,1,512,512
sprite 1,0,0,1
set sprite 1,0,1
set sprite alpha 1,alpha1
size sprite 1,1024,768
return
_bittons:
menuopen=1
galaxy_menu=0
play_1=menu(1)
options_1=menu(2)
exit_1=menu(3)
load image "texture\bitton\Play.bmp",play_1
load image "texture\bitton\Options.bmp",options_1
load image "texture\bitton\Exit.bmp",exit_1
SPRITE play_1, 1024/2, 768/2-200-8, play_1
SPRITE options_1, 1024/2, 768/2-100-8, options_1
SPRITE exit_1, 1024/2, 768/2-8, exit_1
map_green_space=galaxy_menu(26)
star_map_green=galaxy_menu(1)
jump_to=galaxy_menu(27)
close_to=galaxy_menu(28)
position_ship=galaxy_menu(29)
target_position=galaxy_menu(30)
load image "texture\menu galaxy space\map space green.jpg",map_green_space
load image "texture\menu galaxy space\star map green.jpg",star_map_green
load image "texture\menu galaxy space\jump to.jpg",82
load image "texture\menu galaxy space\close.jpg",83
load image "texture\menu galaxy space\position_ship.jpg",85
load image "texture\menu galaxy space\target_position.jpg",86
SPRITE map_green_space, 1, 1, map_green_space
SPRITE jump_to, 256+10, 512+10, jump_to
SPRITE close_to, 1+10, 512+10, close_to
for t=1 to 25
SPRITE galaxy_menu(t), 256, 80, star_map_green
SET SPRITE PRIORITY galaxy_menu(t),2
rem hide sprite galaxy_menu(t)
next t
t=1
for x=1 to 5
for y=1 to 5
SPRITE galaxy_menu(t), x*20, y*20, star_map_green
SET SPRITE PRIORITY galaxy_menu(t),2
inc t
next y
next x
SPRITE target_position, SPRITE X(galaxy_menu(1)), SPRITE y(galaxy_menu(1)), target_position
SPRITE position_ship,SPRITE X(galaxy_menu(1)), SPRITE y(galaxy_menu(1)), position_ship
SET SPRITE PRIORITY target_position,3
SET SPRITE PRIORITY position_ship,5
remstart
hide sprite map_green_space
hide sprite jump_to
hide sprite close_to
hide sprite position_ship
hide sprite target_position
remend
return
_load_space_box:
planeta = 0: rem позиция в космосе
sky_box_a=spacebox(1): rem космос со звездами
sky_box_b=spacebox(2): rem облока
sky_image_a=sky_space_image(1)
sky_image_b=sky_space_image(2)
set ambient light 100
if object exist (sky_box_a) then delete object sky_box_a
if object exist (sky_box_b) then delete object sky_box_b
SET CAMERA RANGE 10,100000
autocam off
load image "texture\sky box\space.jpg",sky_image_a
load image "texture\sky box\spaceclouds.jpg",sky_image_b
position camera 0,0,0,0
make object cube sky_box_a,10000
SET OBJECT FOG sky_box_a, 1
make object cube sky_box_b,9900
position object sky_box_a,0,0,0
position object sky_box_b,0,0,0
texture object sky_box_b,sky_image_b
texture object sky_box_a,sky_image_a
scale object sky_box_a,500,500,500
scale object sky_box_b,500,500,500
set object cull sky_box_a,0
set object light sky_box_a,0
set object cull sky_box_b,0
set object light sky_box_b,0
SET ALPHA MAPPING ON sky_box_b, 40
return
_load_cursor:
cursor=90
load image "texture\cursor\green.jpg",cursor
SPRITE cursor, 1, 1, cursor
SET SPRITE ALPHA cursor, 40
rem hide sprite cursor
menuopen=1
return
_variables:
dim sky_space_image(2)
dim star_object(25)
dim skybox_object(20)
dim planet_space(25)
dim spacebox(2)
dim name_star$(20)
dim planet_land_texture(20)
dim land(1)
dim interceptors_objects(100)
dim enemy_objects(100)
dim interceptors_texture(100)
dim enemy_texture(100)
dim menu(3)
dim galaxy_menu(30)
return
_give_variabes:
for t=1 to 2
sky_space_image(t)=free_image()
next t
for t=1 to 25
star_object(t)=free_object()
NEXT t
for t=1 to 20
skybox_object(t)=free_object()
NEXT t
for t=1 to 25
planet_space(t)=free_object()
NEXT t
for t=1 to 2
spacebox(t)=free_object()
NEXT t
for t=1 to 20
planet_land_texture(t)=free_image()
NEXT t
land(1)=free_image()
for t=1 to 100
interceptors_objects(t)=free_object()
NEXT t
for t=1 to 100
enemy_objects(t)=free_object()
NEXT t
for t=1 to 100
interceptors_texture(t)=free_image()
NEXT t
for t=1 to 100
enemy_texture(t)=free_image()
NEXT t
for t=1 to 3
menu(t)=free_image()
next t
for t=1 to 30
galaxy_menu(t)=free_image()
next t
return
FUNCTION free_object()
v=1
while object exist(v)=1
inc v
endwhile
ENDFUNCTION v
FUNCTION free_image()
v=1
while image exist(v)=1
inc v
endwhile
ENDFUNCTION v
Help please find an error
Attach files don't work too