Jump to content


Photo

displaying time


  • Please log in to reply
3 replies to this topic

#1 wisdom27gm

wisdom27gm

    GMC Member

  • New Member
  • 40 posts
  • Version:GM8

Posted 29 July 2012 - 10:32 AM

Hi,
I am tring to display the time on the screen using GML only ..I am not sure where to write the codes. :sad:
could anyone help ?
Thanks.
  • 0

#2 drt_t1gg3r

drt_t1gg3r

    GMC Member

  • GMC Member
  • 3230 posts
  • Version:Unknown

Posted 29 July 2012 - 10:48 AM

initialize are your time variables in the create event
start_time = date_current_time();
end_time = start_time;
elapsed_time = end_time - start_time;

update all your time variables in the step event
end_time = date_current_time();
elapsed_time = end_time - start_time;

draw all your time variables in the draw event
draw_text( someX, someY, "Elapsed Time: " + string( elapsed_time ) ):
  • 1

#3 wisdom27gm

wisdom27gm

    GMC Member

  • New Member
  • 40 posts
  • Version:GM8

Posted 29 July 2012 - 11:05 AM

initialize are your time variables in the create event
start_time = date_current_time();
end_time = start_time;
elapsed_time = end_time - start_time;

update all your time variables in the step event
end_time = date_current_time();
elapsed_time = end_time - start_time;

draw all your time variables in the draw event
draw_text( someX, someY, "Elapsed Time: " + string( elapsed_time ) ):


Thanks for your reply..
But All I can see is 0:00 on the screen.. it doesnt work..
Another question is " initialize are your time variables in the create event of which object ?"
  • 0

#4 Koaske

Koaske

    GMC Member

  • GMC Member
  • 383 posts
  • Version:GM8

Posted 29 July 2012 - 11:22 AM

Put all that code in create/step/draw events of the same object. It can be any object, really, but I think you want to use the object that is actually displaying the time. For example, if you have a HUD object and you want to display the time there, put all that code in the HUD object.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users