Change actor attributes with accelerometer

MarkOnTheIronMarkOnTheIron Member Posts: 1,447
edited November -1 in Working with GS (Mac)
The example I'm trying to make is of a ball attached to a rubber band.
The ball start on the center of the screen and when tilted it moves away but only for 100 px.
The hard part comes with the rubber that should rotate and stretch from the center following the ball. How can I do it?

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Create an image that is twice as long as your rubber band and place one end of the rubberband in the middle of the canvas and the other end at one edge of the canvas. At first it will seem like your image file is twice as wide as it needs to be but GS changes the size images from the middle. So if you make your image like this and drop it in an actor you can use a change attribute behavior and change the width of the actor. It will get wider with the referrence point being in the middle of the actor, but since you put the end of the rubberband in the middle and left the other side transparent you will not see the "non-rubberband" part get wider, just the rubberband part.

    here I made a demo: http://gamesalad.com/game/play/33978
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    then constrain the ball to rubberband position + rubberband width/2

    you'll have to make a game attribute for each and constrain position and width to them.
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    Thanks. I was smashing my head on the wall trying to figure how to rotate an image from one end. That's a nice solution.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    no problem. It would be nice if you could set an anchor point to stretch from or rotate around. this is the best workaround I can think of.
Sign In or Register to comment.