Quote: "
Also, I didn't try your code so I'm not sure what it's supposed to do but shouldn't you increase the ObjectNumber variable somewhere?"
By looking at your code, I would be back in the same position since there is no stopping the mouse from resetting the mouseOK back to 1.
However, I think I solved it. Here is my code.
disable escapekey
sync on : sync rate 60
color backdrop rgb(200,100,200)
Global ObjectNumber
Global makethesphere
Global clickthemouse
clickthemouse = 0
makethesphere = 0
ObjectNumber = 1
make light 1
set point light 1,0,0,0
set light range 1,2000
repeat
BOX 200,200,250,250,RGB(0,100,255),RGB(0,100,255),RGB(0,100,255),RGB(0,100,255)
if mousex() > 200 and mousex() < 250 and mousey() > 200 and mousey() < 250 and mouseclick() = 1
makethesphere = 1
if makethesphere = 1 and clickthemouse = 0 then msphere()
endif
if makethesphere = 1 and clickthemouse = 1 then position object ObjectNumber,10,50,50
sync
Until RETURNKEY()= 1
end
FUNCTION msphere()
make object sphere ObjectNumber,10,100,100
color object ObjectNumber,rgb(255,100,100)
makethesphere = 0
clickthemouse = 1
ENDFUNCTION
Ok now.. I fixed it so that once its been called once, it wont call it again ever. I can now add the code so that ObjectNumber can be more dynamic and I can make more then one sphere.
But now, if you run my code, the color takes over when I added the backdrop. so now I'm trying to solve that problem.
"If you can sing that high, you must have been kicked in the crotch a little too hard."