for(var/y = 0 to 4)
for(var/x = 0 to 5)
var/px = x * 40 + 10
var/py = y * 40 + 1400
var/HudObject/h = add(px, py, "test")
h.name = "open_slot"
open_slots += h
Problem description:
If I change the y value about 4 the layout on the screen somehow breaks. Here are the before and after.
How it should be : http://i.imgur.com/4DrDs.png
How it is when I increase y beyond 4 : http://i.imgur.com/0vATc.png
Any ideas?
So right now you're calculating what I'd call the "absolute pixel x/y". You need to break that into tiles (by dividing by icon_size and flooring with round(x)) and pixel offests (by modding it with icon_size).