Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to make an android and i have got to the stage where im adding in some simple graphics and it gets drawn to the screen fine but it is drawn over the top of everything else here is the code

public void draw( Canvas c, int score )
{
    c.scale(sx, sy);
    c.drawBitmap(background, 0, 0, null);

    for( int i = 0; i < map.obsiticals.length; i++ )
    {
        if( map.obsiticals[i] != null && map.obsiticals[i].y > 0 && map.obsiticals[i].y + map.obsiticals[i].height < 800 ) map.obsiticals[i].draw(c);
    }
    for( int i = 0; i < map.coins.length; i++ )
    {
        if( map.coins[i] != null && map.coins[i].y > 0 && map.coins[i].y + map.coins[i].height < 800 && !map.coins[i].isCollected ) map.coins[i].draw(c);
    }

    if( score - 1 == -1 ) c.drawText("0", 20, 50, resetTextPaint);
    else c.drawText(String.format("%d", score - 1 ), 20, 50, resetTextPaint);
    c.drawText(String.format("%d", score ), 20, 50, textPaint);

    if( isWon && isStarted ) c.drawText("YOU WON", 20, 400, resPaint);
    else if( isLost && isStarted ) c.drawText("YOU LOST", 20, 400, resPaint);

    //c.drawText("YOU LOST", 20, 400, resPaint);
}

any help would be appreciated

Cheers Daniel

share|improve this question
    
what do you want to be drawn behind other elements? –  VinceFR Jul 18 '12 at 12:25
    
A screenshot or a more accurate description of what isn't working would be helpful! –  thalador Jul 18 '12 at 12:36
    
backround is drawn first here, therefore it is below any other object. Your if statements probably do not draw anything on top of it... –  Lumis Jul 18 '12 at 14:43
    
Sorry yea i would like to draw other elements on top of the image but even tho its the first thing i draw everything goes behind it and it worked perfectly before when i was just using the color black as the background –  Dan Jul 18 '12 at 21:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.