Is there a way to make this easier?

LordTarantorLordTarantor Member, PRO Posts: 890
edited November -1 in Working with GS (Mac)
Hi everybody:
In my Chupacabras game, there were scenes where the Chupacabras was running after some cabritas. Each cabrita actor has the constrining victim x and y for positioning. Since I have 5 cabritas I put in each one a victim number (so one was victim 1, another was cabrita 2 and so on). then a rule for each one that say when predator close = 1 move to...
In the chupacabras actor I had to make a rule for each cabrita. You know the proximity 1 the 2 the3 and so on. I had to do this because if all cabritas used the same number, whe the chupacabras get close to one all of them start running even if they were far away.
I want to do something similar but the thing is that now the are a lot more victims so I was wondering if there were an easier way or should I to put more numbers to the victims and more rules to the predator

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Do you have one hero that you control and mulitple bad guys? Or are there multiple heros and mulitple bad guys?

    If there is one hero then all you need to do is create self attributes in the cabritas.

    So create a self boolean called active and a real attribute called distance.

    Constrain self.distance to magnitude(self.positionX-game.HeroX,self.positionY-HeroY) (you'll have to create HeroX and HeroY and constrain them to the main player's X and Y).

    Then have a rule that says when self.distance is less than ????
    change attribute self.active to 1
    otherwise
    change self.active to 0

    Then have another rule that says
    rule - when self.active is true
    accelerate towards HeroX and HeroY
  • LordTarantorLordTarantor Member, PRO Posts: 890
    Oh thanks a lot scitunes, that was great.
    What about if there are more heroes? I control 1 and the other are the computer.
Sign In or Register to comment.