2 Questions dealing with TIME...
gamesfua
Member Posts: 723
Hey all I've got two questions I'm hoping you can help me with.
1.) I want to be able to alert the player to how long they've played the game (when they lose). So Obviously there needs to be some kind of trigger when they hit the PLAY GAME button, and then read out the time when the LOSE THE GAME. More importantly, whatever solution you provide, can you tell me how much of a hit my game will take performance wise from the solution. I'm hoping for a very low impact solution. I.E. not something that is constantly constraining (if possible).
2.) How would I make something like a laundry timer. Give you an example. Let's say I go to a laundromat and I put my clothes in. The current time is 12:15. Let's say my app helps you know when to return to pick up your clothes. So let's say the laundry machine says 45 minutes. Well, you'd be able to enter in 45 and then the app looks at the current time (12:15) and then says "come back at 1" Don't worry I'm not asking how to make alerts, or how to display text, etc. that says when to come back. I'm strictly talking about the code. A code that knows how to deal with minutes and seconds, and add or subtract that from the current time.
Thanks so much you all!
1.) I want to be able to alert the player to how long they've played the game (when they lose). So Obviously there needs to be some kind of trigger when they hit the PLAY GAME button, and then read out the time when the LOSE THE GAME. More importantly, whatever solution you provide, can you tell me how much of a hit my game will take performance wise from the solution. I'm hoping for a very low impact solution. I.E. not something that is constantly constraining (if possible).
2.) How would I make something like a laundry timer. Give you an example. Let's say I go to a laundromat and I put my clothes in. The current time is 12:15. Let's say my app helps you know when to return to pick up your clothes. So let's say the laundry machine says 45 minutes. Well, you'd be able to enter in 45 and then the app looks at the current time (12:15) and then says "come back at 1" Don't worry I'm not asking how to make alerts, or how to display text, etc. that says when to come back. I'm strictly talking about the code. A code that knows how to deal with minutes and seconds, and add or subtract that from the current time.
Thanks so much you all!
Best Answer
-
Socks London, UK.Posts: 12,822
If my question is- how can i get a time in and time out marker- then the answer you gave wasnt an answer (as i have no control-which i need over it).
There's no need for us to hypothesise about what your question was ('if it was this . . or if it was that . . . '), it's right there in your first post:
" . . . I want to be able to alert the player to how long they've played the game . . ."
My answer ("Just use Game.time") is perfectly valid.
It also didn't answer the second part of the question (laundry question).
I wasn't addressing the second part of your question, but generally speaking I'd assume that pointing out that you can use game.time to measure time would answer all these related questions - with a little work from your end.
But I'll spell it out in simple terms:
Record the start time into an attribute.
When the game is over subtract the start time from the current time.
The result is how long it's been since you recorded the start time.
I'll try and find my answer in another way.
The way you are doing it is perfectly good, ask questions here, I'd just avoid getting pissed off if you don't like the tone of an answer or feel the person who took the time to reply hasn't made enough of an effort for you.
Answers
You have been playing for . . .
Game.time
. . . go get a life.
None, nothing, zero, zilch. The clock runs whether you use it or not, so there is no performance hit.
Seriously, it starts when the game starts - and you can't stop it (although the wizards can), but why would you want to stop it anyway ? The 24 hour clock we use every day is good enough to time the world around us and events within it and we never need to stop that to measure time.
http://forums.gamesalad.com/discussion/52371/reset-gametime-and-gamecounter-to-zero#latest
You fool, you will get everyone killed with your crazy ideas.
P.S (love the 'that's fine' bit on the end) : )
I answered the question, but I will repeat it here for you:
"it starts when the game starts - and you can't stop it " There was no sarcasm in my posts, there was humour, any interpretation of sarcasm was entirely yours. There are no 'endless replies' - I replied to you twice, both times answering your question, I also replied to PaxPax (once) with a humorous reply.
You need to chill out a little, people aren't here to jump to your every whim (or anyone else's), people answer questions and help out because they like to, out of the kindness of their hearts - it seems like you feel you have the right to have your questions answered promptly and in the style you are accustomed to, free of humour.
?
Would you like me to remove my post to Paxpax, and edit out the humour in my two replies to you, I can do so if it would make you feel better, no hassle, 30 seconds work ?
You can also reference the target device's clock (Hour / Minute / Second).
You can't start or stop game.time. Just use basic maths, game.time is measured in seconds so you want to be looking at [divide by] 60 for minutes.
Or . . use the device's own clock and apply basic addition / subtraction from your stored start time.