2017년 5월 6일 토요일

Trouble with which blocks to use to build a list of 3 items, then check it


I am developing an app for my elementary school students to learn their multiplication facts. I have an opening title screen and then I have two consecutive screens that walk the students through how to play the game. 

Here's my problem: On the 3rd screen, I have 3 numbers (I set the complete graphic with the three numbers as the screen background, then put three transparent .pngs in a table over the numbers on the background image in the correct position to overlay the numbers. I set the transparent images up as buttons.) I would like the buttons - 2 , 4, 8 - to play a sound "two", "four", "eight" when clicked. I would also like the screen to change upon the clicking of all three numbers.I have the buttons working with their respective sounds. I just cannot find the right blocks to code the rest.

Problem: Which blocks do I use for the programming to 'collect' the button clicks as the user clicks them, then 'know' when all three buttons have been clicked to automatically close this screen and open another?

PLEASE help. I am going out of my mind searching for this information.

--
You did not post an image of your blocks Veronica so here is the general advice you need:


and 


What you want to do can be done several ways.  You might set a Boolean value for each button (the second link blocks).  Set perhaps button1click to true in button1s event handler when button1 is clicked etc.
Then to know when the combination is correct, use a conditional constructions (the first link)  to find out when  button1click and  button2click and button3.click are true.  when you make your selection, change button1click to false and the others too to reset.

Show some blocks and you should get more specific advice.

-- 
Well, there's a little problem you are going to have because you say you make components to overlay with graphics in the background. That may work in one screen but it will not work on screens with different sizes. You need to use relative positioning instead of absolute.
About your question, there's a lot of ways to do that, but I'm going to help you with an easy solution:

Create 3 global variables called Button1Clicked, Button2Clicked and Button3Clicked. Set them all to FALSE (the green false you find in the LOGIC drawer
Each time a button is touched, set the corresponding variable to TRUE (again, the green true), and ask IF Button1Clicked AND Button2Clicked AND Button3Clicked THEN open the new screen.

-- 
Thank you for your specific advice. I am going to try your solution when I have a chance today after I teach school. Also, I understand your comment about the relative positioning. Exactly how would you set this up? I was considering slicing my image into segments and then fitting the segments into a table, but if there is an easier way that you can suggest I would love to hear your thoughts.

-- 
Without knowing exactly how you want your screen layout, I can give a general advice, to use a plain background (gradient, texture, flat color, etc) and set buttons with images instead of text. 
And always use aligning (center, right, left) and percentages to size components, not pixels to ensure it looks right on every screen.
Will that work for your project? 
If not, show a screenshot of your layout and your blocks so we can have a better idea, like Steve said up there.

-- 
I am a novice...forgive me. Which blocks do I use to say "Button1Clicked AND Button2Clicked AND Button3Clicked"? (The AND part is throwing me off.)

-- 
-- 
I attached a screenshot of what I have....does this look anything near correct? I cannot get my AI companion to connect on my PC right now. And for some reason when I try to download it is saying no new updates. Thank you in advance.



-- 
It should work. One thing you can optimize, is that you don't need to ask if [variable] = TRUE. Just do it like the example I sent you before. Only when using boolean values (true or false).
Or you can leave it as it is, doesn't matter really.

-- 
I don't see the place in your button click events where you set the appropriate global variable to true.

You test it, but you never set it?

-- 
By the way, the app would be more intuitive if each button click event did something to the appearance of that button
to show that it has already been clicked.

Consider changing the text to bold, or changing the background color or image of that button.

You could test the attribute you set in that AND tree instead of testing those three global variables,
killing two birds with one stone.

-- 
Oh, yes, Abraham. I didn't notice that. She did it in the first one but forgot the other two.
Also, I noticed now that you are asking if TwoButton, FourButton and FourButton are true.

It should be TwoButton, FourButton and EightButton.

-- 
Thank you for pointing this out. I have revised this.

-- 
Yes, I agree. Once I figure out the programming issues, I plan to work on the appearance / user interface more closely so that it is appealing and user friendly for kids. Thank you for this suggestion.

-- 
Thank you everyone! Your suggestions worked and I have learned a bunch. Now I need to work on my graphics. I appreciate your help VERY much!

--

댓글 없음:

댓글 쓰기