on-screen entity

Posted By: sheefo

on-screen entity - 06/29/07 18:08

How can I calculate the X position of an on-screen entity to make it fit relative to the pixels? So, if my on-screen entity sprite is a file named 'sprite.bmp' which is 512x512, what would the X position have to be for it to take up 512x512 pixels on screen?

I would appreciate any help
Posted By: mpdeveloper_B

Re: on-screen entity - 06/29/07 18:35

you'd have to play around with it, it will most likely be about x: 600 or so, just continually change the value and test it, or set up a variable, and set a key to increase the variable and set the x value of the entity to the variable, like this:

Code:

var temp_x = 512; //512 as the starting value, so it doesn't take you forever

panel temp_
{
digits (0,0,3, _a4font, 1, temp_x);
flags = visible;
}

entity entity_name
{
type = "name_of_pic.tga";
flags = visible;
}

starter entity_name
{
while (1)
{
entity_name.x = temp_x;
wait(1);
}
}

function increase_x
{
temp.x += 1;
}

on_1 = increase_x;



this way all you have to do is press the 1 key and it will move it increase the entity's x by 1 each time, and the panel in the upper left corner, will show you what the number is set to, all you have to do is put that number as your entity's x value.
Posted By: sheefo

Re: on-screen entity - 06/29/07 19:20

From testing it your way I found that 975 works OK. I tested it on 177x177 and 52x52 sprites as well. I thought it would be variable.

What about the Y and Z for the screens x and y coordinates? How can I convert screen coordinates to on-screen entity ones?
Posted By: mpdeveloper_B

Re: on-screen entity - 06/30/07 03:21

if you need to stretch the image use it's scale factors, like scale_x should stretch it long ways <-->, so you could get it to fit just right...

when you make an entity using this:

entity name
{
type = <type.mdl>;
}

then it is already in screen coordinates, z will move it up and down on the screen and y will move it left and right, or do you mean converting on-screen entity coordinates to world entity coordinates?
Posted By: sheefo

Re: on-screen entity - 06/30/07 11:39

I wanted the on-screen entity to act like a panel, so I wanted to convert screen coordinates to on-screen entity coordinates. Any ideas?
Posted By: mpdeveloper_B

Re: on-screen entity - 06/30/07 14:37

all i can tell you is what i had to do, you'll just have to play around with the panels, moving them a bit in order to get them right, that's all i COULD do and it will take a while like that, but you can't help that...
© 2023 lite-C Forums