Hello community,
I want multiple lights made to be positioned where an object is, but that specific light that has been created. Unfortunatly, in my code only one light if not, the wrong one is moving with the object...here is the code :
sync on
sync rate 60
backdrop on
color backdrop rgb(0,0,0)
make object cube 1, 55
make object cube 2, 55
position object 2, object position x(1) + 55, object position y(1) - 55, object position z(1)
litlight = 1
litlightobj = 3
do
text 5,5, "PRESS 1 TO ENABLE POINT LIGHT"
text 5,18, "PRESS 2 TO ENABLE SPOT LIGHT"
control camera using arrowkeys 0, 2, 3
if keystate(2) = 1
makepointlight = makepointlight + 1
if makepointlight = 2
inc litlight
make light litlight
point light litlight, object position x(1), object position y(1), object position z(1) + 55
lightcol = lightcol + 1
if lightcol = 2
color light litlight, rgb(255,0,255)
endif
inc litlightobj
make object sphere litlightobj, 25, 5,5
position object litlightobj, light position x(litlight), light position y(litlight), light position z(litlight) - 55
set light to object position litlight, litlightobj
endif
ENDIF
if keystate(2) = 0
makepointlight = 0
endif
litsel = pick object(mousex(), mousey(), 3,1000)
if pick object(mousex(), mousey(), 3,1000) > 0
if mouseclick() = 1
do
if upkey() = 1
move object up litsel, 5
endif
if downkey() = 1
move object down litsel, 5
endif
if leftkey() = 1
move object left litsel, 5
endif
if rightkey() = 1
move object right litsel, 5
endif
set light to object position litlight, litsel
if mouseclick() = 2
exit
endif
sync
loop
ENDIF
endif
sync
LOOP
Rims Flames