Make an object stick to another object.

RDRD Member Posts: 88
edited December 2011 in Working with GS (Mac)
Hello there GameSaladers, I was wondering if there is a way to make an actor fly on to another and stick to it on impact. Kinda like a stickbomb hitting a car and being stuck onto it as it moves about.

Comments

  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    Hi dantuma/Rd
    search the creator templates theres one there,
    Ill try and make one if you can't find it..
    just email me at thermoapps@gmail.com
    ---------------------------------
    Posted by LeonardDeveloper, contact me on thermoapps@thermo-apps.com
    Be sure to visit my WEBSITE
    Have a look at my GS Tutorials
    Image and video hosting by TinyPic
    ----------------------------------------------------
    Yours Sincerely,
    Jack Leonard
  • RDRD Member Posts: 88
    Er, any idea what the pre-made template is called?
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    Nope! :), But i will try and get one working of ryou
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Watch the cookbook video on actor distances and modify it to attach to another.
  • master200012master200012 Member Posts: 372
    Well, I think you could do:
    Rule
    When actor receives event overlaps or collides with (your other actor),
    constrain attribute : self x [to] other actor's position x + (other actor's position x - self x)
    constrain attribute : self y [to] other actor's position y + (other actor's position y - self y)

    To do this you need to create two real game attributes for your main character, setting them to the x and y positions accordingly.
    Not sure if it works, but it's worth a shot! ;)
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    @master200012
    It doesn't work very well..... thats what i had originally thought....
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    make 2 self real attributes in the actor you want to stick. Call them stickX and stickY

    Make a rule when actor collides with whatever you want it to stick to:
    change self motion linear velocity x to 0
    change self motion linear velocity y to 0
    change stickX to self position x
    change stickY to self position y
    constrain self position x to stick x
    constrain self position y to stick y

    cheers
  • ozboybrianozboybrian PRO Posts: 2,102
    Yeah... ^
    I was thinking.
    Set up a Contraint function.
    Boolean called stick.
    When overlaps or collides with actor change att Stick to true.
    If struck is true "Constrain"
Sign In or Register to comment.