Here's what the code looks like in the step event of the player:
//centering the player view_xview = (x + 220 * cos(degtorad(direction))) - 400; view_yview = (y - 220 * sin(degtorad(direction))) - 300; //view angle view_angle = -direction + 90;
Now, I have implemented a HUD (health bar, attack meters, etc) which both looks and performs great on its own view plane.
// Draw HUD d3d_set_projection_ortho(0,0,view_wview,view_hview,0); d3d_set_projection_ortho( view_xview,view_yview,view_wview,view_hview,view_a ngle);
Now if I have any object in the game world and I want to know its x and y position as it correlates to the HUD's view, how would I figure this out?
For example, you see a goblin. This goblin has both an x and y position inside the gameworld. By hovering the mouse over the goblin a text box appears giving you details about him (health, stats, etc). This text box should be inside the view of the HUD and appear over the goblin on screen. Let's say the goblin's x, y values are 1500, 600 respectively. Due to the rotating view (based on the player location and angle), the goblins location on the HUD view might be 200, 400. How would I pinpoint this 200, 400 location?
Currently, I use the draw_text_transformed function to draw the information in the game world view (NOT the HUD view) then rotate it to the player's direction. This makes the text sometimes fuzzy or "shake" a little bit, and not to mention it disallows me use of the some the draw_rect functions I intend to use as a textbox border. However, it does "work".
I tried to explain this the best I can, If you need code or an executable example let me know, I'd be happy to provide.
Thanks in advance, guys!
Edited by Revixter27, 07 March 2009 - 02:06 PM.



This topic is locked







