Why is the player not displayed? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is the player not displayed?

https://code.sololearn.com/WJbZ8m8VXDyz/?ref=app I made this game that the player must push the stone to the indicator point in order to win. 1. The player i made wasnt really displayed when it stepped on the tile. But once i moved it out of the tile it appeared. 2. I provided customization of the tile so if you change from 1 to 0 the tile you step on wont appear and the collision between the player and the tile will occur but the camera kept zooming in and didnt follow where the player stood. How can i solve the problem above?

16th Dec 2020, 3:32 AM
Tri Satria [NEW]
Tri Satria [NEW] - avatar
4 Answers
+ 1
In the draw function you're rendering the player first and all other objects after, which does the last rendered objects appears up front. The solution is to call player.draw() at the end of your rendering pipeline, after your rendered all the other objects. Place player.draw() and player.update() after points.forEach (line 94).
16th Dec 2020, 3:45 AM
Erick Ruh Cardozo
Erick Ruh Cardozo - avatar
+ 1
As I said bro, in your main draw() the function, remove the calls player.draw() and player.update() from that place (lines 79 and 80), and place them just before your checking logic, at line 94.
16th Dec 2020, 11:17 AM
Erick Ruh Cardozo
Erick Ruh Cardozo - avatar
0
How can i solve that if so?
16th Dec 2020, 3:46 AM
Tri Satria [NEW]
Tri Satria [NEW] - avatar
0
Its now working. Thanks for answering!
16th Dec 2020, 11:58 AM
Tri Satria [NEW]
Tri Satria [NEW] - avatar