forums

TNT Basic Forums > Programming Q&A
GUI-problem: Sprites
< Last Thread     Next Thread >
Author
Thread        Post A Reply

07-01-2006 12:14

Posted by:
Enk

Location:
Norway

Click Here to Email Enk   Find more posts by Enk

How can I draw on a sprite? That is, if I want the sprites to apear behind a GUI. Is it possible to have som kind of layer to draw the GUI on?

07-01-2006 15:59

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

Hi Enk, you'll probably have to decribe a bit more what you're doing. You're talking about a GUI, but TNT doesn't include any GUI mechanism, so i assume you're drawing it yourself? please describe us how you draw your GUI and then we can help you further

07-01-2006 19:16

Posted by:
Enk

Location:
Norway

Click Here to Email Enk   Find more posts by Enk

Sorry for the short description ;)

Well, I am making a tile-based adventure game.
And I am planning to use the bottom of the screen to draw a GUI (Using primitive drawing commands, buttons and regular sprites).

But when I scroll the map downwards, the objects on the map (houses etc. which are drawn as a sprite), apear on top of the GUI. How can I make sure that the GUI allways are on top of those sprites?

And how can I manage to draw on top of a sprite with "draw text"?

07-01-2006 19:55

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

>>
But when I scroll the map downwards, the objects on the map (houses etc. which are drawn as a sprite), apear on top of the GUI. How can I make sure that the GUI allways are on top of those sprites?
>>
In fact, the best solution is not to have the bar over the map, but to have the map stick to a certain area. if you're using map viewports, you can define this when opening the viewport.

> Open map Viewport 1,0,0,0 to 640,480 'define whatever location you want!

look at this tutorial [link]http://www.tntbasic.com/learn/maptutorial/maptutorial.php[/link]
downlaod the example file... one of the examples has a scrolling map and a bar with text on it, it could help you a lot!

if you absolutely want to paste the map on a canvas (which i don't recommend) you can still have the map drawn in another canvas... see the canvas commands in help

>>
And how can I manage to draw on top of a sprite with "draw text"?
>>

Basically, you can't.
The way TNT manages sprites, they are always shown on top of the background. whatever drawing you do is done to the background

still i'm not sure why tou need to do this... maybe think first if you really need it?

however there are workarounds:
1- you could use sprites instead of text... if you want to have any text it may be problematic, but if you want is menus, render them in a drawing app and display them as sprites
2- you can (i've never done it myself but i think it's possible) draw the text into a canvas, capture it into an image bank and display it as sprite (maybe slow?)
3- drop the 'sprite' command, and draw them by hand, for instance with paste image, that way you can be sure in which order things are drawn. unfortunately, you won't be abl to rotate/resize them this way.
4- Tell me why you need this and it will be easier to see what can be done =)

good luck! if you need more explainations don't hesitate

07-02-2006 00:39

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

you could use a bitmap font for text. it would be a bit of a hassle in tntbasic though, but its still an option. all you'd need is a sprite for each letter.

07-02-2006 00:47

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

i think he wants a status bar below the map, with text on it... he probably displays the bar using a sprite - it'd be easier to draw it to the background and then write whatever text on it

07-02-2006 13:14

Posted by:
Enk

Location:
Norway

Click Here to Email Enk   Find more posts by Enk

The plan was to have status-text on the sprites.

Show cooldown on spells on the buttons and show how many of each item you got etc.

07-02-2006 14:39

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

but... do you want to display this text in the gaming area or in the status bar? your message doesn't make it clear to me (maybe it's just me! =P)

07-02-2006 15:09

Posted by:
Jacob

Location:
San Francisco, CA

Click Here to Email Jacob   Find more posts by Jacob

I would make a canvas and viewport for the game, and use canvas 0 for drawing your stats.
Be sure to make viewport 1 a little less tall than the screen.
Also, be sure to switch canvases and draw your stats on the bottom.

07-06-2006 00:49

Posted by:
swagIT

Location:
Great Wet North (Vancouver)

Find more posts by swagIT

Hey Erik - I think what you may need to do is to make a sprite for each number ( i.e. 1 to 10) you can place sprites on top of each other by setting their priority (set sprite priority spriteid,priority) the higher the number the higher the level of the sprite...... a 3 is over a 3 is over a 1.... buttons default to -1.

Does that make sense?

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.