running animation

Posts: 8
Joined: 2009.06
Post: #1
Hi there,
I am jut beginning studying programming for the iPhone.

What I would like to know is, and this is what my logic tells me, but if I wanted to have a character run across the screen, his animation would lie inside his class. It would simply be triggered when X button is pushed and the animation itself would be (say 2 images) that would interchange at X frequency. The frequency would all be code.. everything would all be code. There are no magic timelines or anything like that.

Am I right?

Please tell me if I am.
Quote this message in a reply
Posts: 281
Joined: 2009.04
Post: #2
Well, I've not delved into Objective-C, but as you're using OpenGL, you'll want to switch the texture2D.

Yes, you are right, but you must be careful how you do this. It could be easier to calculate the number of loops of your game, then work out the time, and change texture every X loops. Use a timer function!

I'm not sure how the Iphone manages time, but good luck anyway,

~ Bring a Pen ~
Quote this message in a reply
Posts: 24
Joined: 2009.08
Post: #3

I have a 2 Frame animation for my iphone app.

I have 1 NSTimer set to 60 Hz. Then I have a counter for my frame intervals... every time my frame counter is full, I switch my animation image.

but if you want to have smooth animation you should have more than 2 frames, maybe 3-5 frames for one cycle.

for my purposes , 2 frames are ok to get a funny stick figure effect.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Anyone think they could get this running on the Mac? Leisure Suit Lurie 6 5,699 Jan 23, 2006 05:34 AM
Last Post: Leisure Suit Lurie