xcode - How to move an image -


i creating app bombs come screen , blow thing have move. how make these bombs fly screen , move in random directions automatically ? kind of fruit ninja fruits fly out @ you. how code ? need ? please provide code. thank !

create class, called bomb or , needs have instance variable , property of cgrect on ios or nsrect on mac os.

then create method can draw bomb on screen, - drawonscreen or - draw knows how draw object. contain code [[uiimage imagenamed:@"bomb1"] drawinrect:self.frame]

then in game loop simple change coordinates of frame of such bomb object make move, of course need before calling draw method draw previous frame then..

there way of adding subview gameview every time need new bomb. view has more overhead using object described above , cause game run slow if have 50/60+ ( wild guess ) bombs.

for controls on screen pause button use view , add subview.


Comments