The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 7 of 7

Thread: What's a better way to handle grounds with AS3

  1. #1

    What's a better way to handle grounds with AS3

    I had no problem doing this in AS2 when I tried creating grounds in a sidescroller shooter game, but with AS3 the only way i can figure it out seems inefficient (though it does work). I'm trying to simplify the following code to make less copy and paste work for myself because I'll end up having many more platforms for the player to jump from.

    ...
    if (!jumping && (!player_mc.hitTestObject(background_mc.ground_mc1 ) || !player_mc.hitTestObject(background_mc.plat_mc1)|| !player_mc.hitTestObject(background_mc.plat_mc2) || !player_mc.hitTestObject(background_mc.ground_mc2) )) {
    jumping= true;
    jump = 0;
    }

    if (falling && (player_mc.hitTestObject(background_mc.ground_mc1) || player_mc.hitTestObject(background_mc.plat_mc1) || player_mc.hitTestObject(background_mc.plat_mc2) || player_mc.hitTestObject(background_mc.ground_mc2)) ) {
    jump = 20;
    jumping = false;
    falling = false;
    }
    ...

    as you can see i'm just checking every MC within my background_mc for collision. Ideally I would like to have one check here for collision, but if i were to run the same check on just background_mc the player is counted as colliding even when in open space because of how flash draws its boxes around the movie clips. Does anyone have any suggestions for how i should approach this? It's not to big of a deal right now but when i decide to place my walls into the game it will become a major pain.

  2. #2
    now that i think about it, if someone knows how or could direct me to a post about handling slopes for a player to run up in AS3 i think that would resolve the same problem. Just a thought, i could be wrong.

  3. #3
    I've always made my platformers tick by registering the player to a grid or matrix, and checking him against another matrix that contained data for the scenery or monsters. You should check out tonyPA's tile tutorials, they are awesome for small platformers.

    http://www.tonypa.pri.ee/tbw/start.html


  4. #4
    Quote Originally Posted by shazzmoe View Post
    now that i think about it, if someone knows how or could direct me to a post about handling slopes for a player to run up in AS3 i think that would resolve the same problem. Just a thought, i could be wrong.
    see this might help...
    Attached Files Attached Files

  5. #5
    thank you guys so much, its seems pretty simple and i have the basics of it working after looking at these for 10mins.

  6. #6
    Quote Originally Posted by rahul_7star View Post
    see this might help...
    Unfortunately that is a pretty bad example. This method doesnt fix problems with characters going through the floor or even mention slope rotation.

    Quote Originally Posted by Lou View Post
    I've always made my platformers tick by registering the player to a grid or matrix, and checking him against another matrix that contained data for the scenery or monsters. You should check out tonyPA's tile tutorials, they are awesome for small platformers.

    http://www.tonypa.pri.ee/tbw/start.html
    This example is better but only works with grid/tile-based scrollers and the ground has to be an exact 45 degree angle.

    I'm working on a method that resolves all issues and works with any bitmap image (as a background). I'll be making a post about it very soon but you can see what I have so far here:

    http://teamimpulse9.com/Platformer/Platformer.html

    In the meantime, I'd suggest checking out this tutorial :

    http://www.worldfaction.com/forums/v...php?f=18&t=178

  7. #7
    http://www.worldfaction.com/forums/v...php?f=18&t=178 deals with AS2 la.

    in As2 its easy to code..but in as3 a bit tricky ..i knw few bugs are there but that can be resolved.

    this work fine with as2 see this.
    http://www.kirupa.com/forum/showthre...37#post2310737

    and i am waiting eagerly for your AS3 code...

    Quote Originally Posted by substance View Post
    Unfortunately that is a pretty bad example. This method doesnt fix problems with characters going through the floor or even mention slope rotation.



    This example is better but only works with grid/tile-based scrollers and the ground has to be an exact 45 degree angle.

    I'm working on a method that resolves all issues and works with any bitmap image (as a background). I'll be making a post about it very soon but you can see what I have so far here:

    http://teamimpulse9.com/Platformer/Platformer.html

    In the meantime, I'd suggest checking out this tutorial :

    http://www.worldfaction.com/forums/v...php?f=18&t=178
    Last edited by rahul_7star; August 8th, 2008 at 05:26 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012