May 31, 2020, 09:33:05 PM

Author Topic: some functions like blitz3d  (Read 117 times)

Offline Santiago

  • Full Member
  • ***
  • Posts: 215
  • Blitz3d
    • Indiesoft
some functions like blitz3d
« on: May 20, 2020, 07:48:44 PM »
hi, in my way to using agk, i write some function to acelerate the learning procces.

i found that there is no mousedown(2) or mousehit(2), or mousezspeed() like blitz3d have. (SOLVED)
GetRawMouseRightPressed :),  i found it :)

i write and i use update_mouse() function, because for me, in the loops is more easy use MX or MY for mouse position, and mxs# or mys# for mousespeed.

i share this function, i hope is usefull for someone.




Code: [Select]
function key_press()

//Scancode Retriever
print ("KEY Code: "+   str(GetRawLastKey()))


endfunction

global mxs#  // mouse speed
global mys#
global mzs#  //┬┐how can i get this is agk?
global mx#   // mouse position
global my#
global mhl  // mouse hit
global mhr
global mhc   
global mdl  // mouse button pressed
global mdr
global mdc

function update_mouse()

mxs# = getPointerX() - mx#
mys# = GetPointery() - my#

mx# = GetPointerX()
my# = GetPointery()

mhl = getpointerpressed()   //mouse button(1)
mdl = GetPointerState()


endfunction

function pos(origen,destino)  //position one object uting another object position

x# = getobjectx(destino)
y# = getobjecty(destino)
z# = getobjectz(destino)

SetObjectPosition(origen,x#,y#,z#)

endfunction

function rot(origen,destino)

x# = GetObjectAngleX(destino)
y# = GetObjectAngley(destino)
z# = GetObjectAnglez(destino)

SetObjectRotation(origen,x#,y#,z#)

endfunction

function positionentity(entidad,x#,y#,z#)

SetObjectPosition(entidad,x#,y#,z#)

endfunction


function translateentity(entidad,x#,y#,z#)

x# = x# + getobjectx(entidad)
y# = y# + getobjectx(entidad)
z# = z# + getobjectx(entidad)

SetObjectPosition(entidad,x#,y#,z#)

endfunction


function pointentity(origen,destino,roll#)

SetObjectLookAt(origen,GetObjectX(destino),GetObjectY(destino),GetObjectZ(destino),roll#)

endfunction

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal