Jump to content


Photo

Rotating Score/Energy Meters with View


  • Please log in to reply
3 replies to this topic

#1 SuperNESFreak

SuperNESFreak

    GMC Member

  • New Member
  • 32 posts

Posted 14 May 2011 - 03:46 PM

Okay, I know it's a double post. I thought it'd be better to keep these two issues separate.

I always wanted to have the camera going in the direction your player is facing, but the problem is that the score and HUD doesn't display with the view. So, how would I do this?

This picture illustrates it better than I can describe.

Posted Image

The bar should be on the top of the screen.
  • 0

#2 DanRedux

DanRedux

    GMC Member

  • GMC Member
  • 1332 posts
  • Version:GM:Studio

Posted 14 May 2011 - 03:55 PM

Easiest way? A second view, on top, in which you draw your hud. Some problems arise, such as your second view re-drawing everything, such as the backgrounds. You have to do a view_current check in your draw event to see wether to draw the Stuff or the HUD.

Alternative? Use the rotation scripts such as draw_text_ext, to counteract rotation. You also need to counteract the positional rotational, so instead of drawing text at 5, 5, you'd have to "rotate" 5, 5, around 320, 240, which is:

x_hud = x + x * cos( -view_angle ) - y * sin( -view_angle )
y_hud = y + x * sin( -view_angle ) + y * cos( -view_angle )

x, y are where you WANT to draw. x_hud, y_hud are where they appear on the hud. You also have to account for the view position..
  • 0

#3 SuperNESFreak

SuperNESFreak

    GMC Member

  • New Member
  • 32 posts

Posted 14 May 2011 - 04:43 PM

Okay. So how do I stop the background from drawing on the second view?
  • 0

#4 SuperNESFreak

SuperNESFreak

    GMC Member

  • New Member
  • 32 posts

Posted 14 May 2011 - 05:08 PM

Nevermind, figured it out. Thanks alot!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users