Raised This Month: $ Target: $400
 0% 

player origin / map width / map height


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lady_in_red
Junior Member
Join Date: Dec 2004
Old 01-26-2005 , 09:24   player origin / map width / map height
Reply With Quote #1

ok my script gets this :

get_user_origin(player[i],pos,0)

i get the x,y,z coord for the player in the pos array, but i need to map this values to a 1024x768 image (or any other size) ... but im confused geting negative values for y ... plz help me map the coord in game with the cood on image(x,y)
lady_in_red is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 01-26-2005 , 15:21  
Reply With Quote #2

Well, you need to use a coordinate plane for your image. You do this by declaring an arbitrary place in the picture 0,0. It should be the exact middle of the picture you want. Lets say the REAL value is 400,300, for an 800 by 600 image.

Now, this could be like a constant;
new const fakecenter_x = 400
new const fakecenter_y = 300

Ok, so you have the exact center, and your fake center, stored into a constant.

Now its relatively easy to do calculations for this picture!
lets say you want to map the dot (100,-100)
Well, you do all you have to do to send the dot, and the coordinates for where you would send it are as follows:
new send_x = fakecenter_x + 100
new send_y = fakecenter_y + (-100)

Then, send_x and send_y are where the dot should be in the picture.

Why does this work? Since the fakecenter is really the actual center, subtracting or adding to it will work as if it was a cartisian grid, just like HL.

You'll have to work out how to do Z's though.... Dont ask me on that one.

So, essentially, this is what you'll have to do:

// globals
new const fakecenter_x = 400
new const fakecenter_y = 300

public grid_it(x,y){
x += fakecenter_x
y += fakecenter_y
return 1;
}

and that should change the HL origins into something you can use with an image.
change the constants for different image sizes.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode