×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    23

    Question Text on GameCanvas with at least one TiledLayer doesn't show.

    Hi,

    I'm working on a game and am now at a point where it sort of looks good but all of a sudden none of the in-game texts (likes scores) show on the phone or any emulator.

    What I've got is a GameCanvas class that has 3 layers; the player's sprite, the monster-sprite and a TiledLayer that draws the background. All works fine.
    Now I want to show the texts of the scores on the screen as well, but when I add the TiledLayer to the LayerManager, it is painted over the texts (which I create on the same Graphics object I paint the layers on).

    Is there any order in which I need to draw everything on the screen, or is there something else I should know?

    Thanks in advance for any help,

    Iwan

  2. #2
    Registered User
    Join Date
    Dec 2005
    Posts
    4

    Re: Text on GameCanvas with at least one TiledLayer doesn't show.

    If this is supposed to be part of a HUD that's supposed to be on top of everything the solution is probably simple. Somewhere in you code you most probably have the following lines, and all you need to take care of is to make sure that they are performed in the correct order (bg here is a TiledLayer, but should work allmost the same with a LayerManager - haven't come to that chapter yet):


    Graphics g = getGraphics();
    bg.paint(g);

    g.drawString(my_score, 0, 0, Graphics.LEFT | Graphics.TOP);

  3. #3
    Registered User
    Join Date
    Dec 2004
    Posts
    23

    Re: Text on GameCanvas with at least one TiledLayer doesn't show.

    Quote Originally Posted by ChryZzE
    If this is supposed to be part of a HUD that's supposed to be on top of everything the solution is probably simple. Somewhere in you code you most probably have the following lines, and all you need to take care of is to make sure that they are performed in the correct order (bg here is a TiledLayer, but should work allmost the same with a LayerManager - haven't come to that chapter yet):


    Graphics g = getGraphics();
    bg.paint(g);

    g.drawString(my_score, 0, 0, Graphics.LEFT | Graphics.TOP);
    I tried it, but it didn't seem to work at the time. I'll try it again. Thing is I'm using a LayerManager to do all the drawing for me, so maybe I need to go by it myself.

    Currently I'm using a transparent PNG file, that solves my problem.

    Thanks,
    Iwan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×