stretch actor

wolltywollty Member Posts: 102
I would like to extend an actor (stretch)
for example when you touch with a finger to stretch an arm
from left to right


as in toca taylor
lengthen the dress or the sleeve


I did a test but not good
the right movement is from left (start) to the right (end)

https://www.dropbox.com/sh/sikt71zhgttd4hv/vuQ26y5l-g

help me, please
thanks

Comments

  • wolltywollty Member Posts: 102
    maybe change origin x y of actor?
    or use change size?
    or maybe use the spawn?

    help me...
    thanks
  • SearleSamaSearleSama Member Posts: 108


    the tricky part is the stretch
    you'll need to record the initial touch position of Y (this is your offset number) so make a self attribute called TouchOffsetY and one called positionoffset

    What you then have to do is constrain the Y of the actor you want to stretch to the touch.y position then divide it by 2 minus the offset so it will stay in place.

    so...(this would be for the shirt example)

    when touch is inside (or pressed)
    (these will store the original Y positions of the touch and the actor at the start of the touch)
    change self.TouchOffsetY to device.touch1.y
    change self.positionOffset to self.position.y

    (now that we know where the actor is we can start to alter it.)

    // stretch
    constrain self.size.height to self.size.height + (device.touch1.y - TouchOffsetY)

    // keeps it in place
    constrain self.position.Y to ( device.touch1.y - positionOffset )/2 (dont forget to divide it by 2 because actors origin positions are in the middle.)

    This is all off the top of my head, I haven't had a chance to proof it, but I'm pretty sure this is the direction to take. plus its late, anyway I hope you gain some incite at least. Anyway you'll have to mess around until it does what you want.
  • wolltywollty Member Posts: 102
    I did a test
    but I must have done something wrong ...

    https://www.dropbox.com/s/ha6hkhq9ajpu2o3/stretch05.gameproj.zip
  • wolltywollty Member Posts: 102
    I would like to extend an actor to the left
    or to the right
    or to the up
    or to the down

    It's possible whit gamesalad?
    maybe it's not possible

    i don't know...

    sorry for my english

    thanks
  • wolltywollty Member Posts: 102
    I found a tutorial tshirtbooth


    and I made this
    https://www.dropbox.com/s/z0wi0erj4p9uvaj/stretch06.gameproj.zip
    but it is not what I want

    I wish I could drag with touch finger the extremes of the actor
    to lengthen

    sorry for my english

    thanks for help
  • PaxPaxPaxPax Member Posts: 106
    edited May 2013
    Not sure, but if you are looking to stretch the actor up and down while maintaining its original base(bottom of actor) position, this may help.

    I can 'stretch/shrink' the actor using touch while keeping the original base position.

    edit---see post below.

    cheers
  • wolltywollty Member Posts: 102
    what is
    constrain self size height to "touch" ???

    i make a test
    thanks
  • PaxPaxPaxPax Member Posts: 106
    let me know if you figure it out---drag in your constrain attribute to actor
    cheers
  • wolltywollty Member Posts: 102
    i made this
    https://www.dropbox.com/s/si9r3649jrwkiui/stretch07.gameproj.zip

    but... is not good :(

    thanks for help me :)
    sorry for my english
  • PaxPaxPaxPax Member Posts: 106
    edited May 2013
    I probably 'messed' up my post, was and am in a hurry. I posted a file, take a look and hope you can replicate for yourself. Let me know!

  • wolltywollty Member Posts: 102
    thank you very much

    might as well go
    I'll do the tests in my game with my actor

    even better would extend from the ends of the Actor

    thanks :)
  • PaxPaxPaxPax Member Posts: 106
    I opened your project. If you Delete 90+self.Size.Height/2 in the expression editor and then re-do it will work. Not sure why, unless you 'entered' instead of using drop down menu. Here is your project back after I did the above.

    https://www.dropbox.com/s/v8uqdv1ldgxp8ly/stretch07.gameproj.zip

    Also, if you want to 'touch' the end of the actor to stretch instead of anywhere in the actor, than you can create invisible actor/s and constrain to your main actor. Warning--- I am a rookie, hence there may be a better way to do all this.

    cheers ;)
  • wolltywollty Member Posts: 102
    thanks Paxpax :)
Sign In or Register to comment.