I am trying to draw a group of rectangles (as part of a space invaders-style game). So what I've done so far is to create a struct of the coordinates, and status (destroyed or alive).
After reading some documentation, I noticed that drawing will be inside of the drawRect method (that xcode creates for you if the class inherits from UIView).
What I can't figure out is how to get the rectangles to move (left to right/top to bottom/whatever) and update the view every single time.
1.) Should I create an instance variable (of type Struct) to send to the drawRect: method? If so, how would I do this?
2.) Each time I update the rectangle (by moving it or removing it after a missile hits it), do I need to call setNeedsDisplay?
After reading some documentation, I noticed that drawing will be inside of the drawRect method (that xcode creates for you if the class inherits from UIView).
What I can't figure out is how to get the rectangles to move (left to right/top to bottom/whatever) and update the view every single time.
1.) Should I create an instance variable (of type Struct) to send to the drawRect: method? If so, how would I do this?
2.) Each time I update the rectangle (by moving it or removing it after a missile hits it), do I need to call setNeedsDisplay?