Cos you both have requested some samples i'll give it to you, as well as some more info.
The program does only include a few objects. All are primitives. I dont have an exakt number of objects cos i change that all the time. The also only have a simple texture.
Here are some pieces of coding. This is only some parts and therefore you might not understand everything.
Main Loop:
do
owner=1
delay#=delay#-1
camy#=2500
mx=mousex()
my=mousey()
if leftkey()=1 then dec camx#,20
if rightkey()=1 then inc camx#,20
if upkey()=1 then inc camz#,20
if downkey()=1 then dec camz#,20
gosub _calc_camera
gosub calc_mouse
if owner(obj)=owner then gosub _move
gosub _shine
gosub _select_unit
if owner(obj)=owner then gosub _calc_position
gosub _pointer
gosub _controlpad
position object 1002,posx#(obj),25,posz#(obj)
rem mark selected unit
if owner(obj)=1 then ink rgb(200,0,0),1
if owner(obj)=2 then ink rgb(0,200,0),1
if owner(obj)=0 then ink rgb(205,205,205),1
line object screen x(obj)-25,object screen y(obj)-25,object screen x(obj)-15,object screen y(obj)-25
line object screen x(obj)-25,object screen y(obj)-24,object screen x(obj)-15,object screen y(obj)-24
line object screen x(obj)-25,object screen y(obj)-25,object screen x(obj)-25,object screen y(obj)-15
line object screen x(obj)-24,object screen y(obj)-25,object screen x(obj)-24,object screen y(obj)-15
line object screen x(obj)+25,object screen y(obj)+25,object screen x(obj)+15,object screen y(obj)+25
line object screen x(obj)+25,object screen y(obj)+24,object screen x(obj)+15,object screen y(obj)+24
line object screen x(obj)+24,object screen y(obj)+25,object screen x(obj)+24,object screen y(obj)+15
line object screen x(obj)+25,object screen y(obj)+25,object screen x(obj)+25,object screen y(obj)+15
ink rgb(255,255,0),0
sync
loop
As you can see i use a lot of subroutines.
The most important for this purpose.(the ones i think cause problems)
_select_unit:
for pos=1 to unitmax
if dead(pos)=1
if object collision(1000,pos) and mouseclick()=1 then obj=pos
endif
next pos
return
return
_pointer:
ink rgb(255,255,0),1
sprite 2,osx,osy,13
return
_move:
rem +++++++++++++++
for pos=1 to unitmax
if health#(pos)<1 then dead(pos)=0 : hide object pos :
psy#(pos)=object size(pos)/2
if health#(pos)>maxhp#(pos) then health#(pos)=maxhp#(pos)
if dead(pos)=0 then position object pos,-1000,-1000-,1000
if object collision(1000,pos+200)=1
target=pos
clear=0
if owner(target)=2
enemy=2
endif
endif
if object collision(1000,0)=0
clear=1
target=0
enemy=0
endif
next pos
rem +++++++++++++++++
if mouseclick()=2
if building#(obj)=0
if dead(obj)=1
if clear=1
gosub _select_targetground
endif
endif
endif
endif
if mouseclick()=2
if dead(obj)=1
if clear=0
if enemy=2
if attackleft(obj)=1
if dead(target)=1
if unittype#(obj)=1 then gosub _attack_type01
if unittype#(obj)=2 then gosub _attack_type02
if unittype#(obj)=3 then gosub _attack_type03
if unittype#(obj)=4 then gosub _attack_type04
if unittype#(obj)=5 then gosub _attack_type05
if unittype#(obj)=11 then gosub _attack_type01
endif
endif
endif
endif
endif
endif
rem attack own or neutral
if mouseclick()=2
if dead(obj)=1
if clear=0
if controlkey()=1
if attackleft(obj)=1
if dead(target)=1
if unittype#(obj)=1 then gosub _attack_type01
if unittype#(obj)=2 then gosub _attack_type02
if unittype#(obj)=3 then gosub _attack_type03
if unittype#(obj)=4 then gosub _attack_type04
if unittype#(obj)=5 then gosub _attack_type05
if unittype#(obj)=11 then gosub _attack_type01
endif
endif
endif
endif
endif
endif
return
_calc_position:
if attack#=0
for move=1 to 10
oldx#(obj)=psx#(obj) : oldz#(obj)=psz#(obj)
if psx#(obj)=posx#(obj) and psz#(obj)=posz#(obj)
else
point object obj,posx#(obj),object size y(obj)/2,posz#(obj)
psx#(obj)=newxvalue(psx#(obj),object angle y(obj),1) : psz#(obj)=newzvalue(psz#(obj),object angle y(obj),1)
position object obj,psx#(obj),object size y(obj)/2,psz#(obj)
position object obj+200,psx#(obj),object size y(obj)/2,psz#(obj)
endif
next move
endif
return
_calc_position:
if attack#=0
for move=1 to 10
oldx#(obj)=psx#(obj) : oldz#(obj)=psz#(obj)
if psx#(obj)=posx#(obj) and psz#(obj)=posz#(obj)
else
point object obj,posx#(obj),object size y(obj)/2,posz#(obj)
psx#(obj)=newxvalue(psx#(obj),object angle y(obj),1) : psz#(obj)=newzvalue(psz#(obj),object angle y(obj),1)
position object obj,psx#(obj),object size y(obj)/2,psz#(obj)
position object obj+200,psx#(obj),object size y(obj)/2,psz#(obj)
endif
next move
endif
return
Is might look like a lot of stuff to be done. For the moment i use a veru low FPS rate (only 50 FPS/s) No change
Is this to much codes between each SYNC
The only way to get an intellegent conversasion is to have a monolog.