jeudi 5 mars 2020

Python turtle: if statement with position sometimes works and sometimes doesn't [closed]

This is a mystery that is driving me crazy. Basically, I'm making an adventure/board game where the player can collect an item if he steps on it. So I made the function called "check_item" to check this. The x and y parameters tell the player position

The thing is, sometimes it works and sometimes it doesn't. I playtest the game and sometimes the "armor" turtle is successfully hidden, sometimes it just isn't. Also the "sword" object usually isn't hidden and the "key" just doesn't work. I tried getting rid of the boolean parameters, but nothing works. It could be also useful to know that the function is called inside of the "move" function, which is called from the "onclick" event. Basically, whenever I click on the player object, it moves and after that it checks the position. Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire