Help with Student project

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.

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

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

1 Like

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

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?

2 Likes