Jump to content


Photo

Using views and viewing text


  • Please log in to reply
3 replies to this topic

#1 StudioGilliam

StudioGilliam

    GMC Member

  • GMC Member
  • 55 posts
  • Version:GM8

Posted 13 May 2012 - 01:16 AM

There are two views in my room.
View0 follows the player and the 320x240 space around it. View0 fills the whole screen.
View1 shows the whole level, is squashed down and sits in a bottom corner of the screen.
It's a bit messy, but who cares at this point?

A controller object draws text at view_xview[0]+16, view_yview[0]+16
So it follows the player around - appearing to be static to the user.
However, this text also appears on view[1] - and you can see it moving around relative to the room.

Is it possible to make Game Maker only display the text in view[0] and not view[1]?
I'm just using a simple draw_text() function at the moment.
I'm aware that there are other ways of displaying information like this - something about creating a virtual layer... I don't know, I haven't read about it in years.
Maybe that'll work?

What do you think?

Thank you for you help.
  • 0

#2 Fihrilkamal

Fihrilkamal

    GMC Member

  • GMC Member
  • 348 posts

Posted 13 May 2012 - 02:06 AM

I heard somewhere that we can use view_current to draw different HUD on each view, but I never tried it before.
  • 0

#3 TheouAegis

TheouAegis

    GMC Member

  • GMC Member
  • 4710 posts
  • Version:GM8

Posted 13 May 2012 - 02:42 AM

GM cycles through each view and draws the game twice for each view. So use

if view_current=0
{
draw_text(...);
whatever else
}

To make your game run better, you might want to put that in every object to prevent it from being drawn in view[1]. But then you'd have to use draw_sprite_ext() or draw_self() (one reason to get GM8.1) for all the objects. There may be a better way though and hopefully someone will say what that is.
  • 0

#4 StudioGilliam

StudioGilliam

    GMC Member

  • GMC Member
  • 55 posts
  • Version:GM8

Posted 13 May 2012 - 10:03 AM

GM cycles through each view and draws the game twice for each view. So use

if view_current=0


Awesome, thanks for that.
I just noticed Sasino97 started a topic entitled "Draw in a view, but only in that view?"
So... Pretty much exactly what I was doing here, then.
Whatever, I'll go read his identical topic anyway -_-

EDIT:
Haha - exactly the same answer as here - although the answer here was probably more helpful because of the reference to draw_self()
I gotta upgrade at some point >.<

Edited by StudioGilliam, 13 May 2012 - 10:06 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users