Hello(Forgiveness beforehand, I use a translator.),
Can you help me please, I would like make a program for see my character move.
I have already made a code but I do not like it.
set display mode 1024,768,32
loadingnum#=rnd(1)
if loadingnum#=1 then load image "loading/1.jpg", 2
if loadingnum#=0 then load image "loading/2.jpg", 2
load music "tennowa.mid", 3
paste image 2,0,0,2
loop music 3
wait 100
load dll "SC_Collision2.0.dll", 255
sync on : sync rate 100
hide mouse
set camera range 1,30000000
AUTOCAM OFF
load object "human/humanimation.x", 1
position object 1,1000,100,10000
scale object 1,500,500,500
Sc_setupobject 1,0,2
x#=500
y#=500
Global Variables
Global hAngle# As Integer
Global vAngle# As Integer
Rotate Object 1,Object Angle X(1),Object Angle Y(1)+180,Object Angle Z(1)
Fix Object Pivot 1
draw sprites first
map1()
global oldx#
global oldy#
global oldz#
SET AMBIENT LIGHT 50
stop music 3
do
oldx# = object position x(1)
oldy# = object position y(1)
oldz# = object position z(1)
mouvement()
collision()
MouseLook(Object Position X(1), Object Position Y(1)+65, Object Position Z(1), 200, MouseMovey(), MouseMovex())
turn object left 50,0.005
sync
loop
wait key
function collision()
x# = object position x(1)
y# = object position y(1)
z# = object position z(1)
collide = sc_SphereSlidegroup(0,oldx#,oldy#,oldz#,x#,y#,z#,56,0)
if collide>0
x# = sc_getCollisionSlideX()
y# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
position object 1,x#,y#,z#
endif
endfunction
function mouvement()
walk=0
scrape=0
if grabseq=0
if keystate(17)=1 then marche = 1;marcheanimation = 1;move object 1,10
If marcheanimation = 1 and object playing(1)=0
set object speed 1,10
play object 1,154,158
marche = 0
Endif
if keystate(31)=1 then marche = 1;marchearrianimation = 1;move object 1,-10
If marchearrianimation = 1 and object playing(1)=0
set object speed 1,10
play object 1,154,158
if object playing(1)=0
marche = 0
play object 1,0,0
Endif
Endif
set object speed 1,10
if keystate(30)=1 then droitanimation = 1;move object left 1,10
If droitanimation = 1 and object playing(1)=0
set object speed 1,10
play object 1,170,174
if object playing(1)=0
marche = 0
play object 1,0,0
Endif
Endif
set object speed 1,10
if keystate(32)=1 then gaucheanimation = 1;move object right 1,10
If gaucheanimation = 1 and object playing(1)=0
set object speed 1,10
play object 1,176,180
if object playing(1)=0
marche = 0
play object 1,0,0
Endif
Endif
set object speed 1,5
if spacekey()=1 then play object 1,115,125;move object up 1,30
move object down 1,20
endif
endfunction
function map1()
load object "map1/map1.x",3
scale object 3,10000,10000,10000
position object 3,0,-10,0
SC_setupObject 3,1,0
load object "map1/chemins.x",4
scale object 4,10000,10000,10000
position object 4,0,-10,0
SC_setupObject 4,1,0
load object "map1/arbres.x",5
scale object 5,10000,10000,10000
position object 5,0,-100,0
SC_setupObject 5,1,0
load object "map1/bancs.x",6
scale object 6,10000,10000,10000
position object 6,0,-100,0
SC_setupObject 6,1,0
load object "map1/stands.x",7
scale object 7,10000,10000,10000
position object 7,0,-100,0
SC_setupObject 7,1,0
load object "map1/statue1.x",8
scale object 8,10000,10000,10000
position object 8,0,-100,0
SC_setupObject 8,1,0
load object "map1/portesplace.x",9
scale object 9,10000,10000,10000
position object 9,0,-100,0
SC_setupObject 9,1,0
load object "map1/place1.x",10
scale object 10,10000,10000,10000
position object 10,0,-100,0
SC_setupObject 10,1,0
load object "map1/place2.x",11
scale object 11,10000,10000,10000
position object 11,0,-100,0
SC_setupObject 11,1,0
load object "map1/statue2.x",12
scale object 12,10000,10000,10000
position object 12,0,-100,0
SC_setupObject 12,1,0
load object "map1/sky.x",50
scale object 50,1000000,1000000,1000000
position object 50,0,0,0
set object light 50,50
set object tRANSPARENCY 5,4
cls
load music "òX_town04.mid",1
loop music 1
endfunction
Function MouseLook(xTarget, yTarget, zTarget, hDist#, vDist#, Speed#)
`Continue from where we last were
hAngle# = hAngle# - Speed#
vAngle# = vAngle# + vDist#
`Tricky part: Make a 'circular' camera movement
xPos# = xTarget + cos(hAngle#) * hDist#
yPos# = yTarget + vAngle#
zPos# = zTarget + sin(hAngle#) * hDist#
`Position Camera in it's new place and point it at our main character
Position Camera xPos#, yPos#, zPos#
Point Camera xTarget, yTarget, zTarget
`Usually you'll want the camera just a tad higher then the char, so do that now
Position Camera xPos#, yPos#, zPos#
`Point our Main Character in the same direction as our camera
Rotate Object 1, Object Angle X(1), Camera Angle Y(), Object Angle Z(1)
EndFunction
if memblock exist(1) then delete memblock 1
I'm french ...