Lol, no it's not that good... It's not even the same style as Civ.
In other news, I tried to implement sliding collision! But it failed... It works the first time I do this (without toggling), but the first time I toggle, it stops working. Can someone please help(again...)
`Setup
sync on
sync rate 60
color backdrop 0
Turn# = 0
`Prepare Matrix
Size# = 1024
make matrix 1, Size#, Size#, 16, 16
load image "grass2.png", 1
prepare matrix texture 1,1,4,4
rem Make some pawns
make object sphere 1, 30
position object 1, 500, matrix position y(1)+15, 500
sc_setupobject 1, 0, 0
make object sphere 2, 30
position object 2, 750, matrix position y(1)+15, 300
sc_setupobject 2, 0, 0
rem setup camera
xrotate camera 60
`****Main Loop****
Speed# = 25
dim Toggle(100) as integer
for x = 0 to 100
if x<>1
Toggle(x)=0
else
Toggle(x)=1
endif
next
do
rem Freelook Verified:
if mouseclick()=4
hide mouse
position mouse screen width()/2, screen height()/2
xrotate camera camera angle x()+wrapvalue(mousemovey()/5.0)
yrotate camera camera angle y()+wrapvalue(mousemoveX()/5.0)
Freelook=1
else
show mouse
Freelook=0
endif
for x=1 to 100
if Toggle(x)=1
oldX#=object position x(x)
oldY#=object position y(x)
oldZ#=object position z(x)
endif
next
`If "x" is pressed ; flag so that it enters only once when pressed
if spacekey()=1 and flag=0 and Freelook=0
`Loop for 100 ; Sets the flag
flag=1
for x = 1 to 100
newX = x+1
if Toggle(x)=1
`Deselect current unit
Toggle(x)=0
`If the next unit on the list exists,
if object exist(newX)=1
`Select it
Toggle(newX)=1
`this is so that it exits
x=100
else
`If not, go back to number one
Toggle(1)=1
x=100
endif
endif
next
endif
`when the key is not pressed, it restores the flag
if spacekey()=0 then flag=0
`Movement of character with WASD Keys
if keystate(17)=1
for x=1 to 100
if Toggle(x)=1
if Speed#>0 and Freelook=0
move object x, 0.7
dec Speed#, 0.05
endif
endif
next
endif
if keystate(31)=1
for x=1 to 100
if Toggle(x)=1
if Speed#>0 and Freelook=0
move object x, -0.7
dec Speed#, 0.05
endif
endif
next
endif
if keystate(30)=1
for x=1 to 100
if Toggle(x)=1 and Speed#>0 and Freelook=0
yrotate object x, object angle y(x)-1.5
endif
next
endif
if keystate(32)=1
for x=1 to 100
if Toggle(x)=1 and Speed#>0 and Freelook=0
yrotate object x, object angle y(x)+1.5
endif
next
endif
for x=1 to 100
if Toggle(x)=1
x#=object position x(x)
y#=object position y(x)
z#=object position z(x)
endif
next
for x=1 to 100
for y=1 to 100
if object exist(y)
if Toggle(x)=1
SlidingCollision(oldX#,oldY#,oldZ#,x#,y#,z#,15,x,y)
endif
endif
next
next
rem colr teh objexc
for x = 1 to 100
if Toggle(x)=1 and object exist(x)=1 then color object x, rgb(0,255,255)
if Toggle(x)=0 and object exist(x)=1 then color object x, rgb(255,255,255)
next x
for x=1 to 100
if Toggle(x)=1 and Freelook=0
posx#=cos(270-object angle y(x)) * 80 + object position x(x)
posz#=sin(270-object angle y(x)) * 80 + object position z(x)
position camera posx#,object position y(x)+50,posz#
point camera object position x(x),object position y(x)+6,object position z(x)
endif
next
rem Display HUD
text 5, 5, "Energy Left: "+str$(int(Speed#))
text 5, 20, "FPS: " +str$(screen fps())
for x=0 to 100
if Toggle(x)=1 then text 5, 35, "Selected Unit: "+str$(x)
next
sync
loop
function SlidingCollision(X1#,Y1#,Z1#,X2#,Y2#,Z2#,Radius#,Dyn,Obj)
C = sc_sphereslide(Obj,X1#,Y1#,Z1#,X2#,Y2#,Z2#,Radius#,0)
if C > 0
cx# = sc_getcollisionslidex()
cy# = sc_getcollisionslidey()
cz# = sc_getcollisionslidez()
position object Dyn, cx#, cy#, cz#
endif
endfunction
delete memblock 1
I'm using Sparky's collision Dll.
EDIT: I think the collision sphere is misplaced - the selected unit collides with some random space off to the side(directly to the side) of the other unit.
EDIT 2: Fixed! I just added a few "sc_updateobject" commands.