How to tip on a centre axis
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
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
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.