New answers tagged objective-c
0
I have figured it out, I just added another animation which consists of 1 frame, then when i need it, i play the animation:
[mySprite stopAnimation]; //Stops CurrentAnimation
[mySprite prepareAnimationNamed:@"jumpAnimation" fromSHScene:@"Jungle"];
[mySprite playAnimation];
1
Measure the time between the user started to touch the screen and until he release it. If the measured time is below a certain threshold ( 1 sec?! ) it's a tap, otherwise it's a long hold.
2
The way to deal with this is to set a timer once the person taps the phone. The most user friendly scenario that you'd implement would look something like this:
When you detect a tap, set a timer (t = timeToRepeat)
On each frame, decrease the timer by dt
If the timer reaches zero, move the sprite a tile and reset the timer
If the user releases their finger ...
0
This is super general advice, and I'm no Obj-C expert, so take it with a grain of salt.
Having said that, I'd recommend that you think very carefully about what each variable is for and give them more appropriate names. Write lots of comments. Click on the line numbers to create a breakpoint, and run your app in the simulator. It will pause at the ...
Top 50 recent answers are included
