I got the code below from the codebase but i tried to add a cube to the program so the cube could look like it was traveling.
However, it always complains about the object # already existing. No matter what value i use. why does it do that and how can i add objects to it successfully?
i added the line towards the bottom with the comments.
thanks
` This code was downloaded from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com
` -------------------------------------------------------------------------
` 3D Starfield DarkForge Snippet 27/9/2000
` -------------------------------------------------------------------------
` Flying into a 2D starfield. Change stars value for more/less and the
` slide value for more/less distortion.
sync rate 0
sync on
hide mouse
randomize timer()
create bitmap 1,640,480
stars=500
dim x#(stars)
dim y#(stars)
for i = 1 to stars
x#(i)=rnd(640.0)-320.0
y#(i)=rnd(480.0)-240.0
next i
sx#=1.03985 : sy#=1.03985
slidex#=320.0 : slidey#=240.0
ink rgb(255,255,255),0
do
cls 0
for j=1 to stars
dot x#(j)+slidex#,y#(j)+slidey#
x#(j)=x#(j)*sx#
y#(j)=y#(j)*sy#
if x#(j) > 640.0 then x#(j)=x#(j)-640.0
if y#(j) > 480.0 then y#(j)=y#(j)-480.0
if x#(j) < -640.0 then x#(j)=x#(j)+640.0
if y#(j) < -480.0 then y#(j)=y#(j)+480.0
next j
copy bitmap 1,0
` ############# line i added #####################
make object cube 1000, 20
` end of what i added
sync
loop