splash screen woes
by rennie moffat · in iTorque 2D · 04/26/2010 (7:18 am) · 22 replies
Hi there, I am having trouble getting my splash screen to go up. Currently, when I run my game it simply fades in which ever level/scene is curretnly open in the editor leaves it for the time length as programmed in my splash.gui and the fades out into black.
I am have ing trouble understanding the initialise project function's contents. Should I be setting schedules and stuff in here? Like, after 4 secs loadMainMenu();?
I am have ing trouble understanding the initialise project function's contents. Should I be setting schedules and stuff in here? Like, after 4 secs loadMainMenu();?
function initializeProject()
{
$splash = 1;
exec("~/gui/splash.gui");
exec("./gameScripts/splash.cs");
// Load up the in game gui.
exec("~/gui/mainScreen.gui");
// Exec game scripts.
exec("./gameScripts/game.cs");
startGame( expandFilename($Game::DefaultScene) );
///startGame(%level);
$defaultScene = "game/data/levels/level1Pt1.t2d";
getSplashNumber();
loadSplash();
}About the author
My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.
#2
<DefaultScene>~/data/levels/splash.t2d</DefaultScene>
:?
04/26/2010 (8:03 am)
it says the default scene is <DefaultScene>~/data/levels/splash.t2d</DefaultScene>
:?
#3
04/26/2010 (8:07 am)
with splash.t2d as the the default scene in the main.cs it plays all black screen for the splash time and then opens the currently open screen in the editor.
#4
In the splash.gui, which is called thru main.cs is the data field....
I have tried entering several different things, like "splash", "splash.png", ~game/data/splash/splash.png", but nothing the screen still comes up black.
What gives?
04/26/2010 (8:27 am)
I think one of my main questions is how do I get the bitmap to open/be selected?In the splash.gui, which is called thru main.cs is the data field....
bitmap = "";
I have tried entering several different things, like "splash", "splash.png", ~game/data/splash/splash.png", but nothing the screen still comes up black.
What gives?
#5
04/26/2010 (1:17 pm)
Hi Rennie, my splash code for my game:function initializeProject()
{
hideCursor();
$splash = 1;
exec("~/gui/splash.gui");
exec("./gameScripts/splash.cs");
// Load up the in game gui.
//A little more practical, load a mainscreen and set its size according to the orientation
exec("~/gui/mainScreen.gui");
if(isObject(mainScreen) && isObject(sceneWindow2D))
{
if($pref::iPhone::ScreenOrientation $= "Portrait")
{
echo(" % - MainScreen set to Portrait! 320x480");
mainScreen.Extent = "320 480";
sceneWindow2D.Extent = "320 480";
}
else
{
echo(" % - MainScreen set to Landscape! 480x320 ");
mainScreen.Extent = "480 320";
sceneWindow2D.Extent = "480 320";
}
}
exec("./gui/mainMenu.gui");
exec("~/gui/highscore.gui");
// Exec game scripts.
exec("./scripts/game.cs");
$defaultScene = "game/data/levels/level1.t2d";
// Make sure the main game splash stays around before we display the
// Torque splash.
schedule(2000, 0, showSplash);
// This is where the game starts. Right now, we are just starting the first level. You will
// want to expand this to load up a splash screen followed by a main menu depending on the
// specific needs of your game. Most likely, a menu button will start the actual game, which
// is where startGame should be called from.
//startGame( expandFilename($Game::DefaultScene) );
}
function showSplash() {
getSplashNumber();
loadSplash();
}
#6
04/26/2010 (1:20 pm)
And in splash.cs - this is what loads your $defaultScene// Get number of splash screens from splash.ini
function getSplashNumber()
{
%nReturn = false;
%file = new FileObject();
if (%file.openForRead("./settings/splash.ini"))
{
while ( !%file.isEOF() )
{
$splash = %file.readLine();
}
%file.close();
%nReturn = true;
}
return %nReturn;
}
// Load splash screen
function loadSplash()
{
// Load game
if ($splash == 0)
{
resetCanvas();
startGame($defaultScene);
}
// Display splash screen
else
{
splashGUI.bitmap = "~/data/splash/logo" @ $splash @ ".png";
canvas.popDialog(splashGUI);
canvas.pushDialog(splashGUI);
schedule(100, 0, checkSplash);
$splash--;
}
}
// Check to see if splash screen should be loaded
function checkSplash()
{
if (splashGUI.done)
loadSplash();
else
schedule(100, 0, checkSplash);
}
#7
That's pretty much what I had, except that I did not have the if statement regarding landscape and portrait nor hideCursor(). Also I did not have a separate function for showSplash().
It does not work for me, but since it worked for you I am presuming, somehow that the main torque TGB splash page is not being called. It is not currently in my splash folder but I do have one called splash.png. Would this be a factor?
My main question tho is...
04/26/2010 (2:00 pm)
Thanks Scott, That's pretty much what I had, except that I did not have the if statement regarding landscape and portrait nor hideCursor(). Also I did not have a separate function for showSplash().
It does not work for me, but since it worked for you I am presuming, somehow that the main torque TGB splash page is not being called. It is not currently in my splash folder but I do have one called splash.png. Would this be a factor?
My main question tho is...
function loadSplash()
{
// Load game
if ($splash == 0)
{
resetCanvas();
startGame($defaultScene);
}
// Display splash screen
else
{
splashGUI.bitmap = "~/data/splash/logo" @ $splash @ ".png";
//// in the above line $splash is never defined anywhere that I can see. so, what does this mean? do I need a file that says logo.png?? little confused. currently working on it.
canvas.popDialog(splashGUI);
canvas.pushDialog(splashGUI);
schedule(3000, 0, checkSplash);
$splash--;
}
#8
I have left it empty, put in titles, directories (location in file) etc, all have resulted in the same black screen. I am wondering the significance of this. Should it hold information?
04/26/2010 (2:05 pm)
also, one of the areas of concern, maybe it shouldn't be but, in my splash.gui isbitmap = "";
I have left it empty, put in titles, directories (location in file) etc, all have resulted in the same black screen. I am wondering the significance of this. Should it hold information?
#9
My splash.gui:
04/26/2010 (2:13 pm)
$splash is defined in my initializeProject - right at the top. Your splash screen should be called logo1.png and be in the ~/data/splash directory.My splash.gui:
new GuiFadeinBitmapCtrl(splashGUI) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "800 600";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
bitmap = "";
wrap = "0";
fadeinTime = "1000";
waitTime = "2000";
fadeoutTime = "1000";
done = "1";
};
#10
"logo1.png" did it. hoo rah!
Ok great, i hopefully can take it from here. Thanks so much Scott.
Ren
04/26/2010 (3:32 pm)
ok sweeeet."logo1.png" did it. hoo rah!
Ok great, i hopefully can take it from here. Thanks so much Scott.
Ren
#11
?
04/26/2010 (3:34 pm)
not to sound dumb here, but which logo is the one required? I currently have the little "Screaming TGB Guy".?
#12
04/26/2010 (3:55 pm)
I think the choice is yours ;-) I went with the Torque logo rather than the iTGB.
#13
do you know that song? The Choice is Yours by the Black Sheep?
The chorus goes..
"you can get with this
or you can get with that
you can get with this
or you can get with that
you can get with this
or you can get with that
but i think you'll get with this
cause this is where its at!"
http://www.dailymotion.com/video/x1s4e8_black-sheep-the-choice-is-yours_music
04/26/2010 (4:03 pm)
nice.do you know that song? The Choice is Yours by the Black Sheep?
The chorus goes..
"you can get with this
or you can get with that
you can get with this
or you can get with that
you can get with this
or you can get with that
but i think you'll get with this
cause this is where its at!"
http://www.dailymotion.com/video/x1s4e8_black-sheep-the-choice-is-yours_music
#14
04/27/2010 (11:03 am)
Nope never heard of it, but I do now :)
#15
04/27/2010 (11:05 am)
sweeeeeeeet. good song from my youth.
#16
So i have loaded in the code as should however I only get a blank screen, which never loads into my set level1.
I have run it identical to your post (minus, level1 name) and with slight adjustments (in iTGB there is no gameScripts folder, only scripts), but nothing. I have removed the ~ and left it in, also, added in game, and or projectFiles/game/scripts etc. but nothing.
I have added in my ini file in settings and my splash.gui in gui folder, not sure what to do.
my main.cs
my splash.ini exists in
"projectFiles/game/scripts/settings"
I created the settings folder.
The code for splash.ini
and my splash.gui
"projectFiles/game/gui"
06/19/2010 (7:43 am)
@Scott,So i have loaded in the code as should however I only get a blank screen, which never loads into my set level1.
I have run it identical to your post (minus, level1 name) and with slight adjustments (in iTGB there is no gameScripts folder, only scripts), but nothing. I have removed the ~ and left it in, also, added in game, and or projectFiles/game/scripts etc. but nothing.
I have added in my ini file in settings and my splash.gui in gui folder, not sure what to do.
my main.cs
function initializeProject()
{
hideCursor();
$splash = 1;
///here i have changed the file directory description to be more accurate
exec("~projectFiles/game/gui/splash.gui");
exec("~projectFiles/game/scripts/splash.cs");
exec("game/gui/mainScreen.gui");
if(isObject(mainScreen) && isObject(sceneWindow2D))
{
if($pref::iPhone::ScreenOrientation $= "Portrait")
{
echo(" % - MainScreen set to Portrait! 320x480");
mainScreen.Extent = "320 480";
sceneWindow2D.Extent = "320 480";
}
else
{
echo(" % - MainScreen set to Landscape! 480x320 ");
mainScreen.Extent = "480 320";
sceneWindow2D.Extent = "480 320";
}
}
///my defaultScene
$defaultScene = "~projectFiles/game/data/levels/loadingScreen.t2d";
/// i removed a couple of lines here for mainMenu.gui and level1.gui I believe.
/// I do not have those, so thought them unecessary, but did try with them in to no avail
schedule(2000, 0, showSplash);
}
function showSplash() {
getSplashNumber();
loadSplash();
}my splash.ini exists in
"projectFiles/game/scripts/settings"
I created the settings folder.
The code for splash.ini
1
and my splash.gui
"projectFiles/game/gui"
new GuiFadeinBitmapCtrl(splashGUI) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "800 600";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
bitmap = "";
wrap = "0";
fadeinTime = "1000";
waitTime = "2000";
fadeoutTime = "1000";
done = "1";
};
#17
06/20/2010 (2:12 pm)
Hi Rennie, change line 6 and 7 to:exec("~/gui/splash.gui");
exec("./splash.cs");
#18
I have used the lines above + other combinations.
Currently my set up is...
splash.cs in game/scripts/
splash.gui in game/gui
splash.ini in game/scripts/settings
Default.png is in the ProjectFiles/
::: any help would be greatly appreciated.
06/21/2010 (11:23 am)
I am still having trouble with this.I have used the lines above + other combinations.
Currently my set up is...
splash.cs in game/scripts/
splash.gui in game/gui
splash.ini in game/scripts/settings
Default.png is in the ProjectFiles/
::: any help would be greatly appreciated.
#19
splash.cs in game/gameScripts
splash.ini in game/gameScripts/settings
splash.gui in game/gui
splash screen (logo1.png) in game/data/splash
This all works with the code I posted previously.
06/21/2010 (11:32 am)
My setup:splash.cs in game/gameScripts
splash.ini in game/gameScripts/settings
splash.gui in game/gui
splash screen (logo1.png) in game/data/splash
This all works with the code I posted previously.
#20
It appears "lying down" meaning it is rotated 90 degrees on it's side. My game is landscape, the image too is landscape, but on it's side and thus, not only on it's side but squished. I looked through the gui and changed the profile but to no avail.
Also, my default scene does not load after the splash.
06/21/2010 (11:45 am)
ok, so it was the placement and naming of the splash logo. It appears "lying down" meaning it is rotated 90 degrees on it's side. My game is landscape, the image too is landscape, but on it's side and thus, not only on it's side but squished. I looked through the gui and changed the profile but to no avail.
Also, my default scene does not load after the splash.
Associate Craig Fortune
$Game::DefaultScene is set from the default scene found there.