Is there an ACTOR in this position?

arvanitisarvanitis Member Posts: 26
edited November -1 in Working with GS (Mac)
Hello. I want to know if in a specific coordinate is some ACTOR eg

is any ACTOR with TAG 01 in PositionX and PositionY of the screen?

Thank you

Comments

  • cbtcbt Member Posts: 644
    Try asking this in Macedonian dude. I'm sure more people will understand...
  • arvanitisarvanitis Member Posts: 26
    If you know you answer, if not do not bother
  • micksolomicksolo Member Posts: 264
    So basically you want to know if there is an actor in a certain point and you want an attribute to remember this. I assume so it won't spawn another actor in a position that is already filled?
  • arvanitisarvanitis Member Posts: 26
    Yes! When I touch the Actor I want to MOVE TO the position I want if the position is empty!!!!
  • AppsRacKAppsRacK Member Posts: 346
    This can be done easily if theres array in GS as you can actually iterate through the array to check. It can be done in GS but it's a bit tricky as you need to set an attribute on each location on the scene. Ex if you have 20 location you'll need 20 attributes and you need to check them 1 by 1.
    -drahc
  • wouterwouter Member Posts: 174
    make an attribute positionX = self.position.X (so if you're actor is called actor1 = actor1.Position.X) this is his x coordinate of actor1. do this also with positionY.
    make an attribute with the coordinates where you want them (coordinate x and y)
    if positionX=coordinateX{
    if positionY=coordinateY{
    //in position
    }
    //x in position y not
    move actor1 to coordinateY
    }
    otherwise{
    move to coordinateX and y
    }

    wouter
  • arvanitisarvanitis Member Posts: 26
    Thank you I will try them
  • micksolomicksolo Member Posts: 264
    yes please let us know if it works, I'm interested in this too.
Sign In or Register to comment.