A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: hitTestObject but using co-ordinates?

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    12

    hitTestObject but using co-ordinates?

    (CS5.5 AS3)

    I'm trying my first 2D maze game, and when a key has been pressed the code will look to see what object is next to the player. So I want to do a hittest without actually moving the player to find out what he is standing next to.

    This is what I need:
    if(player[with a variable added onto its x and y values].hitTestObject(target)){
    //do stuff

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    The easiest way is to store the location of the player, move the player and do the hit test, then move the player back to the stored location.

  3. #3
    Junior Member
    Join Date
    Nov 2013
    Posts
    12
    Quote Originally Posted by dawsonk View Post
    The easiest way is to store the location of the player, move the player and do the hit test, then move the player back to the stored location.
    That's what I ended up doing. It works.

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