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.

AppGameKit Classic Chat / Interact with text

Author
Message
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 24th Aug 2013 15:59
I plan to make a platform game in a world made of words and letters and wonder if it would be possible to get AppGameKit text to ineract with the physics engine, for example convert the text to sprites.

Sincerely,
Max Tillberg
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Aug 2013 19:01
Well, if you used sprites for text, then it can certainly interact with the physics engine.

The trick is how you do it.

One way might be to have individual images for each letter and create a sprite for each one, as needed, and then keep the sprite ids of words in something (easier in Tier 2 with structs and classes that let you use lists and arrays within them than in Tier 1 which does not let you put arrays in typedefs).

Another might be to create the word using basic text, then grab that segment of the display and create an image and a sprite from it and then remove the text and display the sprite.

Just a couple of rough, quick ideas.

But, there is no way, at present that I can think of, to make the text objects themselves interact with the physics system.

Your basic idea sounds interesting.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 25th Aug 2013 12:05 Edited at: 25th Aug 2013 12:07
What if you just place blank/transparent dummy sprites over the text objects, and then activate physics on them, and then you sync the text's coordinates and rotation with the sprite coordinate for every loop.

In fact, in this way you could even smooth out jitters, by not updating the coordinates of the text object, if it just keeps jumping a little, as physics sprites sometimes do.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 25th Aug 2013 12:25 Edited at: 25th Aug 2013 12:26
Text in AppGameKit is already sprites, technically

Otherwise, an easy way to solve this problem would be to make a sprite-sheet with letters, and assign them each sub image ids in order of the alphabet (1-26 + special characters). Then just clone sprites based on the value of the letter in the text string and clone the correct sprite.

"A boy"

A = Base Sprite (Font) ID of 100 + Shift (35, let's say that's enough to cover the alphabet plus whatever additional characters you need) + First Letter (a) = Iamge ID of 136
_ = Base Sprite (Font) ID of 100 + Space (27) = Image ID of 127
b = Base Sprite (Font) ID of 100 + Second Letter (b) = 102
o = Base sprite (Font) ID of 100 + 15th letter (o) = 115
y = Base Sprite (Font) ID of 100 + 25th letter (y) = 125

Hi there. My name is Dug. I have just met you, and I love you.
Max Tillberg
19
Years of Service
User Offline
Joined: 16th Jul 2005
Location:
Posted: 25th Aug 2013 15:32
Good ideas. Thanks a lot.

Sincerely,
Max Tillberg

Login to post a reply

Server time is: 2024-11-24 21:03:35
Your offset time is: 2024-11-24 21:03:35