A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: my platform engine but...

  1. #1
    Senior Member tongue of colicab's Avatar
    Join Date
    Nov 2001
    Location
    The Netherlands
    Posts
    329

    Need some help on my platform engine

    hi,

    here's my engine for my platform game but I still need to add some thing like for example if you press the left arrow key it needs to display the mc left the same thing for jump, duck, run, shoot etc. Only I dont know how :S I made this more than a year ago and since than I did no AS so I kinda forot most things :'(

    this code is put in the hero mc so I dont know if I should move it somewhere else.

    here it is:

    onClipEvent (load) {
    gravity = "on";
    old_y = this._y;
    jumping = false;
    dir = "decel";
    }
    onClipEvent (enterFrame) {
    distance = old_y-this._y;
    if (Key.isDown(Key.LEFT)) {
    this._x -= 10;
    }
    if (Key.isDown(Key.RIGHT)) {
    this._x += 10;
    }
    if (gravity == "on" && jumping == true && dir == "decel") {
    this._y += 15;
    }
    if (Key.isDown(Key.SPACE) && jumping == false) {
    old_y = this._y;
    jumping = true;
    dir = "accel";
    }
    if (dir == "accel") {
    this._y -= 15;
    }
    if (distance>=70) {
    dir = "decel";
    }
    if (_root.back.hitTest(this._x, this._y+43, true)) {
    gravity = "off";
    jumping = false;
    old_y = this._y;
    } else {
    gravity = "on";
    jumping = true;
    }
    }
    onClipEvent (load) {
    moveSpeed = 10;
    _root.laser._visible = false;
    laserCounter = 1;
    }
    onClipEvent (enterFrame) {
    if (Key.isDown(Key.CONTROL)) {
    laserCounter++;
    _root.laser.duplicateMovieClip("laser"+laserCounte r, laserCounter);
    _root["laser"+laserCounter]._visible = true;
    }
    }

    edit: for those of you that want to see some of the animations check http://home.zonnet.nl/caroladevries/cj/bb_anime.swf
    Last edited by tongue of colicab; 11-17-2003 at 11:00 AM.

  2. #2
    Senior Member tongue of colicab's Avatar
    Join Date
    Nov 2001
    Location
    The Netherlands
    Posts
    329
    ok, I just figured out the hittest with the freaking ground works like crap too Some1 got some ideas on how to make this work better? I also need to jump on platforms and you must be able not to walk true walls.

  3. #3
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    so it's a platform game...?

    ok, i have an art based open source located here:
    www.gotoandplay.it , article section. the hitTest is *almost* perfect (let's say it's perfect, then ) and the animations are playing correctly

  4. #4
    leight.com.au leight's Avatar
    Join Date
    Sep 2002
    Location
    australia
    Posts
    1,437
    yeh marmotte's platform engine is great! the hitTest with the groud is better than mine mine doesnt have the walking anims etc. But if you wana check mine out, its in my sig.

    hope it helps

  5. #5
    Senior Member tongue of colicab's Avatar
    Join Date
    Nov 2001
    Location
    The Netherlands
    Posts
    329
    marmotte I tried but I really cant get the thing to work :@ I copied every piece of code into my hero mc and all (changed the names too) but Just nothing happens.

    @leight: cool engine but just as with marmotte's engine I just cant get things to work :S

    I feel really stupid not getting things to work, I guess, My as skills are just 0.0. Is one of you willing to help me out getting the basics to work?

    thanks for the replies

  6. #6
    .fla vont's Avatar
    Join Date
    Oct 2001
    Posts
    473
    I, too, agree .. marmotte's open source is wonderful, here's the same file, but in my way and without marmotte's file maybe I couldn't do something like this at all, so take a close look at marmotte's open source and study it hard or you may want to take a look at mine The AS is on the char MC .. I hope you find it clear and easy
    Bubble Bobble

    .. hey leight, did you buy Prince of persia on PS2

    good luck.
    Last edited by vont; 11-18-2003 at 11:50 AM.

  7. #7
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    thanks for the nice words, vont and leight ^_^
    i remember your file, vont, and i thought it was mine! never mind, the file i posted at gotoandplay is my newest version, now pixel perfect... but it remains art based...

    tongue of colicab, sure i can explain everything, but please try to learn from my file (or some working file)(i know, i know, i truely HATE studying AS with other's files and prefer experiment by myself... that's probably why i spent WEEKS on creating my first hitTest (rocky raccoon wandering in a zelda world, it brings back sweet memories )... anyway, it paid at the end. oh, and my file is fully commented, so i think it's not that hard to understand after a while, no?

    oh, maybe instead of copying my AS into your file, why don't you simply change the gfx i used and put yours? (ok, if you do that you will not learn anything... urm!)

  8. #8
    leight.com.au leight's Avatar
    Join Date
    Sep 2002
    Location
    australia
    Posts
    1,437
    how about not copying the AS (copy paste) but look at a section of the code, study it, then try and retype it in your AS window.

    vont: nah mate, not yet... gota wait till im with dad at christmas before i can see a PS2 again :P I WANT IT did u get it? looks prety mad!

  9. #9
    .fla vont's Avatar
    Join Date
    Oct 2001
    Posts
    473
    Originally posted by leight
    vont: nah mate, not yet... gota wait till im with dad at christmas before i can see a PS2 again :P I WANT IT did u get it? looks prety mad!
    leight: yeah, I did , you won't believe your eyes, the game is amazing .. The story, char, music and the environment are great .. hehe, I'm out of words, really

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