Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a UIImageView called hitBox, and another image called mainSprite. So what I want to do is when an IBAction is pressed, it will move hitBox to above mainSprite. I don't know if this is syntax but this is what I know moves things on the screen. = CGPointMake(x coordinate, y coordinate);

I just want to replace x coordinate and y coordinate with something that will place it somewhere in relation mainSprite.

share|improve this question
is your mainsprite a sprite. – Robin Feb 2 '12 at 5:13
Woeful lack of research here. – Byte56 Apr 18 '12 at 20:45

Why not ?

[edit] CGPointMake(,;
share|improve this answer
No i mean like 5 pixels above it. Not over it. could i do = – Will Jan 29 '12 at 13:50
You can't add 5 to a CGPoint, I've edited my answer to show you how you do this. – jptsetung Jan 29 '12 at 21:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.