A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] [HELP] tile based movement of objects

  1. #1
    Eternal Newbie
    Join Date
    Apr 2006
    Location
    Bitter cold Hell of the crappy NW
    Posts
    392

    [F8] [HELP] tile based movement of objects

    I have done tutorials, I have written my own code, and I am making a small tile based game.

    basically I am using tiles to create the maps of the "world" (a room as it were) and I have all that done. I have done corner detection, built my maps and tile sets and I have built my character.

    What I am attempting to do now is have something work other than the character moving around the room I mapped. I have another MC named moveME and I want the character to be able to push it around the room when he walks "into" it.

    Currently the character is on level 10000 and the moveMe MC is on 9999 (I don't think this matters.)

    I just can't seem to get anything working that will make him move the MC. I can place it on stage on top of the map (using same code as placing character on map). but then I am stuck.

    I have searched for 4 days here at FK, google, adobe livedocs, and various other sites.

    Nothing I have found seems to work so far, so I am looking for either ideas, code snippets or new search terms. Anyone have any ideas?

    Secondary to that I have forseen another problem. The map is generated with code, and I want to swap tiles when the moveMe is moved over certain ones. do I need to do anything special for this to happen? The map tile and the swap to tile are in the same tile set, so I am *thinking* I can just swap keyframe IDs with a hit test or something. Ideas on this one are helpful as well!

    Thanks for looking!

    ~MoN
    If I am wrong, please just correct me and move on.. there is no need for all that pointing and laughing! ~MoN

  2. #2
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    I have searched for 4 days here at FK, google, adobe livedocs, and various other sites.
    it´s not that for every idea there´s a tutorial- sometimes you have to come up with something yourself.

    for example from what I understood from your situation you propably need to do the following:
    - put the moveable objects in a array
    - loop through that array each frame to check if one of them is close to the player
    - if one object is close enough check if the movement vector (the displacement of the player) intersects with the object boundary
    - if so intersects move the objects by the intersection value of the movement vector and the boundary

  3. #3
    Eternal Newbie
    Join Date
    Apr 2006
    Location
    Bitter cold Hell of the crappy NW
    Posts
    392
    I thought about that, but I think hitTest() would be pretty CPU intensive wouldn't it? maybe not. I will have to try somethings out. Back to the drawing board.

    ~MoN
    If I am wrong, please just correct me and move on.. there is no need for all that pointing and laughing! ~MoN

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