Changing Collision Shape

samircalviniyersamircalviniyer Member Posts: 16
edited November -1 in Working with GS (Mac)
I would like to know how I can change the collision shape of Actor1 when the player touches Actor1. So basically I want Actor1's collision shape to change to 'rectangle' if it was already on circle or the other way around.

May be you can have 1 actor with the collision shape of a rectangle and another with a circle and when the player touches on of the actor's it transforms or switches into the other actor (with a different collision shape).

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    you cant change collosion shape during gameplay. Theres different thing you can do though to get that same effect. Heres one way:

    First make a interger attribute called switch, and set it to zero.
    Make another attribute called x and another callled y, and those should be real attributes.

    I would have 2 of the same actor except one with rectangle collosion and one with circle collosion.

    Have the rectangle one in the scene and the circle one offscreen

    in the rectangle have when touch is pressed change attribute switch to 1. Then have another rule when switch =1 change attribute x to self position x, and change attriubte y to self position y, and after 0.1 seconds change self position y to 500

    then in the circle collosiion actor above screen have when attribute switch=1
    timer after 0.1 seconds, change attribute self position x to attribute x and change self position y to attribute y

    cheeers
  • samircalviniyersamircalviniyer Member Posts: 16
    Thanks a LOT!
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256


    Watch that for making the attributes. I i highly recomend watching the rest of the videos in the cookbook as well. The information there is priceless.

    cheers
  • samircalviniyersamircalviniyer Member Posts: 16
    I don't get this part:
    "and after 0.1 seconds change self position y to 500"
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Make a rule when attribute switch =1

    then put a change attribute behavior in that rule and change attribute x to self position x
    put another change attribute behavior in that rule and chang attribute y to self position y
    put a timer in that same rule under the cahnge attribute behaviors in the rule and have it set to after 0.1 seconds then put a change attribute behavior in that time thats in tthe rulke and change attribute self position y to 500

    if you dont understand that then watch the videos like i said

    cheers
  • samircalviniyersamircalviniyer Member Posts: 16
    Super it works! Now I have another question, how do I make it that if I press it again it stitches back to a square with the collision shape of a square?
  • samircalviniyersamircalviniyer Member Posts: 16
    Another Problem: Now that I have put y gravity to the game the box falls down when I click on the box (and it transforms to a circle).
Sign In or Register to comment.