I was wondering how to start my program with my object not half through the matrix and slide collisions with jumping.
load image "medialogosChronic Wars logo.bmp",1
paste image 1,35,0
Do
if button(20,140,"Single Player") then goto New_Game
button(20,180,"Multiplayer")
button(20,220,"Options")
if button(20,260,"Exit")then end
loop
New_Game:
cls
Text 240,220,"Loading..."
NDB_newtoncreate
load image "mediatextures3grasstexture.jpg",3
make matrix 1,2000,2000,10,10
prepare matrix texture 1,3,2,2
randomize matrix 1,10
make object cube 1,100
position object 1,0,50,0
load image "mediaplayerplaceholder.png",2
texture object 1,2
do
randomize matrix 1,100
height#=get ground height(1,object position x(1),object position z(1))
if object position y(1)<height# then position object (1),object position x(1),height#,object position z(1)
controlobjectusingarrowkeys(1,1,1)
thirdpersoncamera(1,0,120,120,50,1)
loop
function button(x1,y1,WORDS$)
Pressed=0
x2=Text Width(WORDS$)
y2=Text Height(WORDS$)
if mousex()>x1 and mousex()<x1+x2
if mousey()>y1-y2 and mousey()<y1+y2
Pressed=1
endif
endif
if pressed=1 then ink rgb(255,0,0),0 else ink rgb(255,255,255),0
if pressed=1
Pressed=Mouseclick()
else
pressed = 0
endif
text x1,y1,WORDS$
endfunction pressed
function controlobjectusingarrowkeys(obj,ms,ts)
if upkey() then move object obj,ms
if downkey() then move object obj,-1*ms
if leftkey() then yrotate object obj,wrapvalue(Object angle y(obj)-ts)
if rightkey() then yrotate object obj,wrapvalue(Object angle y(obj)+ts)
endfunction
function ThirdPersonCamera(Obj,Cam,Dist#,Height#,Smooth,FLAG)
`Obj=Object that you want to follow
`Cam=Camera number of camera used (Psst...0 is default camera...)
`Dist#=Distance from target
`Height#=Height of camera above object
`Smooth=Amount of steps it takes to reach the target
`1=No smoothing
`100=LOTS of smoothing
`Height Smoothing Flag. 0=No height smoothing and 1=Height smoothing
rem Store Camera Target Position
cx#=newxvalue(OBject position x(Obj),Object angle y(Obj),-1*Dist#)
cy#=Object Position y(Obj)+Height#
cz#=newzvalue(OBject position z(Obj),Object angle y(Obj),-1*Dist#)
`Store Camera Current Position
Camx#=curvevalue(cx#,Camera Position x(Cam),Smooth)
Camy#=curvevalue(cy#,Camera Position y(Cam),Smooth)
Camz#=curvevalue(cz#,Camera Position z(Cam),Smooth)
`Position Camera
if FLAG=1 then position camera Cam,Camx#,Camy#,camz#
if FLAG=0 then position camera Cam,Camx#,Object Position y(Obj)+Height#,camz#
point camera Cam,OBject position x(Obj),object position y(Obj),object position z(Obj)
endfunction
Thx, Jim
PS: the NDB_newtoncreate is nothing. I'm not using newton as of now...
What can games do for you?
www.getixinteractive.com