add rectangle collision detection & part of text control logic