#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    1
    Rep Power
    0

    Newbie to visual c


    I have always worked in c# and jave, but i have recently started to work on making an iphone game. Right now i have figured out how to move an object but after it moves, i try to display the position in two labels, and then when i move it again it moves back, now this behavior bafels me and i was wondering why it does this
    - (IBAction)btnTestUIButton *)sender
    {
    pos = CGPointMake(5, 3);
    self.picPicture.center = CGPointMake(_picPicture.center.x + pos.x, _picPicture.center.y + pos.y);
    posLocation = CGPointMake(_picPicture.center.x, _picPicture.center.y);
    self.lblX.text = [NSString stringWithFormat:@"%f",posLocation.x];
    self.lblY.text = [NSString stringWithFormat:@"%f" ,posLocation.y];
    }
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Location
    Dallas, TX
    Posts
    50
    Rep Power
    1
    Originally Posted by og anarchy
    I have always worked in c# and jave, but i have recently started to work on making an iphone game. Right now i have figured out how to move an object but after it moves, i try to display the position in two labels, and then when i move it again it moves back, now this behavior bafels me and i was wondering why it does this
    - (IBAction)btnTestUIButton *)sender
    {
    pos = CGPointMake(5, 3);
    self.picPicture.center = CGPointMake(_picPicture.center.x + pos.x, _picPicture.center.y + pos.y);
    posLocation = CGPointMake(_picPicture.center.x, _picPicture.center.y);
    self.lblX.text = [NSString stringWithFormat:@"%f",posLocation.x];
    self.lblY.text = [NSString stringWithFormat:@"%f" ,posLocation.y];
    }
    May need a bit more information. I see that this method just moves the image over 5px and down 3x each time you tap it, but I may need to see a bit more code to determine what the issue you're seeing may be. Can you post the contents of the entire class?

IMN logo majestic logo threadwatch logo seochat tools logo