Computer Science Canada

Font.Draw not drawing text above sprite?

Author:  Tasty Pastry [ Wed Jun 07, 2017 6:43 pm ]
Post subject:  Font.Draw not drawing text above sprite?

I'm making a game in turing, and I have a textbox sprite that im using for my textbox (obviously). However when I use Font.Draw it seems to be drawing it behind the sprite, although the the sprite is at layer 0. How do I fix this?

Turing:


var TextBox : int := PicLoad ("TextBox.bmp")
var TextBoxSprite : int := Sprite.New (TextBox)

Sprite.SetPosition (TextBoxSprite, 685, 145, true)
Sprite.SetHeight (TextBoxSprite, 0)

Sprite.Show (TextBoxSprite)

fontPositionChoosex := 278
fontPositionChoosey := 185
TypewriterPrintSlow ("....") % A procedure that uses Font.Draw, i'll include it here just in case



proc TypewriterPrintSlow (text : string)
    for i : 1 .. length (text)
            delay (750)
            Font.Draw (text (i), fontPositionChoosex + x, fontPositionChoosey, font, colorText)
           
            x := x + 23
    end for
    put ""
    x := 0
end TypewriterPrintSlow


Author:  Insectoid [ Wed Jun 07, 2017 7:59 pm ]
Post subject:  RE:Font.Draw not drawing text above sprite?

Non-sprites are considered to be at layer 0. A sprite with a negative height will be drawn under non-sprites.

Author:  Tasty Pastry [ Wed Jun 07, 2017 8:07 pm ]
Post subject:  Re: RE:Font.Draw not drawing text above sprite?

Insectoid @ Wed Jun 07, 2017 7:59 pm wrote:
Non-sprites are considered to be at layer 0. A sprite with a negative height will be drawn under non-sprites.


Yes but then the sprite is just drawn behind the background.

I think this may help but the text flashes right before going under the box.

Author:  Insectoid [ Wed Jun 07, 2017 8:09 pm ]
Post subject:  RE:Font.Draw not drawing text above sprite?

Then your only other option is to make your text a sprite so it can have a layer, or stop using sprites entirely.

Sprites only really work well when everything is a sprite. Mixing them with raw text/images is a bad idea.

Author:  Tasty Pastry [ Wed Jun 07, 2017 8:37 pm ]
Post subject:  Re: RE:Font.Draw not drawing text above sprite?

Insectoid @ Wed Jun 07, 2017 8:09 pm wrote:
Then your only other option is to make your text a sprite so it can have a layer, or stop using sprites entirely.

Sprites only really work well when everything is a sprite. Mixing them with raw text/images is a bad idea.


How would I make my text a sprite? Would it work with my typrewiter proc?

Author:  Insectoid [ Thu Jun 08, 2017 4:49 am ]
Post subject:  RE:Font.Draw not drawing text above sprite?

It's possible, but really messy and slow. You could draw the text, then save it to an image with pic.screensave, then load that image as a sprite.

Or just stop using sprites, which is the solution I recommend and which will teach you much more valuable lessons.


: