def setup @x = 50 rectMode(CENTER) end def draw if @x > 48 @x -= 2 elsif @x < 48 @x += 2 end @x += (movedX / 1).floor background(237, 34, 93) fill(0) rect(@x, 50, 50, 50) end