how to grow in width only?

raggragg Member Posts: 65
edited November -1 in Working with GS (Mac)
it is possible to make an actor grow only in width and reduce to its original width when touching something?then grow again when reaching its original width?

Comments

  • EastboundEastbound Member, BASIC Posts: 1,074
    Yes, you simply do a change attribute, with the actor's size.width being changed.
  • raggragg Member Posts: 65
    thanks...how bout changing it bec to its normal size when touch other actor?i cant create the loop for it to increase and decrease..
  • raggragg Member Posts: 65
    any idea guys?
  • BeyondtheTechBeyondtheTech Member Posts: 809
    You're going to have to store or set the initial size in an Actor Attribute. From there, you can create Rules on getting back to size when needed.
  • raggragg Member Posts: 65
    i made a rule:

    when collide with wall:
    timer :every 0.01s
    change attr: self.size.width to max(self.size.width-1,20)

    otherwise
    timer :every 0.01s
    change attr: self.size.width to self.size.width+1

    but when collide with the wall...it couldnt reduce its width...i think because of the not colliding with wall rule keep it increasing size while colliding with wall keep it decreasing size,causing neither increment not decrement at the end....

    how to solve this problem?thanks
  • raggragg Member Posts: 65
    thanks for the reply tshirtbooth..i can make it change it width to original after colliding the wall..but cannot make it change gradually...
  • raggragg Member Posts: 65
    still the same...not reducing its width after collide..
  • raggragg Member Posts: 65
    thanks for the demo tshirtbooth...i think u misunderstood me...i wana make a actor constantly increase its width itself until it collide with the wall...then it gradually reduce width to original size...and start the loop over again.....thanks alot for the demo anyway!
  • raggragg Member Posts: 65
    thanks alot tshirtbooth!never thought of having the self grow boolean!thanks!much appreciated!!
Sign In or Register to comment.