A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: isometric help needed

  1. #1
    Member
    Join Date
    Dec 2001
    Posts
    34
    Can anyone help me out?

    I'm basically trying to build a site based around a toy construction site which allows the user to drive their wee truck around an isometric environment.

    I've FTP'd a basic mock up to illustrate my problem:

    http://www.holden9.freeserve.co.uk

    If I've got a building on one layer and the truck with the isometric calculations on another, either above or below it, how do I get the truck to appear in front of the building when its in front of it and behind it when (you get the idea).

    Is there any way of stopping the truck when it collides with and object. I'd also like to keep the path that the truck travels along restricted to the road. Is this possible or should I go back to 2D?

    Any advice would be great because I'd love to try and fit in some detail to the environment. (I've made models of a mobile library and a stolen Ford cortina). Web design doesn't get much more fun.

    Thanks.
    barrie

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    You can use swapDepths() with truck object and building object when the truck gets in front or behind the builing. swapDepths works better with duplicate or attached clips.
    And use hitTest() to detect collisions
    Read about both methods and post back if problems
    gparis

  3. #3
    the usual
    Join Date
    Jul 2000
    Posts
    1,482
    forget hitTest() go tile based check out the games forum there is/has been a lot of tilebased games produced!

    hth

  4. #4
    Senior Member
    Join Date
    Jul 2001
    Posts
    202
    trickman speaks the truth. This can be quite tricky. Best way is to have the game keep a tile-based 2D representation of the world which it looks at. If the truck is going to be going into a tile with a building in it, the code doesn't allow the truck to move any further.

    It's like looking at a map of your world top-down. You would see the truck and the squares (tiles) around it with obstacles on. The code would look at the direction the truck wants to go in, look at the tile there and let it move or not based on that tiles' contents. The actual drawing of the truck moving in the isometric world becomes the last thing the code does (weird huh?! )

    You're gonna need a whole hunk o' arrays to get this sorted but it's worth it. Then the swapdepths thing can run off the values of the arrays and the position they are in the the main block of arrays.

    Leon

  5. #5
    Member
    Join Date
    Dec 2001
    Posts
    34
    Cheers boys,

    I don't think I fully realised the implications of creating this kind of environment when I started, it just seemed like a good idea at the time.

    I'm a graphic design student and the projects' getting marked in 3 weeks so I'm going to be on perscription drugs and cold showers untill then (it's my final year).
    Sod it though, I really want it to work.

    Thanks for the advice, I really appreciate it.

    Barrie.

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