-6

I have the Y axis increasing very few frames with the following line:

Bullets.center = CGPointMake(Airplane.center.x, Airplane.center.y + Y);

How can I stop increasing Y when an if statement is true?

esqew
  • 42,425
  • 27
  • 92
  • 132
TheEliteTech
  • 147
  • 3
  • 11

1 Answers1

0

Basically, I'd say "don't add Y if the statement is true", but I may be misunderstanding your question, it seems quite simple. A ternary operator in the CGPointMake will take care of it:

Bullets.center
    = CGPointMake(Airplane.center.x, Airplane.center.y + (CONDITION ? 0 : Y));
Nick Veys
  • 23,458
  • 4
  • 47
  • 64