repel and actor?

DookiDooki Member Posts: 247
edited November -1 in Working with GS (Mac)
Hey all,

I'm trying to set an actor (a block) so that it will repel another actor. Can someone steer me in the right direction? Should I look into using magnitude for this?

Thanks!

Comments

  • DookiDooki Member Posts: 247
    ...anyone out there? :-)
  • RattleheadRattlehead Member Posts: 485
    Yep, I would look at TSB's demo that displays the distance between multiple actors and in your case, make the other actor move in an opposing direction; either using the inverse of the angle of the actor moving towards it or in a random direction.

    http://gamesalad.com/game/play/46203
  • DookiDooki Member Posts: 247
    Interesting. Thanks for the link.
    In my case, I want the moving actor to be affected by the repelling object. So imagine if a balloon (actor) were drifting across a room and comes in contact with a fan that blows it up.
  • RattleheadRattlehead Member Posts: 485
    In the example that you just posted, I would have an invisible actor in front of my fan providing 'radar' for the fan actor and if my balloon actor overlapped with it, then I would move the balloon in a direction that made sense to how the fan was blowing.
  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    Not sure which is more efficient processor-wise, but you could also constrain the balloon's X and Y attributes to game attributes. Monitoring that info from the fan actor would allow you to determine how close the balloon is (magnitude) as well as its angle in relation to the fan (vectortoangle).
  • DookiDooki Member Posts: 247
    Hmmm, I didn't think about processor issues. If I did make a fan type object it would mean that there was constant motion in a direction. OK, I get that.

    How about if that repel object was like a trampoline? So when the actor comes in contact with it it bounces away, or to a new direction. Ideally my main actor would travel along and have a change a direction from these repelling objects. I would like to be able to move/rotate these objects in order to help direct the main actor through the scene. Makes sense? BTW, the balloon was just a reference. The main actor is not a balloon.

    Thanks!
  • DookiDooki Member Posts: 247
    OK, I really could use some help on this one. So far, I've been testing with two actors.

    Actor1
    --Move:relative to actor, speed 100
    --Collide: with actor2
    --Accelerate 90* relative to actor, speed 300.

    Actor2
    --no behaviors
    --and is set at an angle in the travel path of actor1. Ideally when actor1 collides with actor2 it should influence to change actor1's direction and speed. Think of kitty cannon as it hits a trampoline mid flight it gets a boost!

    Obviously this is not working. I have a hunch that I should be looking at magnitude but I'm not clear on this this works. Anyone??
Sign In or Register to comment.