Jump to content


Photo

Are views faster than steps?


  • Please log in to reply
6 replies to this topic

#1 yvesnadjarian

yvesnadjarian

    GMC Member

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

Posted 09 June 2012 - 07:26 PM

Hi everyone...


Im try to create a HUD that follows the room view.
The view follows the player.


But when updating the coordinates of my HUD to the view its not all instantaneous... when the view gets too fast following the player
the HUDs keep staying behind... when only when the view stops the huds reach the final destination.

Any ideas?
  • 0

#2 Rhodox

Rhodox

    GMC Member

  • GMC Member
  • 132 posts

Posted 09 June 2012 - 08:09 PM

Yes, there is a time difference between view(draw event) and step event
maybe try moving the HUD code to the draw event
  • 0

#3 yvesnadjarian

yvesnadjarian

    GMC Member

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

Posted 09 June 2012 - 08:36 PM

Yep... I´ve done this...

for android I´ve created a virtualkey in the same place of the sprite (my HUD has a button)
but how can I make it for windows?
  • 0

#4 Nightelf Productions

Nightelf Productions

    GMC Member

  • New Member
  • 70 posts

Posted 09 June 2012 - 08:37 PM

This happens because (I assume) you use a HUD object that changes it's coordinates to the view's coordinates every step. First off, if I remember correctly that should fix if you put your coordination code in the End Step event, however I'd recommend going for a different approach. Instead of having different objects for your HUD, try to put it in a general control object or something of the type where you control stuff "offscreen" (such as statistics, settings, etc.) and have that object draw the HUD in it's Draw event whenever a player is present within the room (check with if instance_exists(yourplayerobjectnamehere){} ). In the long run it helps to have as less objects (in the room) as possible.

Edit: Don't forget to set the controller's depth to something very low (-1000000 is the depth of standart GM particle effects when they are set to appear "above all")

Edited by Nightelf Productions, 09 June 2012 - 08:44 PM.

  • 1

#5 SamBaylus

SamBaylus

    GMC Member

  • GMC Member
  • 89 posts

Posted 09 June 2012 - 08:58 PM

Put it in your END STEP event.
  • 1

#6 yvesnadjarian

yvesnadjarian

    GMC Member

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

Posted 09 June 2012 - 10:45 PM

Thank you all!!
  • 0

#7 2Dcube

2Dcube

    Programming sucks

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

Posted 10 June 2012 - 12:33 AM

Also, you don't have to update the HUD's position if you just draw it at (view_xview,view_yview)
  • 1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users