В последней сцене появляется черный фон.

У меня проблема, когда воздушный шар достигает земли, появляется черный фон.

введите здесь описание изображения

// a switch case based on state with appropriate calls
switch (state) {
// scene 1
case 1:
    drawBackground1(); // the first background to appear
    drawSlogan1(); // display the first slogan
    break;
// scene 2
case 2:
    drawBackground2(); // the second background to appear
    drawSlogan2(); // display the second slogan
    break;
// scene 3
case 3:
    drawBackground1(); // the third background to appear
    drawSlogan3(); // display the last slogan
    break;
}

Я показываю этот код здесь, потому что это единственный код, который я изменил, из-за которого появился черный фон.

Нажмите здесь, чтобы увидеть полный код


person Muddy    schedule 08.01.2019    source источник


Ответы (1)


arrow_upward
2
arrow_downward

Когда воздушный шар достигает конечной позиции, тогда state равно 0. Вы также должны нарисовать фон, если state == 0:

switch (state) {
case 0:
    drawBackground1(); // the third background to appear
    break;
case 1:
    drawBackground1(); // the first background to appear
    drawSlogan1(); // display the first slogan
    break;
case 2:
    drawBackground2(); // the second background to appear
    drawSlogan2(); // display the second slogan
    break;
case 3:
    drawBackground1(); // the third background to appear
    drawSlogan3(); // display the last slogan
    break;
}
person Rabbid76    schedule 08.01.2019