Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by AndrewAMD. 12/05/23 10:56
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 622 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
on-screen entity #138833
06/29/07 18:08
06/29/07 18:08
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
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

Re: on-screen entity [Re: sheefo] #138834
06/29/07 18:35
06/29/07 18:35
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
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.

Last edited by Manslayer101; 06/29/07 18:37.

- aka Manslayer101
Re: on-screen entity [Re: mpdeveloper_B] #138835
06/29/07 19:20
06/29/07 19:20
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
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?

Re: on-screen entity [Re: sheefo] #138836
06/30/07 03:21
06/30/07 03:21
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
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?

Last edited by Manslayer101; 06/30/07 03:22.

- aka Manslayer101
Re: on-screen entity [Re: mpdeveloper_B] #138837
06/30/07 11:39
06/30/07 11:39
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
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?

Re: on-screen entity [Re: sheefo] #138838
06/30/07 14:37
06/30/07 14:37
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
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...


- aka Manslayer101

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, 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