Floaty text

Need help with using DizzyAGE then look here
Queex
Hard Boiled Egg
Posts: 124
Joined: Thu Oct 22, 2009 5:04 pm

Floaty text

Post by Queex » Thu Oct 29, 2009 3:51 pm

What I want is to be able to spawn free-floating text somewhere on the map, which then rises slowly to a second or so and disappears.

In other words, so when you collect a coin, instead of the dialogue box appearing and needing to be cleared away, you can keep on playing while the notification scrolls up.

Now, I think this can be done by:
* Making the ActionPickup coin trigger the spawn of the message.
* Adding an 'UpdateNotification' function to the global room update to move it.

But I also want to generate the text somewhat dynamically, using the normal font rather than having to create a brush for each possible collectible (I plan on having a few). Is that feasible?

macon
Hard Boiled Egg
Posts: 174
Joined: Mon Apr 30, 2007 1:08 pm
Location: Grimsby, England

Post by macon » Thu Oct 29, 2009 4:50 pm

I have actually made free floating text by accident. What happened is that I used a non exsistant tile for the dialog box border and he result was it just drew the text only.

However, dialog boxes freeze the action. You would need to create your own by modifying a copy of the original code and altering its draw position in the room update.

It could be pretty complicated. It might be easier to have a graphic for each message and use the inbuilt functions for moving spiders, platforms etc.

Queex
Hard Boiled Egg
Posts: 124
Joined: Thu Oct 22, 2009 5:04 pm

Post by Queex » Thu Oct 29, 2009 5:44 pm

I did a little digging, and it turns out that any code showing how to write text to screen isn't exposed- there a high-level functions in the engine that handle messages, but not at a basic enough level that they can be co-opted for this. I might have to fall back on pre-built brushes, in that case, which would be a pity.

delta
Hard Boiled Egg
Posts: 3965
Joined: Fri Feb 09, 2007 7:08 pm
Location: North West
Contact:

Post by delta » Thu Oct 29, 2009 6:36 pm

I wouldn't give up just yet. It sounds interesting, and I think it can be done. Ill give some thought as to how it could be done, but off the top of my head it sounds like you need something like the text in TLoD, which is drawn by the HUD, rather than as a message.

I'll try and come up with some solid code for you over the weekend.

why does everyone always want complicated stuff in their first game these days? :p
Image

Image

"Quotes from the internet may not be genuine" - Abraham Lincoln

Queex
Hard Boiled Egg
Posts: 124
Joined: Thu Oct 22, 2009 5:04 pm

Post by Queex » Thu Oct 29, 2009 8:10 pm

delta wrote:why does everyone always want complicated stuff in their first game these days? :p
I've been made bold by my coding successes at work. :v2_dizzy_tongue2:

macon
Hard Boiled Egg
Posts: 174
Joined: Mon Apr 30, 2007 1:08 pm
Location: Grimsby, England

Post by macon » Thu Oct 29, 2009 8:49 pm

I'm kicking myself for not thinking of this earlier.

Look up HudDrawText() in the manual. This will print text anywhere. The manual states it should only be called from within HandlerDrawHud(). Look at the line that displays the room name to see how it works. In fact print the room name in the middle of the screen to see it in action.

delta
Hard Boiled Egg
Posts: 3965
Joined: Fri Feb 09, 2007 7:08 pm
Location: North West
Contact:

Post by delta » Thu Oct 29, 2009 9:35 pm

The issue is not displaying it on the HUD, it's being able to easily display different messages on the HUD, and show them where-ever you want to, for however long you want to. It's definitely possible, and i'll write some code that will do exactly that before the end of the weekend. :)
Image

Image

"Quotes from the internet may not be genuine" - Abraham Lincoln

xelanoimis
Team Yolkfolk
Team Yolkfolk
Posts: 1014
Joined: Sun Jan 21, 2007 6:34 pm
Contact:

Post by xelanoimis » Thu Oct 29, 2009 9:39 pm

There are 2 ways to do it.
It's not quite the beginner's thing but it's not too complicated either.

One is to do it in the draw handler (as mentioned). It will work like other menu messages. By the way the messages are not blocking - it's just the implementation in the template what pause the game while the message is displayed. You can have a message displayed and play the game in the background.

However take care not to do much calculations in the draw handler - that is called at true frame rate (not at 37 fps or so). It can affect the game's fps. The best solution is to do all your work on the update handler, store the result (the text, position, etc) in script global variables and on draw, just display them. Also avoid doing much string operations.

The second way to implement such text tricks, is to have a number of dynamic objects used as letters (8x8 pixels) and to set their mapping to the characters in the font tile and to align and move them depending on what you want to do. If you organize the code well, you can simply have to call something like ShowFloatingText( x, y, text ). From the game update handler you call an UpdateFloatingText which test if any text is visble and updates the letter objects to move up or fade or whatever. You only need as many objects as the longest line of text you want to display once.

I would recommend the second way since is more flexible for complex moving texts (spiral or other tricky movements). If it's just a line of text moving up, do it in the draw handler as a message.

Alex

DizzyFanUK
Hard Boiled Egg
Posts: 606
Joined: Tue Mar 18, 2008 11:20 am
Location: Brentwood, Essex, UK

Post by DizzyFanUK » Fri Oct 30, 2009 6:27 pm

Would someone be able to pop a screenshot of just what floaty text looks like in a game?

Im trying to imagine it in practice?
is it like the intro screen where big DIZZY letters dance about?
or is it like when you click on a power up and for a few seconds some flashy points numbers float up into the air, then fade away?
Cool effects :)

btw, I like to follow these dizzyage with qs - not because of any technical knowledge - but its fun to appreciate the weird and wonderful complexities that go into making games.
A bit like a child watching someone fix the car - not knowing whats going on - but it looks impressive :)
:v2_dizzy_thumbsup:Long Live Dizzy - May his boxing gloves never shrink in the wash :v2_dizzy_biggrin:

Meph
Hard Boiled Egg
Posts: 2973
Joined: Fri Apr 13, 2007 12:47 am
Location: England, Suffolk

Post by Meph » Fri Oct 30, 2009 6:33 pm

Wonder if anyone will make a dizzy first person shooter with dizzyage!!!
Its always the cracked ones that let the light in

Post Reply