Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [REQUEST] Draw HUD without affecting position  (Read 1605 times)

0 Members and 1 Guest are viewing this topic.
[REQUEST] Draw HUD without affecting position
« on: March 05, 2008, 06:41:33 pm »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
Well just to shed some light on what the title says.
I am would like to know how to draw the HUD onto the screen without the position of that sprite changing. say like the angle of view has changed, and then the HUD that was drawn is in a different part of the view.
I would like to know how to keep the HUD on one position.
Does anyone understand what I mean when I say this?

Please and thank you.
-Mewgull
Logged

Xiphirx

wat
Re: [REQUEST] Draw HUD without affecting positio...
« Reply #1 on: March 06, 2008, 05:10:58 am »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
3d or 2d?
language?
program?

you need more detail
Logged
  • For The Swarm

gm112

Re: [REQUEST] Draw HUD without affecting positio...
« Reply #2 on: March 06, 2008, 05:13:06 am »
3d or 2d?
language?
program?

you need more detail
I believe he's asking for 2d. I'm guessing since he's mentioned rotating the view.
Logged
Re: [REQUEST] Draw HUD without affecting positio...
« Reply #3 on: March 06, 2008, 11:43:55 am »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
its 2D
GML
GameMaker 7.0 Pro

Sorry, failed to mention :)
Logged

Xiphirx

wat
Re: [REQUEST] Draw HUD without affecting positio...
« Reply #4 on: March 06, 2008, 07:42:13 pm »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
draw at view_top
and view_left
there ya go
Logged
  • For The Swarm
Re: [REQUEST] Draw HUD without affecting positio...
« Reply #5 on: March 08, 2008, 12:05:11 am »
  • Fear my Blades
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 562
Code: [Select]
var dx, dy, dir, dist;
dx=view_xview[view_current]+view_wview[view_current]/2
dy=view_yview[view_current]+view_hview[view_current]/2

dir=point_direction(dx,dy,XVALUE,YVALUE)
dist=point_distance(dx,dy,XVALUE,YVALUE)

dx+=lengthdir_x(dist,dir-view_angle[view_current])
dy+=lengthdir_y(dist,dir-view_angle[view_current])

Now dx, and dy contain the X/YVALUE's adjusted to counter the current view being drawn's rotation.  Don't forget to draw your sprite/text/whatever with -view_angle[view_current] as it's angle.
Logged

I've done it (sorta)!  Bloom Lighting in GameMaker, and 3D mode too!  Check out the awesome Screen Saver.
  • Kousou Games
Re: [REQUEST] Draw HUD without affecting positio...
« Reply #6 on: March 08, 2008, 04:37:03 pm »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
Gah, its not exactly working..
I don't understaned what you're telling me to do :\

First of all, I put that code in the draw event of the HUD object I want.
Here is the code I am using:
Code: [Select]
draw_sprite_ext(sprite_index,image_index,view_xview+250,view_yview+20,1,1,view_angle[view_current],c_white,1)

var dx, dy, dir, dist;
dx=view_xview[view_current]+view_wview[view_current]/2
dy=view_yview[view_current]+view_hview[view_current]/2

dir=point_direction(dx,dy,250,20)
dist=point_distance(dx,dy,250,20)

dx+=lengthdir_x(dist,dir-view_angle[view_current])
dy+=lengthdir_y(dist,dir-view_angle[view_current])
Logged
Re: [REQUEST] Draw HUD without affecting positio...
« Reply #7 on: March 09, 2008, 12:03:44 am »
  • Fear my Blades
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 562
>_<

You're supposed to use dx and dy as the coordinates for drawing your sprite afterwards, and the angle for the sprite is negative view_angle[view_current]

Code: [Select]
var dx, dy, dir, dist;
dx=view_xview[view_current]+view_wview[view_current]/2
dy=view_yview[view_current]+view_hview[view_current]/2

dir=point_direction(dx,dy,view_xview+250,view_yview+20)
dist=point_distance(dx,dy,view_xview+250,view_yview+20)

dx+=lengthdir_x(dist,dir-view_angle[view_current])
dy+=lengthdir_y(dist,dir-view_angle[view_current])

draw_sprite_ext(sprite_index,image_index,dx,dy,1,1,-view_angle[view_current],c_white,1)
Logged

I've done it (sorta)!  Bloom Lighting in GameMaker, and 3D mode too!  Check out the awesome Screen Saver.
  • Kousou Games
Re: [REQUEST] Draw HUD without affecting positio...
« Reply #8 on: March 09, 2008, 04:57:25 am »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
It works now! thanks :)
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.28 seconds with 52 queries.

anything