Skip to content

Commit

Permalink
added grid.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhan45 committed Aug 22, 2020
1 parent 0b56c7b commit ff2b455
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lua/grid.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
width = 7
height = 7

rad = 1
offset = 2.25

total_width = offset * (width + 1)
start_x_offset = SCREEN_X / 2 - total_width / 2

for row = 1,height do
for col = 1,width do
color = {
r = (row * col) / (width * height) * 255,
g = col / width * 255,
b = row / height * 255
}
add_shape(
{shape = "circle", x = col * offset + start_x_offset, y = row * offset, r = rad, mass = 1, color = color}
)
end
end

add_shape({shape = "rect", status = "static", x = 0, y = SCREEN_Y, w = SCREEN_X, h = 0.25})

0 comments on commit ff2b455

Please sign in to comment.