I have a list that contains 8 images on total. From index value 0-3 are images of recyclable items, and from index value 4-7 are images of compost items. I have 2 images of bins on the UI: a picture of a recycle bin and a picture of a compost bin. I have another blank image on the screen that presents a random image from the list of 8 images. I'm using an if-else statement when you click on either of the bins to determine if the random image matches with the bins. For example, if the random image is list[0], it would be a recyclable item. Thus, if the user clicks on the recycle bin, it should add a point. However, if the random image is list[0] and the user clicks on the compost bin, it should subtract a point. My if-else statement is not working accordingly. Here's the full chunk of code. 1 Heres a picture of the UI. 2
Messed up point counter from trying to sort random images
97 Views Asked by nathaniel At
1
There are 1 best solutions below
Related Questions in LIST
- Difference between list() and dict() with generators
- python how to write list of lists to file
- SML - Find same elements in a string
- How to divide list item by list item from another list using Python?
- How to get a certain element in a list of lists?
- How to read in numbers from n lines into a Scala list?
- Create a list of sequential monthly dates in PHP given initial date and quantity
- Python elegant way to sort numerically named directories
- sorting all data on multiple pages by clicking on its header
- List item keeps same memory address following sort/copy
- How to convert Hibernate List to String?
- using a for loop to compare lists
- How to keep track of word count in text file
- Running multiprocessing on two different functions in Python 2.7
- How do you fuse string items from two lists into new elements of a new list?
Related Questions in IMAGE
- Add image to JCheckBoxMenuItem
- Display images on Django Template Site
- How to resize images with PHP PARSE SDK
- Animation in Java on top of JPanel
- Slow performance on ipad erasing image
- What are the pros and cons of the picture element?
- Carrierwave file upload with different file types
- How to use annotorious with angular
- Images not showing when uploaded to server
- ImageView doesn't show up
- Image Resizing adjusts ratio
- Displaying bitmap image on Android (OpenCV)
- Class 'Imagick' not found - PHP and Windows
- Image position - randomly select position
- Replace image 1 with image 2 after 5 sec
Related Questions in IF-STATEMENT
- If...Then...Else Visual Basic 2012
- Why does compiler recognize while(true) at compile time but not if(true)
- Swift 2 - Pattern matching in "if"
- How to get a text to display on vba when a button is pressed?
- PHP statements with <<<EOF string
- Convert string to variable in PHP
- Are the conditional statements if(true) and if(false) evaluated at compile time in java?
- Compare strings using ==
- SQL Several Count
- how to get user to pick inputs Java
- WHERE Clause in SQL statement with 2 conditions
- PHP: most efficient way of structuring IF clauses
- Python - Why is my else statement being ignored in this piece of code?
- Multiple conditions in Java
- C program treats an if statement as false when it is in fact true
Related Questions in CODE.ORG
- continuous user input in applab?
- Code.org -- Searching in a database for the proper day and then adding it into a list
- My code.org Game Lab project is running really slowly, how can I optimize the code more?
- Shapes doesn't appear in Code.org gamelab?
- How can I format multiple button in minimal OnEvent() function?
- Why isn’t the else in my if-statement not returning the correct outputs?
- How to make questions apear in random order from a list on studio code.org
- Editing dropdown values without having to create a new dropdown every time
- How to display text from database in code.org?
- Messed up point counter from trying to sort random images
- How can I detect a click on the background of a JavaScript window?
- using Damerau-Levenshtein distance to compare sets of text in code.org
- confusing bug with login system in code.org
- javascript parameter is undefined
- how to check for two buttons on keyboard to be keyup at the same time in order to fire one function
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You should separately create a randomTrash variable and use it in the if statement to check. Like so;