A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Problem with applicating map system... reversed (pedagogic .fla included!)

  1. #1
    Senior Member
    Join Date
    Jul 2003
    Posts
    119

    Problem with applicating map system... reversed (pedagogic .fla included!)

    Sorry, couldn't think of a better title

    Here's the thing; i have an RPG map system that works pretty well with hittest and transitions (This system is frame nr 1 on the .fla) basically its the character walking around.

    Now i want to expand this system to an overworld thing. In essence have the world walk around the character (with the character immobile in the middle). This was fairly easy. Just putting the character in the middle, taking the moving script and put it on the map instead and reversing all the keys (Up is down, etc) as you can see in frame 2 the desired effect is there.

    Except.

    That im having trouble adjusting the associated hittest that tells the character (now map) to stop when he hits a wall or object (the character)

    its in essence the object or wall that hits the man and its supposed to stop

    Can someone take a look at my .fla and see if they can adjust the hittest approprietly? I've been experimenting but cant seem to get it to work.

    The .fla itself have text and arrows that should explain the problem.

    Thanks!

  2. #2
    Senior Member
    Join Date
    Mar 2010
    Posts
    157

    fixed it

    I have attached the corrected file.
    Attached Files Attached Files

  3. #3
    Senior Member
    Join Date
    Jul 2003
    Posts
    119
    ack! I get "Unexpected file format" when i try to open it :/

  4. #4
    Senior Member
    Join Date
    Mar 2010
    Posts
    157
    oh well, all i changed was this:
    put the code for the map back in the character like in the first frame and changed this at the end of the code:


    } else {
    _root._x+= _x - x;
    _root._y += _y - y;
    _x = x;
    _y = y;
    }
    if (_root.hit.hitTest(x, y, true)) {
    }
    }

  5. #5
    Senior Member
    Join Date
    Jul 2003
    Posts
    119
    Very nice! That takes care of the basic problem, but theres two bugs i can spot:

    1. Everything stops the movement, including the roads and grass. Is there anyway to make the hittest apply specificly to the "hit" part inside the "map" movieclip

    i tried this:
    if (_root.mapp.hit.hitTest(x, y, true)) {
    but that didn't work.

    2. It seems that you also somehow move the static room in the first frame when walking around since when you jump back from the big map the static room has changed position depending on how you walked. How to get around that?

    Thanks for your help!

  6. #6
    Senior Member
    Join Date
    Mar 2010
    Posts
    157
    place those items on another layer or in another object and don't name them "hit".

    as to the static room, remove the two extra lines there. only add them in the 2nd frame.

    does it work now?

  7. #7
    Senior Member
    Join Date
    Jul 2003
    Posts
    119
    Quote Originally Posted by koenahn View Post
    place those items on another layer or in another object and don't name them "hit".

    as to the static room, remove the two extra lines there. only add them in the 2nd frame.

    does it work now?
    First of all (a little late) thanks alot, the script is amazing and works perfectly now. It does exactly what i wanted it to do.

    So this is just a bonus, it could be worked around in some otehr way i supposed but i thought i'd ask:

    I was wondering if theres a line of code one could add to the script that makes an exception of certain movieclips. For example i have movieclips called "statusbar", "inventory" and "variables" that i would like to stand still on the frame while everything else moves.

  8. #8
    Senior Member
    Join Date
    Mar 2010
    Posts
    157
    Sorry about my late reply, too

    You should put them inside another movie clip, and call it something like hud (as in head over display?)
    Then add some code that does the same to hud as it does to player.
    So if you had player._x += speed, now you use hud._x += speed, too.
    Does that help?

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