Errors that either dont exist or I dont understand ^^;;
Im following along with tutorials sent to me by a previous college instructor. To help with my learning he basically told me to just copy what I see him doing (Im learning disabled). I completed two different files (MyGameType.uc and MyGameHUD.uc). The first file seems to be fine, but the second file has a couple of errors that dont seem to make sense to me.
MyGameType.uc
//--------------------------------------------------------------------------------------------------------------------
// Class Creation
//--------------------------------------------------------------------------------------------------------------------
class MyGameType extends UTGame;
//--------------------------------------------------------------------------------------------------------------------
var int gameScore;
var float gameTimer;
//--------------------------------------------------------------------------------------------------------------------
// Timer
//--------------------------------------------------------------------------------------------------------------------
function Tick(float DeltaTime)
{
gameTimer -= DeltaTime;
if(gameTimer < 0)
{
gameTimer = 0;
}
}
//---------------------------------------------------------------------------------------------------------------------
DefaultProperties
{
//Set HUD type to the My Game HUD
HUDType=class'MyGameHUD';
//initial start time
gameTimer = 60;
//Turn off classic HUD; makes ours useable
bUseClassicHUD = true;
}
MyGameHUD.uc
//--------------------------------------------------------------------------------------------------------------------
// HUD Creation
//--------------------------------------------------------------------------------------------------------------------
class MyGameHUD extends HUD;
var MultiFont Myfont;
//--------------------------------------------------------------------------------------------------------------------
// Draw Actual HUD
//--------------------------------------------------------------------------------------------------------------------
function DrawHUD()
{
super.DrawHUD();
drawGreeting();
drawGameScore();
}
//--------------------------------------------------------------------------------------------------------------------
// Greeting
//--------------------------------------------------------------------------------------------------------------------
function drawGreeting()
//position and look
{
local float textSizeX;
local float textSizeY;
local string Greeting;
Greeting = "Welcome to my nightmare!!";
Canvas.Font = Myfont;
Canvas.textSize(Greeting, textSizeX, textSizeY, 0.1, 0.1);
Canvas.SetPos((Canvas.SizeX / 2) - (textSizeX / 2), (Canvas.SizeY / 2) - (textSizeY / 2));
Canvas.SetDrawColor(255, 255, 255);
Canvas.DrawText(Greeting, ,0.1, 0.1);
}
//--------------------------------------------------------------------------------------------------------------------
// Score
//--------------------------------------------------------------------------------------------------------------------
function drawGameScore()
{
local WorldInfo rWorldInfo;
local MyGameType rGame;
local int score;
//populate score
//Grab Instance of WorldInfo and Verify Its Validity
rWorldInfo = class'WorldInfo'.static.GetWorldInfo();
if(WorldInfo != none)
{
//Convert Game Object to Custom Game Class
rGame = MyGameType(WorldInfo.Game);
//Did this work/succeed? Make sure!
if (rGame != none)
{
score = rGame.gameScore;
}
}
//Draw the score itself
//position and look
Canvas.SetPos(10,10);
Canvas.font(MultiFont'UI_Fonts_Final.menus.Fonts_AmbexHeavyOblique'());
Canvas.SetDrawColor(135,206,250);
//puts score into readable string (on screen)
Canvas.DrawText("Score:" @score);
}
DefaultProperties
{
Myfont = MultiFont'UI_Fonts_Final.menus.Fonts_AmbexHeavyOblique';
}
In MyGameHUD.uc Im getting the following errors:
(Ignore warning
#5. For some reason, this file is pulling up codes from another project.)
Im also trying to figure out why Canvas never autocompleted or changed to the turquoise color. I wonder why rWorldInfo isn't working either. Im driving myself crazy trying to figure this out. What did I do wrong? Any help would be greatly appreciated. Thank you!
Replies
Corrected line: