Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

actionscript

  • 23-04-2005 07: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, Registered Users 2 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, Registered Users 2 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