A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [MX] Help with a game

  1. #1
    Junior Member
    Join Date
    Dec 2006
    Posts
    3

    [MX] Help with a game

    Hello everybody, this is my first post.
    I'm Spanish, so excuse my poor English.

    The question is, I have a to made a game with Flash.

    It must appear a person who must receive an aleatory quantity of money.
    At the botton, a serial on coins of different value. The player should go pressing in th coins till he reaches the required quantity.

    I wish you could help me.
    Thank you.

  2. #2
    I would help you.. but i didnt really understand the question..

    You want to click a button, and when u do, it adds money to a money dynamic text box?

  3. #3
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Howdy and welcome to FlashKit,

    From what I can tell from your question you want something like a Mario game? Where you move around and collect coins and after some many something happens. Is that kinda what your making?

  4. #4
    Junior Member
    Join Date
    Dec 2006
    Posts
    3
    Ok, I'll try again.
    The player must make an amount of money clicking on coins of different value.
    For example:

    You must give: 10'20 $
    And at the bottom are coins of 0.20, 0.50, 1 and 2 $. You have to click on the coins to have the total.
    So each coin must have a valour, and the swf have to stop when the amount is bigger than the requested.

    I hope you could understand me.
    Thanks.

  5. #5
    Junior Member
    Join Date
    Dec 2006
    Posts
    3
    VexForge, what you say may help me. How could I do that?

  6. #6
    God yeps's Avatar
    Join Date
    Dec 2005
    Location
    :noitacoL
    Posts
    660
    hey... i think i might be able to help...

    if you have an .fla file, that would also be helpful... but you can set up a varrible for the mony, for example _root.mony = 0 then you can have code on the mony like...


    Code:
    onClipEvent (enterFrame) {
    	this.onRelease = function() {
    		_root.mony += 10
    	}
    then for the part about if the mony is = to a certian amount you would rite

    Code:
    if (_root.mony>100){
    	trace("YAY!")
    }
    i hope that helps some

  7. #7
    Amazed and Amused Mazoonist's Avatar
    Join Date
    Mar 2006
    Location
    Northern California
    Posts
    201
    Okay, this is extremely simple, but maybe it'll help get you started:

    Here are the objects you'll need to create on the stage:
    amount_txt (a dynamic textbox)
    penny_btn (button)
    nickel_btn (button)
    dime_btn (button)
    quarter_btn (button)
    dollar_btn (button)
    Code:
    var amount:Number = 0;
    updateAmountTextbox();
    function updateAmountTextbox() {
    	amount_txt.text = amount;
    }
    penny_btn.onRelease = function() {
    	amount += 1;
    	updateAmountTextbox();
    };
    nickel_btn.onRelease = function() {
    	amount += 5;
    	updateAmountTextbox();
    };
    dime_btn.onRelease = function() {
    	amount += 10;
    	updateAmountTextbox();
    };
    quarter_btn.onRelease = function() {
    	amount += 25;
    	updateAmountTextbox();
    };
    dollar_btn.onRelease = function() {
    	amount += 100;
    	updateAmountTextbox();
    };
    What's still missing is a function that will convert your amount to currency before it displays it (optional anyway). Also missing is any kind of function that tests to see if the amount has reached a target amount. To add that in, make a variable to represent the target amount, and a function that tests to see if the amount is equal to it yet. Call the function whenever the amount is incremented.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center