i have created method sets uiimageview's position 35 pixels away uiimageview called mainsprite.
code:
-(ibaction)hit{ [self hitdummies]; if (direction == 1) { [self hitdummies]; hitbox.center = cgpointmake(mainsprite.center.x+30, mainsprite.center.y); } if (direction == 2) { [self hitdummies]; hitbox.center= cgpointmake(mainsprite.center.x,mainsprite.center.y+30); } if (direction == 3) { [self hitdummies]; hitbox.center = cgpointmake(mainsprite.center.x-30, mainsprite.center.y); } if (direction == 4) { [self hitdummies]; hitbox.center = cgpointmake(mainsprite.center.x, mainsprite.center.y-30); } it move want. there void method tests if hitbox intersects uiimageview: dummies.
code:
-(void)hitdummies{ if (cgrectintersectsrect(hitbox.frame, dummies.frame)) { nextconvobut.enabled = yes; nextconvobut.hidden = no; } } as can see calling method in -(ibaction)hit. keep in mind "hit" linked "touch down".
if need see more code ask
Forums iPhone, iPad, and iPod Touch iOS Programming
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless
No comments:
Post a Comment