chasing another car?

allc1865allc1865 Member, PRO Posts: 777
Hello...In my game, I have the player chase a car. I have looked on a way to do this, but I couldn't find anything. I want to make the 'enemy' run and stay away from me while the player goes to catch it. Is there any way to do this?
Thanks.

Answers

  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291
    @allcCan you please try to explain in more detail as to what you are trying to accomplish as your wording is a bit confusing and not able to picture exactly what you are trying to accomplish. Thanks!
  • BellowBellow Bartender Member, PRO Posts: 227
    you must put a little ai on this car. try magn. with distance and use max speed. or try to make waypoints for running car.

  • BellowBellow Bartender Member, PRO Posts: 227
    i was thinking like some gta 4 mission. chase another car and get it mission ? .
  • mounted88mounted88 Member Posts: 1,113
    Do you ever want the car 1 to catch the car 2 or just follow? If it's just follow you can constrain car 1 to car 2 and he will be hot on his tail but will never catch him.
  • allc1865allc1865 Member, PRO Posts: 777
    @KillerPenguinStudios, Okay. I have two cars. One is the player (you), and the enemy. I want the enemy to be controlled by the computer, if you will. I don't want you to be able to control the enemy. The player car (you) has to chase the enemy and nab him. I want to know how I would set up rules to make the enemy move an run away from the player without you controlling him.
    Hope that explains it.
    Thanks! :)
  • allc1865allc1865 Member, PRO Posts: 777
    mounted88, Hi. Yes, I want the player to catch the car.
  • mounted88mounted88 Member Posts: 1,113
    I'm not sure then on the AI stuff. Sorry I couldn't help.
  • allc1865allc1865 Member, PRO Posts: 777
    It's basically a cop chasing the criminal type of game. I want the criminal to be at one point, then run through a maze and the cop has to chase and catch him.
    The criminal is headed towards the exit if the cop doesn't catch him in enough time.
  • allc1865allc1865 Member, PRO Posts: 777
    @mounted88, Okay. Thanks
  • mounted88mounted88 Member Posts: 1,113
    You could have the cop constrained to the criminal.

    Cop add a
    Constrain attribute self.position.x to current scene-layers-criminal-self.position.x

    Constrain attribute self.position.y to current scene-layers-criminal-self.position.y-40 (play around with that 40 number) this offsets the cop from your criminal.

    Timer
    Every 1 sec change attribute self.position.y to self.position.y+1

    this will make him close in on the criminal every sec. You can mess around with the numbers but should be able to work.
  • allc1865allc1865 Member, PRO Posts: 777
    And that would make my criminal move as well?
  • mounted88mounted88 Member Posts: 1,113
    Cop=car 2
    Criminal = car 1

    Car 1 should already have your movement behaviors in it and add what I said above to car 2 and he will follow with a gap between car 2 and car 1
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Constraining the two cars together won't really work if you've got traffic though. If you switch lanes and the police car is following (constrained) then they will switch lanes too. It's highly likely it would hit a traffic car as it's switching lanes, ruining any sort of realism you're trying to go for.
  • allc1865allc1865 Member, PRO Posts: 777
    I want the actor criminal to make if from one point on the maze to another point on the maze.
  • mounted88mounted88 Member Posts: 1,113
    Constraining the two cars together won't really work if you've got traffic though. If you switch lanes and the police car is following (constrained) then they will switch lanes too. It's highly likely it would hit a traffic car as it's switching lanes, ruining any sort of realism you're trying to go for.
    @kevincross Depends on if the traffic is front of you and how spaced out the traffic is. Because your moving your main actor to avoid traffic coming at you. Then the cop car will also avoid the traffic by moving with the main actor.

    But if you have to move quickly then yes it might catch some traffic. Good point.
  • allc1865allc1865 Member, PRO Posts: 777
    I learned that creating a path for your actor isn't something that GameSalad can do; you have to do it yourself. That isn't something I want, so thank you everyone for your replies! :)
Sign In or Register to comment.