Changing actor's image based on other actors location

0belisk0belisk PRO Posts: 189
edited April 2012 in Working with GS (Mac)
this has been mind-...ing for the last 2 days now, thought id try the forums for some help!

image

as you can see in the picture, i have achievements in the centre that are scrollable, and at the bottom a description of how to unlock it, what I'm asking is for a method for the text at the bottom to change to comply with the appropriate achievement that is above it.

i feel as if I've tackled the mechanics to make this work logically but it doesn't appear to be the case. this is what i did on the text actor's rules:

when:
game.current scene.layer.awards.award2.sizewidth is = to 148.

change image to:
award2.text

as the awards are half the size until they are in the centre in which they change to 148 width, so it would only trigger once they are locked in the centre. and so on for all the other awards, this does indeed work, but its VERY glitchy. it works for a little while scrolling through the awards and the text changes correctly but then it mucks up very quickly and starts to display the wrong text to the wrong award.

i tried debugging this by making all the awards display their size width and even though all the other awards were not 148, somehow it was messing up and the wrong text was very oftenly getting displayed on the wrong award.

it makes sense to me but somehow its not working. any ideas?

Best Answer

  • tatiangtatiang Posts: 11,949
    Accepted Answer
    I actually didn't save it. I literally changed that one condition in each rule. In the screenshot below, the original/incorrect condition is shown at the top and my correction is shown at the bottom:

    image

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You must have some attribute that is triggered just before the award moves to the center of the screen and adjusts its width. What is that attribute? Why not have the text image change when that attribute changes? So for example, you might have each award actor change game.currentAward to self.name when it is its turn to be front and center. Then, have a rule/rules in the text actor such that When game.currentAward="highroller" change image to "highroller.png".
  • 0belisk0belisk PRO Posts: 189
    You must have some attribute that is triggered just before the award moves to the center of the screen and adjusts its width. What is that attribute? Why not have the text image change when that attribute changes? So for example, you might have each award actor change game.currentAward to self.name when it is its turn to be front and center. Then, have a rule/rules in the text actor such that When game.currentAward="highroller" change image to "highroller.png".
    i did attempt this also. when the award is close to the centre and locks into place, theres an attribute which tells the actor to increase in size. i tried using that to trigger the text image change also but i effectively got the same results.

    when it was triggered it set a self.attribute integer value to 1, otherwise its 0. so i did the same thing as before but instead of size width = 148 it was self.attribute = 1.

    but somehow its still gets the text wrong after very short use of navigating the awards :/

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I can look at the game file if you like but I'm not sure what else to advise without seeing the rules.
  • 0belisk0belisk PRO Posts: 189
    that would be great thanks, heres the download to the project, I've removed everything that isn't required/other scenes so you know what to look at :)

    http://www.filefactory.com/file/zgfvvbz7y3n/n/1.5.gameproj.zip
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2012
    So I haven't spent that much time with the file yet, but what I was trying to explain above is that you should have the text image change based on the value of game.selected level rather than on the size of the actor.

    It works if I remove the condition Attribute scene.level blocks.lockedbox X.Size.Width = 148 and replace it with the condition Attribute game.selected level = 1 (or 2 or 3 or...) then Change Image to [image name]. This is on the highrollertext actor.
  • 0belisk0belisk PRO Posts: 189
    oh really? thats great news thank you sir, could you upload the updated project so i can analyse it?
  • 0belisk0belisk PRO Posts: 189
    ahh now i see what you did, thanks very much, answer accepted!
Sign In or Register to comment.