Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by madpower2000. 07/22/26 10:56
ZorroGPT
by TipmyPip. 07/21/26 17:54
New Zorro version 3.11
by jcl. 07/21/26 13:42
Lapsa's very own thread
by Lapsa. 07/18/26 13:40
Purchase A8 full licence version
by ukgamer. 07/17/26 05:52
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (TipmyPip, madpower2000, VoroneTZ, 1 invisible), 1,591 guests, and 19 spiders.
Key: Admin, Global Mod, Mod
Newest Members
riggi89, shuhari, KD1990, Ephraim, Student_64151
19223 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 | 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