Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am a student at Full Sail so I don't want just the solution; I want to understand the problem. I am working from tutorial videos where we are supposed to have a HUD, a score, and a timer. When I first started, my player had a gun and a HUD. As I worked through the videos, the HUD changed, the score showed up but the HUD disappeared. Now the score disappeared as well as well as the HUD and I only have a gun. When I playtest it from Visual Studio, nothing shows up at all but when I load editor only the gun shows up.

This is the code setting up my game type

// Credit: Christopher Maxwell GameType W1 Video

class EricsMapGameType extends UTGame; //Sets game type as Unreal Tournament Game

var int myScore; // Sets myScore as a Variable Integer


defaultproperties // Sets the properties to default

{
    HUDType =class 'EricsMapInterfaceHud'  // Sets the interfacehud class to the Hudtype variable

    PlayerControllerClass = class' EricsMapInterfacePlayerController' // Sets the player controllers class into the the player class Variable

    DefaultPawnClass = class' EricsMapPawn' //Sets the maps custom pawn class to the default pawn variable

    bUseClassicHUD = true // Turns off the Flash Hud and allows use of custom Hud

}




//This is the code for my score, timer, and HUD
class EricsMapInterfaceHUD extends HUD; // EricsMapInterface class extends from Hud



var bool showCursor;

var const Texture2D CursorTexture;

var const Color CursorColor;

var Font m_HUDFont;

var Texture2D m_textureEX;



//------------------------------------------------
function DrawHUD()

{
    super.DrawHUD();
    drawMyScore();
    drawHUDText( "Hello!", 8);
    ericTexture();
}

//------------------------------------------------
function ericTexture()
{
    Canvas.SetPos(300,100);
    Canvas.SetDrawColor(255,255,255);
    Canvas.DrawTile(m_textureEX, 64, 64, 0, 16,  32, 16);
}


//------------------------------------------------
function drawHUDText(string _hudString, int _aNumber)
{
    local float textSizeX;
    local float textSizeY;
    local string ericText;



    ericText=_hudString @ _aNumber;


    Canvas.Font = m_HUDFont;
    Canvas.TextSize(ericText, textSizeX, textSizeY, 0.1, 0.1);
    Canvas.SetPos((Canvas.SizeX/2) - (textSizeX/2),(Canvas.SizeY/2) - (textSizeY/2));

    Canvas.SetDrawColor (255,0,0);
    Canvas.DrawText(ericText,,0.1,0.1);

}


//------------------------------------------------
function DrawMyScore()

{
    local WorldInfo rWorldInfo;
    local EricsMapGameType rGame;
    local int nScore;

    rWorldInfo = class 'WorldInfo' .static.GetWorldInfo(); 
    if(rGame != none)
    {
        rGame=EricsMapGameType(rWorldInfo.Game); // Turns the generic game into the custom game
        if(rGame!=none) //If not custome game goes back to original map
        {
        nScore = rGame.myScore;
        }
    }



    Canvas.SetPos(10,10);
    Canvas.Font = class 'Engine' .static.GetMediumFont();
    Canvas.SetDrawColor(255,0,0);

    Canvas.DrawText("Score:" @nScore);
}

//------------------------------------------------
event PostRender()
{
//  Canvas.SetPos(MouseInterfacePlayerInput.MousePosition.X,MouseInterfacePlayerInput.MousePosition.Y); //Gives me a bad or missing expression call to SetPos
    Canvas.DrawColor = CursorColor; //Draws cursor color
    Canvas.DrawTile(CursorTexture, CursorTexture.SizeX, CursorTexture.SizeY,0.f,0.f,CursorTexture.SizeX, CursorTexture.SizeY,, true);

}

defaultproperties
{
    CursorColor=(255,0,0,);
    CursorTexture=Texture2D'EngineResources.Cursors.Arrow';
    showCursor=true;
    m_HUDFont = Font'UI_Fonts.Fonts.UI_Fonts_Positec14';
    m_textureEX = Texture2D'UDKHUD.skull'

}

Please don't just tell me the answer; help me understand the answer.

share|improve this question
4  
If you really want to learn from this problem, utilize your debugging skills to either step through the code, or output variables to learn the state of the program during execution. Also, you can start the tutorial over, and do it again until you get it right. Use version control too. With version control you would be able to compare your existing non-working version to the previously working version to see what changed. Don't make sweeping changes to the code without testing. Make small changes and test, that way when something goes wrong, you know exactly what you changed and what broke it. –  Byte56 Jun 7 '13 at 17:16
4  
Learning to solve your own problems will be far more useful to you than having someone explain what the problem is with this script. –  Byte56 Jun 7 '13 at 17:17
2  
To add to this, if you can use some sort of version control you can compare the different versions to see what you did different and even roll back if necessary. –  SpartanDonut Jun 7 '13 at 19:03
add comment

closed as too localized by Byte56, Nicol Bolas, bummzack, Sean Middleditch, Laurent Couvidou Jun 11 '13 at 16:20

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.