Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

actionscript

Options
  • 23-04-2005 7:27pm
    #1
    Banned (with Prison Access) Posts: 244 ✭✭


    ok i am alright at actionscript but this is beyond me. it is a simple thing of just using dynamic text and then a counter but it wont work. i dont have a clue why. i use the same code in a blank flash doc and it works. i code it in my game and nothing. just keeps coming up as undefined. heres the code

    stop();

    Instructions.onRelease = function()
    {
    gotoandPlay( "Instructions", 1);
    }

    Play.onRelease = function()
    {
    gotoandPlay( "Play Level", 1);
    }

    Quit.onRelease = function()
    {
    gotoandPlay( "Menu", 1);
    }

    this.onLoad = gameInit;

    this.onEnterFrame = gameLoop;

    function gameInit()
    {
    game = new Object();
    game.life = 3;
    game.sword = 10;
    }

    function gameLoop()
    {
    if(player1.hitTest( easy ) )
    {
    game.life--;

    easy.dropRandom();

    }
    game.sword--;

    Lives.text = game.life;
    Swords.text = game.sword;

    }


Comments

  • Registered Users Posts: 1,268 ✭✭✭hostyle


    Which part isn't doing what you expected?


  • Banned (with Prison Access) Posts: 244 ✭✭tails2


    stop();

    Instructions.onRelease = function()
    {
    gotoandPlay( "Instructions", 1);
    }

    Play.onRelease = function()
    {
    gotoandPlay( "Play Level", 1);
    }

    Quit.onRelease = function()
    {
    gotoandPlay( "Menu", 1);
    }

    this.onLoad = gameInit;

    this.onEnterFrame = gameLoop;

    function gameInit()
    {
    game = new Object();
    game.life = 3;
    game.sword = 10;
    }

    function gameLoop()
    {
    if(player1.hitTest( easy ) )
    {
    game.life--;

    easy.dropRandom();

    }
    game.sword--;

    Lives.text = game.life;
    Swords.text = game.sword;

    }

    for some reason it doesnt seem to be reading both

    this...game.life = 3;

    and this game.sword = 10;

    i have set the values as you can see but when i call for them

    here... Lives.text = game.life;

    and here Swords.text = game.sword;

    when i start the game it just shows the values as "undefined".

    i dont understand why. if i used the same code in a blank new flash doc it works. but in this it wont. it is stupid.


  • Registered Users Posts: 1,268 ✭✭✭hostyle


    Ite been years since I used any Actionscript, but isn't there a built-in debugger in Flash? You can click "run" or something and print stuff to an error console. You may or may not have to do this printing manually. Sorry I can't help more - I'm rusty and don't have Flash installed.


Advertisement