I have created a method that sets this UIImageView's position to 35 pixels away from another UIImageView called mainSprite.
It does move it where I want. But there is another void method that tests if this hitBox intersects with another UIImageView: dummies.
As you can see I am calling this method in -(IBAction)hit. Keep in mind "hit" is linked with "touch down".
If you need to see any more code just ask
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);
}
Code:
-(void)hitDummies{
if (CGRectIntersectsRect(hitBox.frame, dummies.frame)) {
nextConvoBut.enabled = YES;
nextConvoBut.hidden = NO;
}
}
If you need to see any more code just ask
Last edited by a moderator: