Any help or ideas on why the text and draw loop functions are not working correctly would be great! One works but not both at the same time. Thank you!
I’m guessing you want the text to appear on the screen and the turkey to be able to move?
If so, both the drawSprites and the Text blocks need to be inside the draw loop. If the drawSprites isn’t in the draw loop, your turkey image won’t get updated when it moves.
If the text isn’t in the draw loop, it won’t get redrawn when the background sprite gets redrawn.
The order matters though! Once you put them in the draw loop, you may want to experiment around and make sure you put them in the right order!
Hope this helps!
Mike
Hello All,
I have student who is trying to get text show up inside of a draw loop with an If/Else statement. The idea is for the football player to cross the goalline and for the message to appear. It’s not working and this is a little frustrating. Please help!
It’s a tiny bit hard to tell without the link to the project which would help us test possible solutions, but one thing that stands out to me is that in that conditional statement where you want the text to display, you are comparing player.y to goalline.x. (y compared to x). Is that the problem? I would think (not looking at the actual screen), that you would want to compare x to x or y to y.
If that’s not it, try sending us a shared link and we’re happy to look closer.
Mike
Thank you. I came up with that idea from borrow the code from the race car lesson example wherein the race car passes the finish line and the message ‘winner’ is diplayed. We tried changing it to compare the player to the goalline coordinates, but that didn’t work either.
Here is the link to the project, however I’m not sure if it’ll let you access it:
Something that I noticed that may help is that you define player as a variable twice. Perhaps that would help?