I am implementing a “health bar” in my research. I thought of using a simple method of expanding a rectangle. I could change the colour of the rectangle via inverting it and then using an “if” loop to check and change the rectangle colour if its positive or negative.
#rectangle expand or shrink. if berry_resp.corr: width += 0.05 else: width -= 0.05 if width >= 0.001: HPcolour = "green" elif width <= 0.001: HPcolour = "red"
However, I have been asked to implement the health bar in a different fashion which requires me to expand only a single side of the rectangle. The proposal is as follows;
Similar to game health bars, if you give enough correct answers the rectangle will expand towards the right and be green, and if you give wrong answers it will expand towards the left side displayed in red.
My problem is that PsychoPY polygon rectangle object expands in both ways and I could not find the parameter that makes this happen. What I want to do is;
Have 2 rectangle objects: Red, Green. If participant gives correct answer expand the green one, if the participant gives incorrect answer if green is expanded shrink it, if there the green is not expanded, expand Red towards the left.
Is it possible to disable the both-sided expansion of rectangles? If so, could you please enlighten me ^-^
Thank you very much in advance,