Moron Test Final

I was able to get all of my scenes working against the V5 code version.

Here is my (click on it to play) Final version.




I made some changes to the CSS file, the scenes.js, and the moron.js  as I was needed to able to get the scenes to work. I didn’t follow from the original moron test break down assigned scenes but I have followed V5 and a little bit from V6 version.

I have struggled with hiding option after clicking on an object so then I carefully followed and got a solution. I have mentioned (main) as our key and then declared a function that passes the icon, i values. This is the way for a scene level we can set specific actions. I implemented in the level 01.

case 1:
                case 2:


I added to the moron.js/scenes.js set of functions called moveIcon(i, left, top). It basically resetting the location in the window of an icon based on their index value, left position, and top position.

//new function in moron.js
function moveIcon(i, left, top) {
    icons[i].style.left = `${left}%`
    icons[i] = `${top}%`

// new function in scenes.js
                case 2:
                    //calling each index value
                    icons[0].style.left = "71%"
                    icons[0] = "27%"

                    //OR using the moveIcon(i, left, top)
                    //function now in moron.js
                    moveIcon(1, 20, 60)
                    moveIcon(2, 20, 27)
                    moveIcon(3, 50, 55)

                    //replaced by the above moveIcon calls
                    // icons[1].style.left = "20%"
                    // icons[1] = "60%"
                    // icons[2].style.left = "20%"
                    // icons[2] = "27%"
                    // icons[3].style.left = "50%"
                    // icons[3] = "55%"

However, It was working but not perfectly. I should change some of the % values for positions.

This course was definitely very difficult for me. I learned a lot of new things but I still feel like I have basic knowledge of coding some of the topics that we covered. Honorable Professor helped me a lot during my various problem sets.  Overall, I definitely need to work on javascript and rewatch some of the tutorials.

Leave a comment

Your email address will not be published. Required fields are marked *