How do i make a magnet ?!

JamieOneilJamieOneil Member Posts: 877
edited November -1 in Working with GS (Mac)
How do i make a magnet ? so when an actor gets to close to it, he accelerates towards it and then sticks to it ?

thanks in advance.

Comments

  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    I would do something like that: You have your Hero actor, and magnet actor. Make also a second magnet actor, resize it to be bigger than the original actor, and make it invisible. Constrain position of one magnet actor to the second, and in the invisible actor put a rule that when Hero player collides with that actor, some game attribute changes to True. In your main magnet actor put a rule that, when this game attribute is True, he will move to your Hero actor (use constrain behavior).

    Hope that you understand what I said :)
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    use magnitude to determine the distance and when you want the actor to be in the magnteic field. Heres the video for that

    http://www.youtube.com/user/GameSaladCookbook/#p/search/0/_p2s61XVZ0o

    after you do that youll need to make 2 real attributes ill call them magnetx and magnety

    in the magnet actor constrain magnetx to self postionx and constrain magnety to self position y

    then in whatever actor you have the magnitued set up so itll be affected by the magnet, where you have your rule when magnitude attribute you make is > or < whatever you want

    have a accelerate toward behavior in that rule and for the x positition in that behavior select the attribute magnetx and for the yposition select magney
  • mangaroomangaroo Member Posts: 419
    I would have done it word for word the way TheMoonWalls said. JohnPapiomitis's idea of magnitude sounds awesome, defiantly a video to check out myself, i wonder which method is best for performance?
  • mangaroomangaroo Member Posts: 419
    TheMoonwalls said:
    I have no idea. I don't make this type of games. My idea was the first one in my head :)

    Same here..
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    mangaroo said:
    Same here..

    Sorry for the offtopic, but you have a great avatar :) It's from your game?

    I would use John's way. He is more experienced in this type of games, than me.
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    Use Jon's way, I have a magnet in my latest game and is pretty much identical to that.

    Ace
Sign In or Register to comment.