Help with Student project

csd-unit-6-lesson-9

#1

My student’s project is not working. The code for her bird and penguin look identical, but only the bird is triggering the win screen.


#2

Line 34: penguin_y > 240
Line 41: bird_y < 240

I’m guessing it has to do with the < and > signs.


#3

That is correct. She wants the icon that arrives at 240 first to trigger the winner screen.


#4

I think what’s going on here is that she’s trying to create two functions with the same name checkWin. Only the second one is actually being used. Another way to think about this would be to create one function that checks for the animal being passed into it. Something like this:

function checkWin(animal){
if(animal == "bird") {
...
else if(animal == "penguin"){
...
}

Does that help?