Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9224687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:23:06+00:00 2026-06-18T04:23:06+00:00

I feel that the best way to grasp a new programming language is to

  • 0

I feel that the best way to grasp a new programming language is to make simple games.

So for my first game setup, there will only be 4 buttons (Up, Down, Left, and Right). The buttons will change the position of a single image view object. So for example, if I wanted to press Up then the object will move up by having its X Y coordinates changed. This is where I’m stuck, how do I do this?

Here’s my psuedocode:

_imgShip.frame.position.x += 1;

That line of code is inside a button press event handler so if I press Right then the value of the current X coordinate will add 1 to itself. How do I do this exactly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:23:07+00:00Added an answer on June 18, 2026 at 4:23 am

    You’re pretty close. You’re probably better off moving the center though.

    _imgShip.center = CGPointMake(_imgShip.center.x + 1.0, _imgShip.center.y);
    

    Update:
    I should also note that you could translate the view. This is a bit different but opens the door to rotations and scales too which could be useful for games 🙂

    _imgShip.transform = CGAffineTransformMakeTranslation(1.0, 0.0);
    

    For starting transforms use the Make variations. But there are also ones that build on each other so if you wanted to rotate AND translate you could do something like:

    _imgShip.transform = CGAffineTransformMakeTranslation(1.0, 0.0);
    _imgShip.transform = CGAffineTransformRotate(_imgShip.transform, 0.785); // in radians
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my heart, I feel that there must be a super simple recursive solution
I know there is a question about conditional DetailView, I however feel that's not
At work, my PC is slow. I feel that I can be way more
Let me start out by saying that I feel like there should be a
I'm trying to figure out the best way to calculate a value that is
The question should be simple, but i'm thinking what the best way to do
I feel that both are the same thing, but I am not sure.
When do you feel that it's appropriate/necessary to take deeper dives into the source
I have recently started to feel that I need to greatly improve my C++
I've been looking around for quite a while and feel that I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.