Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, VoroneTZ), 740 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Handy DEBUG_VEC function #455738
10/28/15 19:21
10/28/15 19:21

M
Malice
Unregistered
Malice
Unregistered
M



Code:
function DEBUG_VEC(VECTOR* vec, var p_pos, var p_offset)
{
	DEBUG_VAR(vec.x,p_pos);
	DEBUG_VAR(vec.y,p_pos+p_offset);
	DEBUG_VAR(vec.z,p_pos+(p_offset*2));
}



Call and pass a vector, pass the start y-pixel of the first vec.member, pass the y-pixel offset between each vec.member.
Example
Code:
action player_act()
{

.....
while(1)
{
 my.x+= 5*time_step;
 my.y-=5*time_step;
DEBUG_VEC(my.x,100,25);
wait(1);
}
}



Hope this is helpful, It sure is for me...

Game-On, lol
Mal

Last edited by Malice; 10/28/15 19:21.
Re: Handy DEBUG_VEC function [Re: ] #455740
10/28/15 19:32
10/28/15 19:32
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Probably the most used function in my isometric game:
Code:
void draw_num3d(var num, VECTOR* pos, var offset, VECTOR* color, var flags)
{
	VECTOR temp;
	temp.x = ((pos.x-camera.x)/camera.right*0.5+0.5)*screen_size.x;
	temp.y = ((pos.z-camera.z)/camera.bottom*0.5+0.5)*screen_size.y;
	temp.z = 0;
	draw_text2(str_for_num(NULL,num),temp.x,temp.y+offset,color,flags);
}
...
	draw_num3d(my.skill80,my.x,00,COLOR_RED,SHADOW);
	draw_num3d(my.skill59,my.x,20,COLOR_WHITE,SHADOW);
	draw_num3d(my.skill78,my.x,40,COLOR_GREEN,SHADOW);



Super handy but in its state obviously unusable for most other projects. Something like the following should work and help though (untested):

Code:
void draw_num3d(var num, VECTOR* pos, var offset, VECTOR* color)
{
	VECTOR temp;

	vec_set(temp,pos);
	if(vec_to_screen(temp,camera))
	{
		draw_text(str_for_num(NULL,num),temp.x+1,temp.y+offset+1,COLOR_BLACK);
		draw_text(str_for_num(NULL,num),temp.x,temp.y+offset,color);
	}
}



"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Handy DEBUG_VEC function [Re: Superku] #455746
10/28/15 20:21
10/28/15 20:21

M
Malice
Unregistered
Malice
Unregistered
M



^ Awesome !! Thanks, I'll add these to my lib functions and hack them for the VECTOR versions..


Moderated by  HeelX, Lukas, Rei_Ayanami, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1