Blockland Forums > Modification Help
Image overlap/whiteout effect question
<< < (6/6)
lordician:
I belive i found something that could bee used for this:

--- Quote ---Introduction

Most games that you play have splash screens. Whether it be an PC, Xbox 360, or PS3 they all have it. Splash screens display a company logo and/or a publisher logo. Here I will teach you how to create a splash screen to add to your game.


[edit]Materials Needed
You will need the following materials in order to complete this tutorial.

Visual C# Express with Torque X already installed
A project started from StarterGame
A 800x600 image (the one you would like to use for your splash screen)
[edit]Creating the Splash Screen
Follow these steps to create the splash screen for your game. 1. Add the 800x600 image to your data/images folders and make sure you have imported it into Visual C# Express. 2. Create a new file called SplashScreen.cs and copy/paste this into it:

#region Using Statements
using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graph ics;

using GarageGames.Torque.Platform;
using GarageGames.Torque.Core;
using GarageGames.Torque.Sim;
using GarageGames.Torque.GUI;
using GarageGames.Torque.MathUtil;
using GarageGames.Torque.T2D;
//using TorqueCombat.Canvas;
#endregion

namespace StarterGame.UI
{
    /// <summary>
    /// Displays the splash ad for TankBuster, first GUI screen to become visible.
    /// </summary>
    public class SplashScreen : GUISplash, IGUIScreen
    {
        //======================================================
        #region Constructors

        public SplashScreen()
        {
            // create the Style for our splash ad
            GUISplashStyle splashStyle = new GUISplashStyle();
            splashStyle.FadeInSec = 2;     // black to image 2 seconds
            splashStyle.FadeOutSec = 2;    // image to black 2 seconds
            splashStyle.FadeWaitSec = 4;   // still image for 4 seconds
            splashStyle.Bitmap = @"data\images\YourFileNameHere";
            splashStyle.PreserveAspectRat io = true;
            //splashStyle.Anchor = AnchorFlags.All;

            // set some info for this control
            Name = "SplashScreen";
            Style = splashStyle;
            Size = new Vector2(800, 600); // Changed System.Drawing.SizeF to Microsoft.Xna.Vector2
            OnFadeFinished = OnSplashFinished;

            // create a black letterbox
            // only visible on widescreen displays
            GUIStyle lbStyle = new GUIStyle();
            lbStyle.IsOpaque = true;
            lbStyle.FillColor[0] = Color.Black;

            GUIControl letterbox = new GUIControl();
            letterbox.Style = lbStyle;
            GUICanvas.Instance.LetterBoxC ontrol = letterbox;
        }

        #endregion

        //======================================================
        #region Public methods

        /// <summary>
        /// Callback from the Splashscreen when the splash has finished fading.
        /// </summary>
        public void OnSplashFinished()
        {
             //Load the txscene level file
             StarterGame.Game.Instance.Sce neLoader.Load(@"data\levels\yourlevelfile.txscene"); //Replace this with your own level loading code

             //create a renderable canvas for the scene   
            GUIStyle stylePlayGui = new GUIStyle();   
            GUISceneview playGui = new GUISceneview();   
            playGui.Style = stylePlayGui; 
   
            //switch over to the new canvas   
            GUICanvas.Instance.SetContent Control(playGui);
         }

        #endregion
    }
}
3. Edit YourFileName here with the name of your splash screen image file.

4. Open up the Game.cs file. Add the following changes to display the splash screen:

In top of the file, add this line to the list of 'using' clauses:

using GarageGames.Torque.GUI;
In Private, Protected, Internal Methods in the BeginRun method after base.BeginRun(); add this:

            // go to splash screen
            SplashScreen splashScreen = new SplashScreen();
           
            GUIStyle splashStyle = new GUIStyle();
            GUISceneview splash = new GUISceneview();
            splash.Style = splashStyle;
            GUICanvas.Instance.SetContent Control("SplashScreen");
            GraphicsDevice.VertexDeclarat ion = new VertexDeclaration(GraphicsDevice, VertexPositionColor.VertexEle ments);
This initializes the Splash Screen and displays it.

[edit]Platformer Starter kit
If you are using the Platformer Starter kit replace OnSplashFinished method code with the following in the SplashScreen.cs file

PlatformerStarter.Game.Instan ce.SceneLoader.Load(@"data\levels\sample_level.txscene");
GUIStyle playStyle = new GUIStyle();
GUISceneview play = new GUISceneview();
play.Name = "PlayScreen";
play.Style = playStyle;

GUICanvas.Instance.SetContent Control(play);
PlatformerDemoGUI.Instance.GU I.Folder = GUICanvas.Instance;This loads the sample_level file (change this to match your file) and initializes a new GUI that sticks the camera to the player

--- End quote ---
MegaScientifical:

--- Quote from: lordician on July 02, 2010, 06:07:38 PM ---I belive i found something that could bee used for this:

--- End quote ---

That is source code. AKA, you can't edit/add that to the game.
lordician:

--- Quote from: MegaScientifical on July 02, 2010, 06:09:44 PM ---That is source code. AKA, you can't edit/add that to the game.

--- End quote ---
Thought so...
Navigation
Message Index
Previous page

Go to full version