some functions like blitz3d

Started by Santiago, May 20, 2020, 19:48:44

Previous topic - Next topic

Santiago

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.





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

RemiD

#1
ahahah cool functions names :D , the blitz syntax is the simplest to understand isn'it.

it could be a way to learn the language and to convert bb code into agk code.

'Patmaba' did a similar wrapper for unity (blitz-like functions names for unity), i started to convert a project but i had issues with collisions, so in the end i used only raypick and my own collisions detections and repositioning system, (same for blitz3d).

Alienhead

I started working on a godot to Blitz3d wrapper about a year ago, I stopped when they said godot 4.0 was right around the corner.. of course it still hasnt released..  In that time I found a different engine to use and lost interest in godot and the wrapper :(

Here's what i had got completed before stopping:

extends Spatial

completed // returns OS time in millisecs()
func millisecs():

completed // position object in global 3d space ( global )
func positionentity(ent, x:float, y:float, z:float, tween:float=0.0):

completed // move object in x/y/z direction ( global )
func moveentity(ent, x:float, y:float, z:float, tween:float=0.0):

completed // rotate object x/y/z axis ( global )
func rotateentity(ent, x:float, y:float, z:float, tween:float=0.0):

completed // turn object on x/y/z axis ( global )
func turnentity (ent, x:float, y:float, z:float, tween:float=0.0):

func smoothpointentity(ent, ent2, speed, delta):

completed // points an object towards another object ( global )
func pointentity (ent, ent2 ):

completed // scale an object on x/y/z axis ( global )
func scaleentity(ent, x:float, y:float, z:float, tween:float=0.0):

completed // returns objects X position in 3d space ( global )
func entityx(ent):

completed // returns objects Y position in 3d space ( global )
func entityy(ent):

completed // returns objects Z position in 3d space ( global )
func entityz(ent):

completed // returns objects X axis degree in -180, 180 degrees
func entitypitch(ent):

completed // returns objects Y axis degree in -180, 180 degrees
func entityyaw(ent):

completed // returns objects Z axis degree in -180, 180 degrees
func entityroll(ent):

completed // set the r, g, b color of an object ( 255,255,255 = white )
func entitycolor(ent, r, g, b):

completed // hides and object
func hideentity(ent):

completed // shows an object
func showentity(ent):

func entityalpha(ent, alpha:float):

3DzForMe

That's an extensive list there, good work!
BLitz3D, IDEal, AGK Studio, BMax, Java Code, Cerberus
Recent Hardware: Dell Laptop
Oldest Hardware: Commodore Amiga 1200 with 1084S Monitor & Blitz Basic 2.1