Forum rules - please read before posting.

Object : Check visibility

Hi,

I need some help today and I hope someone will be able to help me to resolve my problem.

I'm making a game with a snowman and the player will have to find the four buttons of different colors to put on the snowman. So I put in my scene the buttons that have to be find and I created the objects on my snowman and made them invisible on start. 

I then created the hotspots on them to make them visible if the player put the correct colors button on it. That works fine. 

However, I want my snowman to have a key appearing in his hand if the four buttons are put correctly. Here comes the problem. If I make the interraction Object : Check visibility and then make the key appear it works, but only if I check one object.

I'm I missing something?

Please help me out

Comments

  • edited November 2015
    Without looking and going too deep into your issue with checking visibility of sprites.

    Go with variables, once one of your buttons placed correctly add one digit to your variable and check if your variable is equal to 4 if it is set visibility of your key on.

    Also, without seeing what  your puzzle looks like, if the player takes out/cahnges  the correct buttons from your puzzle reduce your varaible by -1 .
  • You can just link together multiple Object: Check visibility Actions that each check a different button.  Do this in the ActionList Editor window, so that you can better see what you're doing with the wires etc.:

    image
  • Thank you very much to both of you.

    Unfortunately, I tried the two ways and it's still not working.

    I'm going to start from the start again tonight.

    For the variables, could you tell me how to create the variable. Global or Local? Interger or else? What value should I enter?

    I look at the tutorials and the manual and still I'm not sure.

    For the object, do I put the actionlist as a component of the snowman?

    Should I put all the buttons as child of the snowman?

    I hope I'm clear...

    Best regards,
  • I don't recommend using variables, but if you go down that route - use local integer variables.  You can use the Variable: Set Action to increase it's value by 1 each time a button is correctly placed.  The location of the ActionList is unimportant, but you should use a Cutscene prefab and call it whenever you place a button.

    The "Object: Check visibility" Action, checks whether or not the Renderer component on the object you check is enabled or not - so make sure you assign your object as the same one as the SpriteRenderer / MeshRenderer and not a child/parent.
  • edited November 2015
    You only need to use global variables if you need to access those variables from other scenes.

    For instance you have a quest log that has a quest "Your awesome buttons puzzle quest now - completed" or not completed. Then in another scene when you open your quest log you check your buttons variable and if it is true or meets your digit 4 or whatever your varaible is defined you call your quest completed.

    Otherwise use local varaibles.



    Regarding the Object: Check visibility it's also viable, specially for a local, isolated case. In fact it is like a local bool variable.
      Only don't forget to add Remember visibility component to all those buttons that you set visibility on and off, so when you come back to the puzzle scene or load your saved game your buttons visibility states are remembered.


    "For the object, do I put the actionlist as a component of the snowman?"
    No, you create hotspots and interactions( interactions are your actionlists), you link those interactions with your hotspots. In hotspot's inspector Use interactions.

     I don't add hotspots or interactions (actionlists) components to my game objects(sprites, 2d animations or characters). I prefer to keep everything separated so I could manipulated with freedom, for instance I might wanna remove my sprite for good but want to keep my hotspot and so on with other things.
     
     In fact actionlist, interactions, custscenes are all the same things, at least is what I think, since they do the same things (run your actions) and it is only a matter of how you call some of them like Onload or OnStart cutscenes and still they are actionlists that follow actions you create in them, you can also change whatever Onstart or Onload cutscene-actionlist to run in the AC Scene tab. So I just call it all actionlists. Sorry about this long rant :)


    "Should I put all the buttons as child of the snowman?"
    No.
    Actually we don't know what your snowman looks like. Is it an NPC, a moving Player character, or an animated sprite that moves around? Then you'd need to child whatever graphic elements you put on him.

  • Hello,

    After a couple of weeks of playing with those two options, I managed to get the check visibility to work. Thank you both for your explanation. I understand better now.

    Best regards,
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.