Seems like a cool game! I really like the aesthetics and concept. The mouse click didn't seem to be working right for me though, I could move around with wasd, but I couldn't seem to be able to use torpedoes or sonar. Idk if it was a bug, or just my machine. Cool looking concept though :)
Viewing post in Submarena jam comments
Hey sorry it wasn't working but I've just tested it a bunch and it works on everything I have - can you confirm the little clickable icons aren't showing up in adjacent tiles? I'm not the best gif maker but I recorded a gif below:
Will play your game in just a moment when I make sure this is working!
Are you using a Retina/High-DPI display? I had no idea this would affect it but after reading a bunch of StackOverflow posts I think I see what's happening. I appreciate you showing me what you're seeing as it is working fine on my old 2012 Macbook Pro but obviously they have come a long way in 10 years.
Hey man I really can't thank you enough for showing me there was a problem with the scaling on Macs; not sure how I ever would have known. Posting a little code snippet here for anyone else using mouse positions in case Google brings them to this corner of the internet while fighting with WebGL and Retina displays. Technically it could work for any tile-based game to easily say what tile (or even pixel on a low-res game like this) the mouse is over. Thank you!!!
Position WhatTileIsMouseIn() { Vector2 mousePos = Input.mousePosition; mousePos = new Vector2 (mousePos.x, mousePos.y); float scaledMouseX = ((mousePos.x / Screen.width)) * 8; // the 8 here is how many tiles across your screen has float scaledMouseY = ((mousePos.y / Screen.height)) * 8 - 1; // the 8 is vertical tiles, minus 1 for the bottom border in my game return new Position((int)scaledMouseY, (int)scaledMouseX); // casting the floats to integers truncates them }