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 / Text , fonts and effects

Author
Message
Alex Goaga
9
Years of Service
User Offline
Joined: 6th Nov 2015
Location:
Posted: 22nd Jul 2016 10:18
Hey guys, I have a question about the text options featured on AppGameKit (steam)

It's possible to create or implement a font that would make the text displayed with "SetTextSize" to not look so pixelated ?
Also, it's there a possibility to implement fade - in / fade - out effects like..uhmm.....in power point ( MS OFFICE ) by using some time code , example this one ...

time# = timer()
i = 0

do
time# = time# + GetFrameTime()
if time#>1.0
time# = time#-1.0
inc i
endif
print("Loop count = " + str(i))

sync()
loop

and to add something like when ... i = 4 fade a little , when i = 6 fade a little more?
Does AppGameKit support this kind of features ?

Thank you for your time,
Alex
29 games
19
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 22nd Jul 2016 13:31
Yes, you can do everything you're asking for.

A simple fade out could be something like this:



There's also a "tween" command that can affect the alpha, colour and various other parameters of the text so you might want to look at those as well (I've never used them so haven't given an example here).

As for the pixelated text, the default font used by AppGameKit is really just a placeholder and it's best to load in your own, known as a font image - you can either make your own or find one on the internet. I've attached an example of how this would work in AGK.

In the media folder there are two file: font_001.png and font_001 subimages.txt

font_001.png is the actual image for the font (all the letters are white with a transparent background so you may not see them depending on the software you used to open the file).
font_001 subimages.txt is a text file that tells AppGameKit where all the letters and other characters are on the image. Each row is the character, position of the character in the image and the size of the character. If you look at the first row:

65:0:0:25:36

65 is the ascii code for an uppercase "A"
0:0 is the x:y coordinates of where the top left corner of the character is in the image (accounting for whatever space you want around the character)
25:36 is the width and height of the character in pixels (again accounting for whatever space you want around the character)

I made this font image in paint.NET and the subimage in note pad. You do not have to account for all the letters and characters if you don't intend to use them. If you look down the subimage you see a row that says 97:0:0:25:36. 97 is the ascii code for a lowercase "a" but you'll notice the position and size is exactly the same as for an uppercase "A". In this particular case I had no intention of using lower case letters in the game so there are no lowercase letters in the font image. It just speeds up the time it takes to make the image.

Obviously, the larger the font image, the less pixelated they look and the bigger they can be in the game.

You can load in more than one font image and set different text to different fonts using the SetTextFontImage but you'd have to do this for each individual text item.
Hover Car Race Challenge! - available now on Google Play
Invaders of the 29th Dimension - available now on Google Play
Find me on indieDB

Attachments

Login to view attachments
Alex Goaga
9
Years of Service
User Offline
Joined: 6th Nov 2015
Location:
Posted: 22nd Jul 2016 14:29
nice.... I did manage to find more information for the font ideas on : https://forum.thegamecreators.com/thread/189225 . I still do have a question regarding the your code example with the fade out. To make a fade in it's simple, start from 0 to 255 , no problems. But the real question is : Can i select the number of seconds that i want to make my text appear or disappear ? For example , I would like to create a function and to call in different locations in the code and to make some objects appear faster than others . Example the entrance of a boss fight. the fade to that level should be longer than... a fade off of any item ?

I tried current_time = GetMilliseconds() to transform in some count code from one second to 3 but it seems that it doesn't work as expected .

Thank you for your time,
Alex

Login to post a reply

Server time is: 2024-11-23 22:34:26
Your offset time is: 2024-11-23 22:34:26