A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: car in certain area

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    1

    car in certain area

    hi guys
    I'm trying to make my first (serious) game - car parking game
    I need a some insight or code to make level finished ONLY if WHOLE car is in certain area. So hitTest is not solution at all, I also tried multiple hittTest but that's not best solution. To explain easier i draw this:



    Thanks in advance!

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Use this on your car movieclip:

    Actionscript Code:
    onClipEvent(enterFrame){
        b = this.getBounds(_root);
        b2 = _root.park_space.getBounds(_root);
        if((b.xMax < b2.xMax && b.xMin > b2.xMin) && (b.yMax < b2.yMax && b.yMin > b2.yMin)){
            trace("YOU PARKED CORRECTLY");
        }
    }

    change park_space to the instance name of the movieclip which is the parking field!
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

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