Could you explain the use/reasoning behind the "|" in the following lines (I couldn't find anything on Google. Mainly cause I did not know what to look for):
bitmap.regX = bitmap.image.width/2|0;
bitmap.regY = bitmap.image.height/2|0;
ship.y = canvas.height*Math.random()|0
Thanks!!! I am enjoying going through your video tutorials. Very Helpful!
Could you explain the use/reasoning behind the "|" in the following lines (I couldn't find anything on Google. Mainly cause I did not know what to look for):
bitmap.regX = bitmap.image.width/2|0;
bitmap.regY = bitmap.image.height/2|0;
ship.y = canvas.height*Math.random()|0
Thanks!!! I am enjoying going through your video tutorials. Very Helpful!
rockindahizzy 3 months ago
@rockindahizzy its the equivelant of
bitmap.regX = Math.floor(bitmap.image.width/2);
the reason to use |0 instead is because it runs faster
VeryAngryBeaver 3 months ago
@VeryAngryBeaver
OH!!
That makes sense. Thanks for the help!
rockindahizzy 3 months ago