2 quick questions!

Discussion in 'Public Game Developers Forum' started by WellSpentYouth, Mar 27, 2009.

  1. WellSpentYouth

    WellSpentYouth Well-Known Member

    Jan 11, 2009
    1,363
    6
    0
    iPhone programmer
    App Tech Studios, USA
    Does anyone know how to do the above post? I would really appreciate it!

    Thank you!
     
  2. arkanigon

    arkanigon Well-Known Member

    Dec 24, 2008
    439
    0
    0
    #22 arkanigon, Mar 28, 2009
    Last edited: Mar 28, 2009
    I didn't understand your question. Can you clarify? What happens when you execute the code you posted... and how does it differ from what you're trying to do...
     
  3. WellSpentYouth

    WellSpentYouth Well-Known Member

    Jan 11, 2009
    1,363
    6
    0
    iPhone programmer
    App Tech Studios, USA
    Thanks for answering! This is what happens, when I tap the animation (it is running accross the screen, and when it is tapped, it changes direction) it switches direction. I do this several times so the animation goes back and forth across the screen several times. And (seemingly) randomly the lose UILabel appears.

    This is what I want it to do: Go back and forth for any amount of time and have the lose image be shown only when it goes off the screen.

    Thank you!
     
  4. arkanigon

    arkanigon Well-Known Member

    Dec 24, 2008
    439
    0
    0
    if(center.x > 550){
    pi.hidden = YES;
    center.x = -100;
    pi.hidden = NO;
    lose.hidden = NO;
    }

    pi.center = center;
    [UIView commitAnimations];


    if(pi.currentImage == piImage1)
    [pi setImageiImage2 forState:UIControlStateNormal];

    else
    [pi setImageiImage1 forState:UIControlStateNormal];
    }

    - (void)picRunLeft1{

    UIImage *piImage1 = [UIImage imageNamed:mad:"stick.png"];
    UIImage *piImage2 = [UIImage imageNamed:mad:"stick1.png"];

    [UIView setAnimationTransition:UIViewAnimationTransitionNo ne forViewi cache:YES];

    CGPoint center = pi.center;
    center.x -= 10;

    if(center.x < -100){
    pi.hidden = YES;
    center.x = 500;
    pi.hidden = NO;
    lose.hidden = NO;
    }

    I'm wondering if maybe the problem is related to using 550 at the top... but 500 at the bottom...

    at the top you have:
    if(center.x > 550){

    but near the bottom you have
    center.x = 500 (why not 550 here also?)
     
  5. WellSpentYouth

    WellSpentYouth Well-Known Member

    Jan 11, 2009
    1,363
    6
    0
    iPhone programmer
    App Tech Studios, USA
    Well, I did do all of that, I had the numbers all the same, I tried everything that I could think of. I do have a long plane ride home on Tuesday, and that should give me some good time to work (if my sister isn't to talkative :p) on it then. If you happen to have any more ideas, please feel more than free to post them;)

    Thank you!
     
  6. WellSpentYouth

    WellSpentYouth Well-Known Member

    Jan 11, 2009
    1,363
    6
    0
    iPhone programmer
    App Tech Studios, USA
    I tried doing

    CGPoint center = pi.center;
    center.x -= 10;

    if(center.x > 550){

    lose.hidden = NO;
    }

    but this same thing happens. It doesn't work. I took off the code for it coming around the other side. Do you have any other ideas?

    Thank you!
     
  7. arkanigon

    arkanigon Well-Known Member

    Dec 24, 2008
    439
    0
    0
    Is it just randomly that the lose label appears? Or perhaps it appears too late?

    once the label appears, can it disappear or does it stay there?
     
  8. WellSpentYouth

    WellSpentYouth Well-Known Member

    Jan 11, 2009
    1,363
    6
    0
    iPhone programmer
    App Tech Studios, USA
    No, it appears when the animation is still on the screen and I am pretty sure that the numbers (550) are correct. Mr. Schenk gave me them and they work when it goes off the screen and it automatically goes to the other side. ie: It goes off one side, it comes back the other. So I thought that if I put my little line of code right when it says it goes off the screen and comes back the other side, that it would work, but it doesn't. The going off one side and coming back the other works, but not the label part.

    Ok, so this is what happens to the label: It (seemingly randomly) appears when the animation has NOT yet left the screen. So it isn't late, it just appears sometime when I am to tap it (tapping changes direction). So I don't really understand it, but maybe someone else does :p

    Thank you arkanigon!
     
  9. WellSpentYouth

    WellSpentYouth Well-Known Member

    Jan 11, 2009
    1,363
    6
    0
    iPhone programmer
    App Tech Studios, USA
    I found my problem! Unfortunately not a fix :( I am pretty sure this will be pretty easy :p

    Ok, here is the problem. I have 2 different animations going and they were interfering :mad:


    If you have a moment, please take a quick look at the code to see what the problem might. There is probably something that called in the method that interferes, but I can't find it.


    Ok, so here is the code for both of the different animations running left.

    1st animation running left:


    - (void)picRunLeft1{

    UIImage *piImage1 = [UIImage imageNamed:mad:"stick.png"];
    UIImage *piImage2 = [UIImage imageNamed:mad:"stick1.png"];

    [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:pi cache:YES];

    CGPoint center = pi.center;
    center.x -= 10;

    if(center.x < -50){
    lose.hidden = NO;
    }

    pi.center = center;
    [UIView commitAnimations];



    And the second animation running left:



    - (void)picRunLeft2{

    UIImage *pic1Image1 = [UIImage imageNamed:mad:"stickmrs.png"];
    UIImage *pic1Image2 = [UIImage imageNamed:mad:"stickmrs1.png"];

    [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:pic1 cache:YES];

    CGPoint center1 = pic1.center;
    center1.x -= 10;

    if(center1.x < -50){
    lose.hidden = NO;
    }


    pic1.center = center1;
    [UIView commitAnimations];

    if(pic1.currentImage == pic1Image1)
    [pic1 setImage:pic1Image2 forState:UIControlStateNormal];
     
  10. WellSpentYouth

    WellSpentYouth Well-Known Member

    Jan 11, 2009
    1,363
    6
    0
    iPhone programmer
    App Tech Studios, USA
    I think I got it everyone! So far, it works! The problem was that the animation were interfering, so they didn't work. Thanks everyone!
     
  11. arkanigon

    arkanigon Well-Known Member

    Dec 24, 2008
    439
    0
    0
    :cool: awesome!
     
  12. WellSpentYouth

    WellSpentYouth Well-Known Member

    Jan 11, 2009
    1,363
    6
    0
    iPhone programmer
    App Tech Studios, USA
    Surprise! iScreamer has the green light in iTunes connect! Is there something that I have to do to get it on the app store? Or is it automatic? Thank you!
     
  13. arkanigon

    arkanigon Well-Known Member

    Dec 24, 2008
    439
    0
    0
    congrats!

    It's automatic. It takes a little time after you get the green light. Maybe 2-3 hours...
     
  14. WellSpentYouth

    WellSpentYouth Well-Known Member

    Jan 11, 2009
    1,363
    6
    0
    iPhone programmer
    App Tech Studios, USA
    Me is excited :p (improper english, I know) Ok, thanks! I am sure it will send me an e-mail with a link to iTunes. Correct? I'll post an official thread then.
     
  15. arkanigon

    arkanigon Well-Known Member

    Dec 24, 2008
    439
    0
    0
    nah... no email. you just have to keep checking on itunes...

    Also, what is the release date on your app?
     
  16. WellSpentYouth

    WellSpentYouth Well-Known Member

    Jan 11, 2009
    1,363
    6
    0
    iPhone programmer
    App Tech Studios, USA
    Well, it was released today. UMMMM, it was released to apple on the 22, but I released all of the info (description and stuff) on the 18th, of March.
     

Share This Page