Author Topic: Trying to add gameover image in theme please help  (Read 3226 times)

dustind900

  • Full Member
  • ***
  • Posts: 104
  • Karma: +9/-3
    • View Profile
Trying to add gameover image in theme please help
« on: June 01, 2020, 10:59:55 PM »
I'm trying to have a gameover screen display "OnGameExit' but the loading image does not fade away fast enough for the gameover screen to display. Any way to make this work?

relevant code
Code: [Select]
<image src="images/gameover.png" width="1920" height ="1080" alpha="0" layer="6">
<onGameExit><set duration="1"><animate type="alpha" to="0"/></set></onGameExit>
<onGameEnter><set duration="1"><animate type="alpha" to="1"/></set></onGameEnter>
</image>

<image src="images/loading.png" width="1920" height ="1080" alpha="0" layer="7">
<onGameExit><set duration="0.1"><animate type="alpha" to="0"/></set></onGameExit>
<onGameEnter><set duration="0.1"><animate type="alpha" to="1"/></set></onGameEnter>
</image>

<reloadableImage type="logo" x="660" y="660" xOrigin="left" yOrigin="top" width="600" alpha="0" layer="8">
<onGameExit><set duration="1"><animate type="alpha" to="0"/></set></onGameExit>
<onGameEnter><set duration="0.1"><animate type="alpha" to="1"/></set></onGameEnter>
</reloadableImage>

walknight

  • Newbie
  • *
  • Posts: 24
  • Karma: +4/-1
    • View Profile
Re: Trying to add gameover image in theme please help
« Reply #1 on: June 02, 2020, 09:07:49 PM »
Maybe something like this?

Code: [Select]
<image src="images/gameover.png" width="1920" height ="1080" alpha="0" layer="6">
    <onGameExit>
        <set duration="0.1"><animate type="alpha" to="1"/></set>
        <set duration="1"><animate type="alpha" to="0"/></set>
    </onGameExit>
</image>

dustind900

  • Full Member
  • ***
  • Posts: 104
  • Karma: +9/-3
    • View Profile
Re: Trying to add gameover image in theme please help
« Reply #2 on: June 03, 2020, 03:53:55 PM »
Mostly the problem is the loading image. There is no way to fade out the loading image while the game is playing. I can fade it out during "OnGameEnter" but the frontend will wait until the animation is done before launching the game and you will see the frontend again before the game starts making the loading image obsolete. The gameover image alpha is set to 1 OnGameEnter but is hidden by the loading image. So it made sense that if I set loading fadeout to 1/10 second and gameover to 1 second that the loading image should fadeout almost immediately leaving the gameover image visible for 9/10 second after the game exits. But that isn't the case. Instead the loading image is displayed for almost the whole gameover animation time.

walknight

  • Newbie
  • *
  • Posts: 24
  • Karma: +4/-1
    • View Profile
Re: Trying to add gameover image in theme please help
« Reply #3 on: June 03, 2020, 04:59:53 PM »
Yes I see the logic there. The only issue I see is that on game exit, "loading" and "game over" start to fade at the same time, just "loading" fades faster than "game over".
So the code I posted earlier was trying to get "game over" to fade after "loading" is completely gone.
Just tried this myself. On my PC with an integrated graphics, I don't see either "loading" or "game over" on game exit, just black screen then suddenly the front end UI.
I guess depending on the theme there may be a lot stuff going on when exiting a game and reinitializing the front end, so by the time everything is ready, that 1s animation time has passed.
I tried to add a wait time and was able to see the "game over" image:

Code: [Select]
<image src="images/gameover.png" width="1920" height="1080" alpha="0" layer="6">
    <onGameExit>
        <set duration="0.001"><animate type="alpha" to="1"/></set>
        <set duration="1"><animate type="nop"/></set>
        <set duration="1"><animate type="alpha" to="0"/></set>
    </onGameExit>
</image>

dustind900

  • Full Member
  • ***
  • Posts: 104
  • Karma: +9/-3
    • View Profile
Re: Trying to add gameover image in theme please help
« Reply #4 on: June 09, 2020, 01:53:08 AM »
I just ended up doing the gameover screen with code. I fade in the loading image then fade it out to black when the game launches. Then when the game exits the code displays the gameover image and the frontend comes in with a black screen fading into the menu.

If only there was a "noWait=true" switch for animations.

Sequence

  • Newbie
  • *
  • Posts: 38
  • Karma: +4/-1
    • View Profile
Re: Trying to add gameover image in theme please help
« Reply #5 on: June 19, 2020, 12:04:57 PM »
...just an idea

<image src="images/loading.png" width="1920" height ="1080" alpha="0" layer="6">
   <onGameEnter>
                <set duration=".25"><animate type="alpha" from="0" to="1"/></set>
                <set duration="5"><animate type="nop"/></set>
                <set duration="1"><animate type="alpha" from="1" to="0"/></set>
       </onGameEnter>
</image>

<image src="images/gameover.png" width="1920" height ="1080" alpha="0" layer="6">
   <onGameExit>
                <set duration=".25"><animate type="alpha" from="0" to="1"/></set>
                <set duration="5"><animate type="nop"/></set>
                <set duration="1"><animate type="alpha" from="1" to="0"/></set>
       </onGameExit>
</image>