A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Help---HungryGamer

Hybrid View

  1. #1
    Senior Member Pazil's Avatar
    Join Date
    Sep 2006
    Location
    Ontario, Canada
    Posts
    913

    Help---HungryGamer

    OK...I want to make all those fancy, awsome, games out there...but...I really need filling in on actionscript...

    1.Basically, can everyone please fill me in about arrays? I've heard of them, and imagine they are an easier way to organize objects...as in, instead of writing the same actions for every object, you just write actions for the array...Please tell me if I'm wrong, or not...
    I just want to know how you make em, how you use em, and I need to know how to randomise things...

    2.Dynamic text??? How do I program something so that on the click of a button, randomised text appears, or how do I make a score bar? I've read a bunch of tutorials on score bars, but...When I do what they say, and I try out my game, all the score bar does(when it's supposed to go up by 1), it says NaN...I just need how you can program text, instead of making frames for it...

    3.Clicking movement? How do I make an MC move where you click? Or move towards an object? I read things on the click one, but what it does, is basically:
    Tells the MC to move to wherever you clicked in a certain number of frames!!! I want it so it moves to where you clicked at a certain speed!!! And while your at it...can you tell me how to make your figure face the direction you click, not follow your mouse, but only face where you clicked, and remember, I don't want it completely from the top, I want my game from an angle (yes, I know I would have to draw each frame of where it faces, but I just need to know how does it make it go to another frame depending on where you clicked)...

    I hope all this made sense...and please help...I really want to make awsome games, and this is pretty much all I need.

    And please also fill me in on variables, inventories...
    WIP-ZOMBIES

    I love vegetarians! More meat for the rest of us!

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    I think you need a book.
    Maybe look in the games forum for an advice on which would be the best for you.

    gparis

  3. #3
    Senior Member Pazil's Avatar
    Join Date
    Sep 2006
    Location
    Ontario, Canada
    Posts
    913
    I like advice from other people here on flashkit, since then, if I have any questions, I can ask them, which with books, you can't do...
    WIP-ZOMBIES

    I love vegetarians! More meat for the rest of us!

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    I see and understand your point.
    Then, you should ask only one question per thread, that way, you will more likely get an answer.

    gparis

  5. #5
    Senior Member Pazil's Avatar
    Join Date
    Sep 2006
    Location
    Ontario, Canada
    Posts
    913
    ...fiiiiiine...I guess I'll start with arrays and variables, since I know the arrays and variables are commonly incorporated...
    WIP-ZOMBIES

    I love vegetarians! More meat for the rest of us!

  6. #6
    Member
    Join Date
    Sep 2006
    Posts
    82
    you ask too many basic questions. try searching on google, i've seen tutorials directly about these, or atleast the clicking one. The others are easy to find.

  7. #7
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Here are links about both:
    Arrays:
    http://www.adobe.com/support/flash/a...ionary059.html

    Variables:
    http://livedocs.macromedia.com/flash.../00001192.html

    If you have a specific question about Arrays or variables, fell free to ask.

    gparis

  8. #8
    Senior Member Pazil's Avatar
    Join Date
    Sep 2006
    Location
    Ontario, Canada
    Posts
    913
    Thanks so much! I'll try those...can you just tell me something really quickly, no explaining? I'm trying to limit the speed on something...this is what I tried:

    ...other code...

    this._x+=5<20
    this._x-=5>-20

    ...other code...

    What I'm trying to do here, is limit the speed to 20 both ways...
    WIP-ZOMBIES

    I love vegetarians! More meat for the rest of us!

  9. #9
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Apparently, in the valid portion of code, that is:

    code:
    this._x+=5;



    you object move at a constant 5 pixels per frame. It'll never get to 20px/frame.

    Earlier, in your thread you were talking about controlling speed/movement versus time. Here is a code that you can analyze that does this:

    code:
    onClipEvent (load) {
    targetX = 300;
    // specify target coords
    targetY = 300;
    duration = 2*1000;
    // duration in milliseconds (1 second)
    startX = _x;
    startY = _y;
    dx = targetX-startX;
    dy = targetY-startY;
    startTime = getTimer();
    this.onEnterFrame = function() {
    r = (getTimer()-startTime)/duration;
    if (r>1) {
    r = 1;
    delete this.onEnterFrame;
    }
    // this next line is optional - it adds easing
    r = r*r*(3-2*r);
    _x = startX+dx*r;
    _y = startY+dy*r;
    };
    }



    This code is, as is, to be place while selecting the object, on it's own object action wondow. Of course you could convert it to a function, if you need to reuse it for multiple objects.

    Here's a link on how to make functions:
    http://www.adobe.com/support/flash/a...ionary373.html

    gparis

  10. #10
    Senior Member Pazil's Avatar
    Join Date
    Sep 2006
    Location
    Ontario, Canada
    Posts
    913
    Number one, sorry, I messed up on the example, number two...I don't know anything on functions...I'll try that link...

    ANYWAYS, the correct code was:

    onClipEvent(load) I have:
    xspeed = 0

    then, on the onClipEvent(enterFrame)
    I have:

    xspeed+=5<20
    xspeed-=5>-20(these are on different "if" things)

    Then at the bottom, I have

    this._x+=xspeed

    ...

    it all works fine, except for the speed limit.
    WIP-ZOMBIES

    I love vegetarians! More meat for the rest of us!

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