I'm new to StackOverflow, (Just signed up) and with that, pretty darn new to coding! I've been using YouTube videos to learn how to code, and I'm currently trying to make a game similar to Flappy Bird. Not to publish, merely to experiment.
I've completed the coding for the game, however I want to add a sound effect when any area on the screen is touched, but only at a certain time (After the 'start' button is pressed).
I tried this with a button fitted to the whole ViewVontroller, but it disallowed me to actually play the game....
I heard touchesBegan would make this work, so please help me.
Thank you in advance =D
I think it should work fine :
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if (startButtonPressed) {
//Play sound
}
}
Tells the receiver when one or more fingers touch down in a view or window.
Official documentation HERE
You can also do it with StoryBoard :