From 52fc2291ccb86e6518bfd3bb8ce839fd3cb93492 Mon Sep 17 00:00:00 2001 From: JC Date: Sun, 30 Jul 2023 19:02:19 -0500 Subject: [PATCH] Draw many rectangles For loop iteration, table iteration, and rectangles drawn diagonally --- source/main.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/main.lua b/source/main.lua index c5dbbd8..5cedb2d 100644 --- a/source/main.lua +++ b/source/main.lua @@ -1,11 +1,16 @@ local pd = playdate local gfx = playdate.graphics -local r = pd.geometry.rect.new(0, 0, 32, 32) +local rects = {} +for i=1, 10 do + rects[i] = pd.geometry.rect.new(32 * (i-1), 32 * (i-1), 32, 32) +end function playdate.update() - gfx.drawRect(r) + for i,r in ipairs(rects) do + gfx.drawRect(r) + end if playdate.buttonJustPressed("a") then playdate.display.setInverted(not playdate.display.getInverted()) end -- 2.20.1