Math

Kohaku's picture

Distance based hiding

0
No votes yet
sync on
sync rate 30
 
`Place somewhere at the start
Global DH# : DH# = 15
 
make object cube 1, 10
 
do
 
	if upkey()
		move camera 1
	endif
 
	if downkey()
		move camera -1
	endif
 
Kohaku's picture

2D collision detection

0
No votes yet
rem Standard Setup Code
sync on : sync rate 60
set text font "arial" : set text size 12 : set text transparent
 
box1width = 50
box1height = 50
 
box2x = 220
box2y = 220
box2width = 300
Kohaku's picture

3D distance

0
No votes yet
function Distance3D(x1,y1,z1,x2,y2,z2)
	result#=sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2)
endfunction result#
Kohaku's picture

Continue value

0
No votes yet
function continueValue(valueA as float, valueB as float)
	valueC as float
	if valueB > valueA
		valueC = valueB + (valueB - valueA)
	else
		valueC = valueB - (valueA - valueB)
	endif
Kohaku's picture

Rotate object to point

0
No votes yet
function rotateObjectToPoint(obj, turnSpeed, x, y, z)
 
	//store old rotate
	oldXa as float
	oldYa as float
	oldZa as float
	diff as float
 
	oldXa = wrapvalue(object angle x(obj))

Syndicate content