How Do I Stop the Assignment/Operator '+='

Dear All,

I really need to know how to stop my skater image descending off the visable screen. how do i stop the += assignment for the y axis when my picture reaches a certain coordinate?

Many Thanks,
Mallinexor
Inside your operator you validate that modifying your 'y' will not put you off the screen, if this is satisfied you let the += do it's work and return *this as you have been doing. If the validation fails do not modify 'y' and return *this.
Bounds checking. Before you draw, check to see if the variable is above a certain boundary, and if it is, set it to the maximum limit.
Topic archived. No new replies allowed.