Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
rockethippo
4
Years of Service
User Offline
Joined: 25th Nov 2014
Location: Canada
Posted: 17th Feb 2015 06:28
I'm trying to display the amount of time a button has been held down. I want to show this time in 3 ways:
1.A live timer for when the button is being held down.
2.A highscore style display
3. Duration of last attempt

I'm currently using (button is 4):

if GetVirtualButtonState(4)=1
GetRawFirstTouchEvent(1)
print(GetRawTouchTime(1))
endif

I want to adjust properties of the text of the timer but I don't think I can do that if the timer is created by the print command. I also have no idea how to use the results of the timer to create a high score and duration of last attempt.

Thank you! Any help is appreciated!
paulrobson
4
Years of Service
User Offline
Joined: 22nd Nov 2014
Location: Norfolk, England
Posted: 17th Feb 2015 10:44
I would use a createtext object to show your timer rather than Print. These will appear automatically whereas Prints have to be done every frame.
rockethippo
4
Years of Service
User Offline
Joined: 25th Nov 2014
Location: Canada
Posted: 18th Feb 2015 04:45
I'm not sure how to go about using createtext to show the timer.
BatVink
Moderator
16
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Feb 2015 12:06 Edited at: 18th Feb 2015 12:07
You can copy and paste this, and it will run.
Checkout the text commands in the help files for all the other things you can do with text (Size, colour etc)



Quidquid latine dictum sit, altum sonatur
paulrobson
4
Years of Service
User Offline
Joined: 22nd Nov 2014
Location: Norfolk, England
Posted: 20th Feb 2015 09:37
CreateText() is slightly confusing, because most people think of text as something that is "printed", they link it in their mind with Print()

"Text" objects in AppGameKit are actually pretty much the same as Sprite objects. You create one, tell it where you want it, what you want it to look like.

They are rendered to the display during Sync(), so once you've created it (see Batvink's example) you don't have to do anything with it to make it appear, just change its looks (or in this case the text) to suit.

Print() in AGK2 is completely different. I would actually recommend not using this at all, except perhaps for debugging.

Using the print() to display scores looks a bit amateurish and it's really easy to replace it with a nice font and you get much more control regarding how big it is, where it goes and you can animate it and so on.
rockethippo
4
Years of Service
User Offline
Joined: 25th Nov 2014
Location: Canada
Posted: 22nd Feb 2015 02:50 Edited at: 22nd Feb 2015 05:31
BatVink,

What that currently does is create timer text on top of itself refreshed every sync. So it shows a \"1\" then a \"2\" on top of it and so on.

Thanks for the help so far guys!

Edit: I figured it out and it's working. Thanks again!!

Login to post a reply

Server time is: 2019-08-20 05:09:23
Your offset time is: 2019-08-20 05:09:23