Thanks. But the trouble is that the mouse and panoramic tops at the ends-screen.
I have worked in two codes recopiling by the forum. One to percentual pixels and other to virtual pixels.
For all that will be usefull!!
WASD AND MOUSELOOK WITH PERCENTUAL PIXELS
//based in softmotion3d and aviles22 code posted in APPGAMEKIT forums
//to work with PORCENTUAL SCREEN.
setwindowsize(1024,768,0)
setdisplayaspect(1024.0/768)
SetRawMouseVisible(0)
Ground = CreateObjectPlane(128, 128):RotateObjectGlobalX(Ground, 90):setobjectcolor(ground,50,10,150,255)
caja=createobjectbox(5,5,5):setobjectposition(caja,10,2.5,20):setobjectcolor(caja,200,10,10,255)
Player = CreateObjectBox(2, 6, 2):SetObjectPosition(Player, 0, 3, 2):SetCameraRotation(1, 0, 0, 0)
if getdevicewidth()=800 //800*600
aw#=2.0
ay#=2.0
endif
if getdevicewidth()=917 //1024*768
aw#=4.312143 //not easy
ay#=9.480632
endif
w#=(getdevicewidth()/100.0)/aw#+50
h#=(getdeviceheight()/100.0)/ay#+50
do
if k(87) then movecameralocalz(1,1)
if k(83) then movecameralocalz(1,-1)
if k(68) then movecameralocalx(1,1)
if k(65) then movecameralocalx(1,-1)
grabx#=0
graby#=0
grabx#=((w#-getrawmousex())/2.0)
graby#=((h#-getrawmousey())/2.0)
camy#=wrapvalue(camy#-grabx#)
camx#=wrapvaluex(camx#-graby#)
SetRawMousePosition(w#, h#)
setcamerarotation(1,camx#,camy#,0)
if getrawkeypressed(27) then end
sync()
loop
//so long to write and rewrite ;). My function k()
function k(a)
b=getrawkeystate(a)
endfunction b
//SoftMotion3D functions. thanks!!
function wrapvalue(a#)
while a#<0 or a#>360
if a#<0 then a#=a#+360
if a#>360 then a#=a#-360
endwhile
endfunction a#
function wrapvaluex(a#)
//while a#<-90 or a#>90
if a#<-88 then a#=-88
if a#>88 then a#=88
//endwhile
//no actual wrap just limits since agk hangs at 90 deg
endfunction a#
WASD AND MOUSELOOK TO WORK IN VIRTUAL PIXELS:
//based in softmotion3d and aviles22 code posted in APPGAMEKIT forums
//to work with virtual pixels:
setvirtualresolution(1024,600)
SetRawMouseVisible(0)
Ground = CreateObjectPlane(128, 128):RotateObjectGlobalX(Ground, 90):setobjectcolor(ground,50,10,150,255)
caja=createobjectbox(5,5,5):setobjectposition(caja,10,2.5,20):setobjectcolor(caja,200,10,10,255)
Player = CreateObjectBox(2, 6, 2):SetObjectPosition(Player, 0, 3, 2):SetCameraRotation(1, 0, 0, 0)
do
if k(87) then movecameralocalz(1,1)
if k(83) then movecameralocalz(1,-1)
if k(68) then movecameralocalx(1,1)
if k(65) then movecameralocalx(1,-1)
grabx#=0
graby#=0
grabx#=(512-getrawmousex())/2.0
graby#=(300-getrawmousey())/2.0
camy#=wrapvalue(camy#-grabx#)
camx#=wrapvaluex(camx#-graby#)
SetRawMousePosition(512, 300)
setcamerarotation(1,camx#,camy#,0)
if getrawkeypressed(27) then end
sync()
loop
function k(a)
b=getrawkeystate(a)
endfunction b
function wrapvalue(a#)
while a#<0 or a#>360
if a#<0 then a#=a#+360
if a#>360 then a#=a#-360
endwhile
endfunction a#
function wrapvaluex(a#)
//while a#<-90 or a#>90
if a#<-88 then a#=-88
if a#>88 then a#=88
//endwhile
//no actual wrap just limits since agk hangs at 90 deg
endfunction a#
More solutions like jump, "jumping" at walking ("comportamiento de salto", in spanish) and move down are wellcomes!!!
--
edler
AppGameKit forum in Spanish, yet!