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.

Newcomers AppGameKit Corner / Moving print location

Author
Message
rockethippo
9
Years of Service
User Offline
Joined: 25th Nov 2014
Location: Canada
Posted: 13th Feb 2015 22:09
Is it possible to move where the print command shows up the screen? I want it centered instead of in the upper left corner. Thanks!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 13th Feb 2015 22:50
Is this for presentation purposes in your game? If it is, you should consider using the text commands. At its most basic:

id = CreateText("Hello World")
SetTextAlignment(id,1) //centred text
SetTextPosition(id, getVirtualWidth(), getVirtualHeight) //position in middle


The help files for text will show you all of the extra things you can do, such as change font,size, colour, transparency etc.

Quidquid latine dictum sit, altum sonatur
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 14th Feb 2015 03:30
The 'print' command is pretty much for debugging. There is little control over where it shows up. And the text will not persist from frame to frame unless you print it each frame (unlike text objects).

Cheers,
Ancient Lady
paulrobson
9
Years of Service
User Offline
Joined: 22nd Nov 2014
Location: Norfolk, England
Posted: 14th Feb 2015 10:50
Yes - games that use print look really amateurish. Using a proper font gives you a bit of added pazazz with very little effort, and allow you enormous control over where everything goes. If it's for title screens and stuff, I'm working on a font effects library which should be ready sometime next week in Beta 1 which is like CreateText on acid (Will be a freebie)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 14th Feb 2015 13:06
Quote: "I'm working on a font effects library which should be ready sometime next week in Beta 1 which is like CreateText on acid (Will be a freebie)"


Sounds good, I need things like this for my bigger project. The Tweens are already helping, but I look forward to more

Quidquid latine dictum sit, altum sonatur
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 14th Feb 2015 16:35 Edited at: 14th Feb 2015 17:08
Quote: "If it's for title screens and stuff, I'm working on a font effects library which should be ready sometime next week in Beta 1 which is like CreateText on acid (Will be a freebie) "

Thanks in advance.

Quote: "Yes - games that use print look really amateurish. Using a proper font gives you a bit of added pazazz with very little effort, and allow you enormous control over where everything goes."

If I can ever wrap my head around the sprite sheet and get any custom fonts made, I will be happy to share as well.
I was going to change the default font but got confused when I saw that the sprite sheet had different sizes for each character, and I couldn't find the txt key file to cypher the cut points properly.
I was hoping for a base image that allowed for easy swap of characters.
So, instead of laying out a grid for the characters as to replace that default image, I skipped that for now and went back to coding.

Quote: "The 'print' command is pretty much for debugging. There is little control over where it shows up. And the text will not persist from frame to frame unless you print it each frame (unlike text objects)."

Yeah, that is the only time I use print.
Printing all of my variables in a list in the upper corner is very handy.
As already mentioned, the text object is the only way to position for text for display.
Don't forget the ...
SetTextString(id, string$)
... for changing the text that a particular object displays.
That way, you don't have to have separate text objects for everything you will be displaying in that location.
Set the position, then just change that string when you need to display another message.

SetTextString(id, string$) // string$ is a string variable
SetTextString(id, "string") // quotes for text not a variable
SetTextString(id, str(number)) // for converting numeric variables or values to strings for display.

The ID seen above represents the text objects id number.
The example below is setting the id as a number...

CreateText(1, "Hello")

Then I could change that to display the word World with a ...

SetTextString(1, "World")

You can add strings in that call too as in...

SetTextString(1, "Score = " + str(users_score))

Where users_score was the integer variable holding the number representing the score.


Hope that helps.


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
paulrobson
9
Years of Service
User Offline
Joined: 22nd Nov 2014
Location: Norfolk, England
Posted: 14th Feb 2015 19:03
Quote: "If I can ever wrap my head around the sprite sheet and get any custom fonts made, I will be happy to share as"


Custom fonts are straightforward to create. There is a GUI app which does the heavy lifting for you http://forum.thegamecreators.com/?m=forum_view&t=212975&b=41 and my command line version at https://github.com/agkdev which allows you to automate it.
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 14th Feb 2015 19:30 Edited at: 14th Feb 2015 19:31
Quote: "Custom fonts are straightforward to create. There is a GUI app which does the heavy lifting for you http://forum.thegamecreators.com/?m=forum_view&t=212975&b=41 and my command line version at https://github.com/agkdev which allows you to automate it. "

Thanks for the addresses to the GUI app and your command line version.
I'll check them out, and see what I can come up with.


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Greenwich
9
Years of Service
User Offline
Joined: 10th Dec 2014
Location:
Posted: 15th Feb 2015 22:53
Quote: " If it's for title screens and stuff, I'm working on a font effects library which should be ready sometime next week in Beta 1"


YESSSSSSSSSSSSSSS \(• ◡ •)/

It's mean time. *averages*
rockethippo
9
Years of Service
User Offline
Joined: 25th Nov 2014
Location: Canada
Posted: 17th Feb 2015 02:44
I'm trying to display the amount of time a button has been held down for. I'm currently using the print command like so:

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

Is there a better way to do this without using print so I can edit the text of the timer?

Thanks for the help!

Login to post a reply

Server time is: 2024-04-26 13:31:46
Your offset time is: 2024-04-26 13:31:46