Gamestudio Links
Zorro Links
Newest Posts
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
0 registered members (), 1,094 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
display XYZ to screen #292585
10/05/09 00:25
10/05/09 00:25
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Hello,
I would like to displayed the XYZ of a object on the screen as it move around the map. I know I have to use str_cpy and STRING.
what code do I need to put in the string.
some thing like vec player (x,y,z)

Thank you
renny

p.s. I know that you can see that by pressing I think f11 two time. I need it to be on the screen all the time.


I have A7 Commercial .............. Now I just need to learn how to use it

Re: display XYZ to screen [Re: sadsack] #292642
10/05/09 15:12
10/05/09 15:12
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Look into the manual for more information:

VECTOR object_pos;

PANEL* pnl_show_xyz = {
digits(20,20,5,*,1,object_pos.x);
digits(20,40,5,*,1,object_pos.y);
digits(20,60,5,*,1,object_pos.z);
flags = SHOW;
layer = 1;
}

function update_position_startup() {
while(!player) { wait(1); }
while(player) {
vec_set(object_pos,player.x);
wait(1);
}
}

should work.


"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: display XYZ to screen [Re: Superku] #292649
10/05/09 17:30
10/05/09 17:30
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Thank you H.F.Pohl
renny


I have A7 Commercial .............. Now I just need to learn how to use it

Re: display XYZ to screen [Re: Superku] #292656
10/05/09 19:08
10/05/09 19:08
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Hello H.F.Pohl,

I been trying to make you code work for a hour or more, it will not compile.
I may not have it in the right place. here what I been working on CODE:

Code:
#include <acknex.h>
#include <default.c>


ENTITY*player1;


function update_position_startup();

VECTOR object_pos;


PANEL* pnl_show_xyz = {
digits(20,20,5,*,1,player1_pos.x);
digits(20,40,5,*,1,player1_pos.y);
digits(20,60,5,*,1,player1_pos.z);
flags = SHOW;
layer = 1;
}

action act_player1();
{
player1 = me;
me.ambient = 10;
while(1)
{

   



if (key_z) {me.pan += 3*time_step;}
if (key_x) {me.pan -= 3*time_step;}
if (key_a){c_move (me,vector( 5,0,0),nullvector,GLIDE);}
if (key_s){c_move (me,vector( -5,0,0),nullvector,GLIDE);}
if (key_q){c_move (me,vector( 0,0,1),nullvector,GLIDE);}
if (key_e){c_move (me,vector( 0,0,-1),nullvector,GLIDE);}
if (key_c) {me.tilt += 3*time_step;}
if (key_v) {me.tilt -= 3*time_step;}
if (key_r) {me.roll -= 3*time_step;}
if (key_t) {me.roll += 3*time_step;}
 	



	


wait(1);
}
}







function main()
{
	level_load ("");
	wait(2);	// wait until the level is loaded
	
	ent_create("player1.mdl", vector(500, 0, 0),act_player1);
}




function update_position_startup() {
while(!player1) { wait(1); }
while(player1) {
vec_set(object_pos,player1.x);
wait(1);
}
}



so if you have time to look at this and maybe point me to the right steps to take to make it work.
Thank You
renny


I have A7 Commercial .............. Now I just need to learn how to use it

Re: display XYZ to screen [Re: sadsack] #292657
10/05/09 19:13
10/05/09 19:13
Joined: Mar 2007
Posts: 197
Y
yorisimo Offline
Member
yorisimo  Offline
Member
Y

Joined: Mar 2007
Posts: 197
ENTITY*player1 -> ENTITY* player1


Joris Lambrecht
My Contributions: Relative Rotation, Window Sizing
Re: display XYZ to screen [Re: yorisimo] #292658
10/05/09 19:41
10/05/09 19:41
Joined: Feb 2006
Posts: 385
Oldenburg,Germany
Ralph Offline
Senior Member
Ralph  Offline
Senior Member

Joined: Feb 2006
Posts: 385
Oldenburg,Germany
This code works:
Code:
ENTITY* player1;

VECTOR* object_pos = {x=0;y=0;z=0;}


PANEL* pnl_show_xyz = {
	digits(20,20,"Player Position X=%.0f",*,1,object_pos.x);
	digits(20,40,"Player Position Y=%.0f",*,1,object_pos.y);
	digits(20,60,"Player Position Z=%.0f",*,1,object_pos.z);
	flags = SHOW;
	layer = 1;
}

function act_player1()
{
	while(!me){wait(1);}
	player1 = me;
	me.ambient = 10;
	while(me)
	{
		my.pan += 3 * (key_z-key_x) * time_step;
		my.skill1 = 5 * (key_w-key_s) * time_step;
		my.skill2 = 5 * (key_a-key_d) * time_step;
		my.tilt += 3 * (key_c-key_v) * time_step;
		my.roll += 3 * (key_r-key_t) * time_step;
		c_move (me,my.skill1,nullvector,GLIDE);
		vec_set(object_pos,player1.x);
		wait(1);
	}
}

function main()
{
	level_load ("");
	wait(2);	// wait until the level is loaded
	ent_create("cube.mdl",vector(500,0,0),act_player1);
}



Greetings Ralph

Re: display XYZ to screen [Re: Ralph] #292662
10/05/09 20:25
10/05/09 20:25
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Ralph, that code works fine.Thank you very much.


I have A7 Commercial .............. Now I just need to learn how to use it

Re: display XYZ to screen [Re: sadsack] #292683
10/05/09 23:56
10/05/09 23:56
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Hi Ralph,

Well I intergraded your code into my space game, It took a will for me to make it work, but It is working very good now. I will not get lost again in deep space Thanks to you. There is some parts of your code that I do not under stand, do you have time to tell me what the line does, well I know what the line does I just don't know how it does it?

sh...t I am on the quick reply, well maybe I still can use the code tab.
Let see:
Code:
digits(20,20,"Player Position X=%.0f",*,1,object_pos.x);


I understand what this does
Code:
digits(20,20,"Player Position


but what does this do

Code:
X=%.0f",*,1,


thank you for your help
renny


I have A7 Commercial .............. Now I just need to learn how to use it

Re: display XYZ to screen [Re: sadsack] #292687
10/06/09 00:22
10/06/09 00:22
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Hey,
Code:
digits(20,20,"Player PositionX="

writes Player PositionX= at 20, 20
Code:
%0.f",

uses c style string manipulation (and closes the string)
Code:
*,

tells the engine to use standard font (Arial#10 or Arial#12 i think)
Code:
1,

is the factor of what's displayed (change to 2 and everthing will be doubled)
Code:
object_pos.x)

obvioulsy the variable being displayed

hope this helps
(sorry to intrude) laugh

Re: display XYZ to screen [Re: MrGuest] #292732
10/06/09 13:25
10/06/09 13:25
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Thank you MrGuest,
renny


I have A7 Commercial .............. Now I just need to learn how to use it


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