Please help! making an actor visible by clicking another

I am trying to get an actor to go from invisible to be visible when another actor is touched.
I have tried with spawning but is there another way?

Answers

  • supafly129supafly129 Member Posts: 454

    -Create a game.attribute called "Visible"
    -Create a rule in the touched actor "When touch is pressed--> Change game.attribute "Visible" to True.
    -Create a rule in the actor that goes from invisible to visible "When game. attribute "Visible" is True --> Change self.Graphics.Visible to True"

  • goofyfootgoofyfoot Member, PRO Posts: 7

    Thanks for getting back to so quickly.
    I still can't make it work though.

    Here is what I have done.

    I create two actors one I want touched to reveal and invisible one.
    The one I want revealed I uncheck visible under graphics in its attributes.
    I Created a game.attribute called "Visible"
    I Created a rule in the touched actor "When touch is pressed--> Change game.attribute "Visible" to True.
    I Created a rule in the actor that goes from invisible to visible and selected attribute (the one under actor receives an event) "When game. attribute "Visible" is True --> Used a change attribute and selected self.Graphics.Visible to True"
    But no show, I have checked my spelling of visible, can't where I'm going wrong.
    Thank you again for your help.

  • IceboxIcebox Member Posts: 1,485

    @robbiemcintosh@talktalk.net i did exactly what you said and it worked fine, but try making it when visible is true change attribute self.alpha to 1 otherwise self.alpha to 0,
    but your method should have worked fine.

  • goofyfootgoofyfoot Member, PRO Posts: 7

    I really can't get this to work.
    Here is exactly what I did:
    I created two actors.
    One to be clicked/pressed and one to appear.
    I created a boolean Game attribute called visible, ticking the box.
    The actor to be touched I created a rule when touch pressed - change attribute game.visible to True.
    And in the actor to be revealed I unchecked visible boolean under Graphics and created a rule and choose when attribute Game.visible is true, I put in Change attribute Self.Graphics.Visible to True.

    Before I run the preview the screen shows one actor and the other is invisible, just as it should but when I run the preview both actors are visible.

    I have tried the Alpha method, leaving the visible under Graphics alone and making the alpha 0 and making it when visible is true change attribute self.alpha to 1 otherwise self.alpha to 0,

    I must be doing something wrong here but simply can't see it.

    Thanks for your patience

  • IceboxIcebox Member Posts: 1,485
    edited June 2015

    @robbiemcintosh@talktalk.net

    The reason why is because your ticking the game attribute that you created , why are you setting it to true by default ? when you create the game attribute dont tick it , let it be false, you only want it to be true if you touch the button actor , so in the button actor once you touch it it will set game.visible to true , then you can say that when game.visible is true change color to 1 otherwise to 0 ,everything you did is correct just remove the tick from the game attribute and it should work fine

  • goofyfootgoofyfoot Member, PRO Posts: 7

    I realised afterwards that having Visible ticked was wrong however un-ticked it still fails to work.
    I've tried starting afresh after closing the program but no joy.

  • IceboxIcebox Member Posts: 1,485

    @robbiemcintosh@talktalk.net I dont see why it wouldnt work, try this sample attached

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    Here is another sample I did as well, click the white actor to turn the green one on and off...

  • goofyfootgoofyfoot Member, PRO Posts: 7

    I have copied your version exactly and it didn't work, however it was only when I pasted in your rules it worked. How do I attach a zip file to a message then you could see or not see as it were. Thank you so much for this as you may of guessed I am a Newbe to GameSalad.

  • SocksSocks London, UK.Member Posts: 12,822

    @robbiemcintosh@talktalk.net said:
    I have copied your version exactly and it didn't work

    Two people have responded with suggestions of a solution - how are they able to tell which one you are referring to ?

  • goofyfootgoofyfoot Member, PRO Posts: 7

    I have found the solution!!!
    Mine did not work because I typed 'true' without using the Expression editor.
    Because the rule from the working version sent to me, 'true' had been entered correctly, when I pasted the rule into my version it worked.
    I know now to always use the expression editor when entering true.

    Thanks for the help guys I am new to this and have learnt a lot.

    Cheers

Sign In or Register to comment.