Clicking One Actor to Change Image in Another!

PhiliePhilie PRO Posts: 240
edited March 2012 in Working with GS (Mac)
Hey Guys,

I have a lot of questions lately, don't mind me! This is a hard question it seems, I have found a few ways to do it, but it seems like there is so much to do it for it, that there has to be an easier way without adding unnecessary things.

Basically, I have letters, each is an image, you tap that letter, it will add that letter to an attribute, and I also want it to change the image of a tile to the image of the tile with that letter. The problem I have is, how do I tell the tile to trigger when another actor is pressed, and how can I tell it to know which letter in the word it is. The words can be any size from 0 - 5 letters.

Is there a way to pick out a character in an attribute, like for the first tile, tell it to pick out the first character in the attribute and then have 26 rules, if a then change image to a... etc?

Thanks a bunch,
Matt

Comments

  • MotherHooseMotherHoose Member Posts: 2,456
    you are making words out of letters

    things your game will have to monitor
    Words
    currentLetter
    activeTile

    ===

    things the letterButton will have to monitor:
    myLetter … you have to set this one

    and Do
    when pressed
    --when currentLetter = space
    --change currentLetter To: myLetter

    ===
    things your tileActors will have to monitor
    self.Image … aha that is built in!
    myID … so I will know when it my turn to be active … you have to set this one

    and Do:
    when myID = activeTile
    --change: self.Image to currentLetter image
    --add the the currentLetter to Words
    --change the currentLetter to a space
    --change the activeTile To: activeTile+1
    ===

    of course gameAttribute maxLetters/Word might help with a tile rule when myID = maxLetters/Word … √word

    @};- MH
  • PhiliePhilie PRO Posts: 240
    @MotherHoose - Sounds great! I will try it out tomorrow, so far everything looks like it will be perfect! :D Only thing is, when changing self image, what do I put for the image it changes to.. say my file was BubbleA.png, would I just do Bubblecurrent.letter.png or something like that? Other then that, thanks so much, can't wait to try it out!
  • MotherHooseMotherHoose Member Posts: 2,456
    edited March 2012
    Expression:
    "Bubble"..game.currentLetter..".png"

    "Bubble" … tells computer this is text in name
    ..   tells computer more to follow
    game.currentLetter … tells the computer this value is appended to the text string (you select this one)
    ..   tells computer more to follow
    ".png"   … tells the computer this is appended to the text string

    once you write for one letter … use it for all!

    @};- MH
  • PhiliePhilie PRO Posts: 240
    @MotherHoose - I am pretty sure I did everything right, but I'm having an a problem - it seems to just make the tiles disappear, which I don't get. If I uploaded my project file, and PM'ed you the download link, could you check it out and see what went wrong?
    Thanks!
  • MotherHooseMotherHoose Member Posts: 2,456
    edited March 2012
    of course … @Philie

    or just email it to:    myName   @   gmail

    @};- MH
  • PhiliePhilie PRO Posts: 240
    Thanks @MotherHoose - just sent the email!
Sign In or Register to comment.