Using mouse.getPressed()[0] == True online

Hi @andrewildman, if you take a quick look at the online docs, you see that getPressed returns a list of buttons that are currently pressed. The JavaScript === comparison operator checks for equality of both value and type, whereas == only compares values. In your code, if you are compare an int to a boolean value using ===, it returns false, this is why your initial translated code failed. Instead you could use the following to fix the issue without needing to alter the JS:

mouse.getPressed()[0] == 1
1 Like