I made this, so it can help you a bit in tiles class.... Hopefully its helpfull