How to tip on a centre axis

cnmeyer1980cnmeyer1980 Member, PRO Posts: 211
edited August 2012 in Working with GS (Mac)
Hi Guys,

I hope you're all well.

I'm trying to create the below, but cant figure it out, and after a couple of hours trying to work it out, I'm positing a little message on here in hope that someone can help.

Basically, I'm creating a game that requires a plank with a center axis, so, for example is the plank is 140 pixels wide, the center would be at 70 pixels (sorry, kinda obvious I know).

However, what I'm trying to work out is, if an object falls onto the plank, if it lands on the left side, the plank tips down towards the left and the object slides off, and if the object lands on the right, the plank tips down right and the object slides off, all while keeping its center axis.

I know, well, I think I know this is possible as I'm sure I've seen it done on many games posted on GS (however I maybe wrong).

If anyone could advise how to achieve this, I would be really thankful.

Cheers guys,
Chris

Comments

  • master200012master200012 Member Posts: 372
    Well, you can let gamesalad's physics engine help you. Simply go into your plank actor and create 2 new attributes within the actor. Both should be real. Then, at the top of your behaviors in that actor, you should put to change attributes behavior:

    Change attribute *first new attribute* to self.position.x
    Change attribute *second new attribute* to self.position.y

    Then, underneath, put 2 constrain attributes.
    Constrain attribute self.x to *first attribute*
    constrain self.y to *second attribute*

    After this, when the blocks fall, the plank should keep it's location.
Sign In or Register to comment.