End game/Exit Screen

End game/Exit Screen

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
Von66341
Posts: 111
Joined: 10 Feb 2011, 03:00

End game/Exit Screen

Post by Von66341 »

Hi!

1. Anyone knows how do I modify the end game/exit screen?
2. Disable the current grey player stats screen that display?
3. At game end, display my own screen?

For example, this is what is shown in other games:

Zero K - Have this awards screen at the end of the match

Gundam - Have this gate that close the screen that says 'You Lost/Win'.

Thanks for all the help!
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: End game/Exit Screen

Post by zwzsg »

Von66341 wrote:Gundam - Have this gate that close the screen that says 'You Lost/Win'.
GUNDAM1.26.sd7 \games\gundam\widgets\spring_direct_launch.lua

It's a long widget that manage the whole Single Player menu.
The gate closing is done in the function EitherDrawScreen.
Also related to 'You Lost/Win' are function widget:GameOver(), function SwitchOn(menu), function GameOverMenu(), and ... well then it pulls all my system to draw windows.




Well, tbh you'd be better off by learning from writing your own simpler widget first:
  • The callin you need is function widget:GameOver()
  • To disable the engine endgraph you use Spring.SendCommands("endgraph 0")
  • To draw your own screen.. well there are many ways but I like:

    Code: Select all

    -- Somewhere inside widget:DrawScreenEffects or widget:DrawScreen
    -- Where x1, y1, x2, y2 are your window position
    -- Where lines is a table of lines of text
    -- Where FontSize is font size
        local r,g,b = 0,1,0.5
        gl.Blending(GL.SRC_ALPHA,GL.ONE_MINUS_SRC_ALPHA) -- default
        gl.Color(r,g,b,0.5)
        gl.Rect(x1,y1,x2,y2)
        gl.Color(r,g,b,1)
        gl.LineWidth(1)
        gl.Shape(GL.LINE_LOOP,{
            {v={x1,y2}},{v={x2,y2}},
            {v={x2,y1}},{v={x1,y1}},})
        gl.Color(1,1,1,1)
        for k=1,#lines do
            gl.Text(lines[k],x1+FontSize/2,y2-FontSize*(0.5+k),FontSize,'od')
        end
        gl.Text("\255\255\255\255 ",0,0,FontSize,'o') -- Reset color to white for other widgets using gl.Text
        gl.Color(r,g,b,0.15)
        gl.Rect(x1,y1,x2,y2)
        gl.Color(1,1,1,1)
Von66341
Posts: 111
Joined: 10 Feb 2011, 03:00

Re: End game/Exit Screen

Post by Von66341 »

zwzsg thanks for pointing me to the right direction! =)
Post Reply

Return to “Game Development”