How to change actors from one to another (cannot find the right behavior) + how to hide one of them?

So, I'm just trying different ideas for games.

I want to make a game where you have to "turn the light on". At first the game screen is totally black. You have to find the switch by tapping the screen.

I have 3 actors: Lights on, off and switch
First question: How to hide the switch from the player but still have it there, so when he taps, it works?
The second: How to change the actor from Light Off to Light On, when switch has been touched?
Third: How to make the switch change its place every time you don't tap on the right place?

Screenshots:
http://www.upload.ee/image/3917657/Screen_Shot_2014-03-02_at_12.11.02_AM.png
http://www.upload.ee/image/3917659/Screen_Shot_2014-03-02_at_12.11.10_AM.png
http://www.upload.ee/image/3917661/Screen_Shot_2014-03-02_at_12.11.14_AM.png
http://www.upload.ee/image/3917662/Screen_Shot_2014-03-02_at_12.11.46_AM.png

Thanks for your help!

Comments

  • ArmellineArmelline Member, PRO Posts: 5,370
    edited March 2014
    1. Make the alpha value of the actor 0, and have a rule something like: "When actor receives event touch is pressed, change attribute self.alpha to 1". With an alpha value of 0 it is completely transparent, with a value of 1 is it completely visibile.

    2. Okay, I re-read what you said and saw I missed a screenshot :D Will throw together a quick example.

    3. For this you probably want a "When actor receives event touch is outside, move to (random x), (random y)". You could presumably use a Move To, Interpolates or Change Attributes depending on how you want it to move.

  • hegerthegert Member Posts: 11
    edited March 2014
    Hey, thanks for your reply. You are awesome!

    Right now I have a question about the first answer - where can I find self.alpha? I was clicking different menus, but did not find it.

    EDIT: Is it scene.color.alpha?
  • ArmellineArmelline Member, PRO Posts: 5,370
    Here's the project file for an example project.
  • ArmellineArmelline Member, PRO Posts: 5,370
    And here's an image that shows you where to find the alpha values.
  • hegerthegert Member Posts: 11
    edited March 2014
    Hey!

    I did it a little different with these alpa values, it should work.

    Screenshot: http://www.upload.ee/image/3917772/Screen_Shot_2014-03-02_at_1.14.23_AM.png

    Now three things:
    1. I think my dimensions are messed up? I don't want to switch to go outside the screen. What are the dimensions and how to avoid going outside the screen?
    2. When I click the switch, the "LightOn" picture comes up (just a white screen for now), but not full screen (Although I changed it, I think. Manually, and that might be the problem).
    3. Do I have to make another actor to make a message "The light is on" come up on the screen and end the game?

    Thank you so much for your help. I love the community here already!
  • ArmellineArmelline Member, PRO Posts: 5,370
    1. You need to make sure that the random values you use are 50% of the width/height of the button. So if your button is 100 pixels wide and tall, you'd use random(50,518) for the X attribute, and random(50,270) for the Y attribute. If your button is 20 pixels wide, you'd use random(10,558) for X, and random(10,310) for Y. The X and Y values are for the centre of the actor, so if you take the width, divide it by 2 and place the actor at that X value, it should be just touching the edge of the screen. Does that make sense?

    2. Just make the LightOn actor be the same dimensions as your scene (presumably 568x320) and place it at 50% of those dimensions (presumably x=284 and y=160). That'll make it fill the screen and be centred.

    3. No, you can use a Display Text behaviour to achieve this. Stick it in with the rule you use to make the light visible.
  • hegerthegert Member Posts: 11
    Again, thank you for your fast help.

    1. It still goes off the screen sometimes, but I think that's good. Makes it harder :P
    2. These X's and Y's did not work. They still had a little bit of black screen, but I changed it randomly for bigger numbers and now I have full screen white, when needed. Is it OK? I mean, do I have to have correct numbers or I can just change them as big as I want (like I did right now)?! Might it make the app working slow?
  • ArmellineArmelline Member, PRO Posts: 5,370
    1. If it goes off the screen sometimes, your values are incorrect somewhere :D

    2. Making the actor bigger than the scene is no problem, especially in a small game like this. If you were doing it with many actors in a complicated and intensive game it might start to slow it down a tiny bit, but realistically there will be no noticeable different.

    To check your scene size, check the image attached. (Sorry if this is obvious to you, but might be helpful to someone else and is easy than trying to explain it :D)
  • hegerthegert Member Posts: 11
    Thank you!

    Well, basically my game is ready. :D

    Went outside, had an idea, after 1.5hrs basically done (I've never used GameSalad before). Have to design now and it will be awesome, I think.

    Also have to add timer to count how fast the player found the switch (Or might it be better to count taps?). Also, I should put the "Record/Best" into the game. And menu + couple of other small things.

    Might not be the right place, but what do you think of this idea with a nice design? Finding the switch in the dark to turn the light on. Might be addictive? Would you play it?
  • ArmellineArmelline Member, PRO Posts: 5,370
    Great :D Be warned though that making a game is normally 20% making the game, 80% making all the other bits and bobs and menus and counters and stuff :D
  • hegerthegert Member Posts: 11
    edited March 2014
    I used this video to make a timer. And I've got an error in the place where the timer should be, it says "Invalid".

    As I can see, I'm not the only one who has that problem. Anyone knows how to fix it?

    Plus, how to make it run as long as the player finds the switch? How to save player's record and show it?
  • ArmellineArmelline Member, PRO Posts: 5,370
    edited March 2014
    In that video tshirtbooth adds an extra open bracket near the end that breaks the expression.

    I'll get to the questions you PM'd me as soon as I can :)
Sign In or Register to comment.