Slide and animate problem

RAWRafaRAWRafa Member Posts: 4
edited November -1 in Working with GS (Mac)
Could anyone give me a light at this?

Here's the problem, I have two actors, first one is a slider and the second one is a smile. I have 22 different frames for the smile, and I wanna know how to animate it when the slider goes left/right.

Comments

  • RAWRafaRAWRafa Member Posts: 4
    RAWRafa said:
    Could anyone give me a light at this?

    Here's the problem, I have two actors, first one is a slider and the second one is a smile. I have 22 different frames for the smile, and I wanna know how to animate it when the slider goes left/right.

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    You could constrain the self.Image attribute of the smile to an expression that concatenates the text part of the image names and using a game attribute that in an integer that is calculated by the position of the slider.

    Files:
    "smile0.png"..."smile12.png"

    Expression:
    Constrain Attribute: self.Image = "smile"..game.imageState..".png"

    Slider Expression:
    Constrain Attribute: game.imageState = max(0,min(12,floor(self.Position.X/30)))
    This expression might need to be tweaked depending on where the slider starts and how far it goes.
  • RAWRafaRAWRafa Member Posts: 4
    so all that I need to do is create a new integer attribute to calculate the slider position and insert it on these expressions?
Sign In or Register to comment.