Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-31-2008, 01:46 PM   #1 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 3
bdeshong is on a distinguished road
Default Tracking progress of UIView animations?

I'm working on a game that is going to require knowing when one UIImageView and another intersect.

In a nutshell, the user is firing, let's say, bullets, while there is a timer used to launch targets onto the plane at random. When the "bullets" and the "targets" intersect, the "target" needs to explode.

To achieve this, I need to track the coordinates of each, but I'm finding that the CGPoint values for "center" aren't being updated as the animation progresses.

I could make a guesstimate on the progress based on the number of pixels being traveled with UIView, but that's really kind of a hack. Also, using the methods called when the animation is started and stopped doesn't really help me either.

I read elsewhere that only OpenGL will allow me to animate and track on a per-pixel basis. Does anyone know if this is the case, or can I somehow get by with the UIView animation functionality?

Thanks in advanced for any insight!
bdeshong is offline   Reply With Quote
Old 08-31-2008, 03:06 PM   #2 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 802
scottiphone is on a distinguished road
Default

The built in animation functions are primarily where you want something to change from A to B and don't really care about the in-between points. This works well for things like the UI because you can just say do it and away it goes.

If you have a game or something where you need to really control the images directly the best thing is to do the animation yourself. Just change the frame position or transform. The redraw is handled automatically.

Setup an NSTimer and have it call you main animation routine. Since you're dealing with objects each can keep info specific to themselves. This isn't any different than OpenGL or other platforms. The advantage of OpenGL is where you have a number of still images moving around. At a certain point this is faster in OpenGL. The downside is you have to learn OpenGL as well and code for it.
scottiphone is offline   Reply With Quote
Old 08-31-2008, 11:06 PM   #3 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 3
bdeshong is on a distinguished road
Default

Got it working great now, thanks! Handling the animation manually isn't too shabby...it's actually great to give me an understanding of how things work together.

Thanks again for the tip!
bdeshong is offline   Reply With Quote
Reply

Bookmarks

Tags
animation, opengl, uiimageview, uiview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 344
10 members and 334 guests
alexP, ClerurcifeDer, Duncan C, givensur, glenn_sayers, guusleijsten, JmayLive, Punkjumper, whitey99, yys
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,114
Posts: 402,883
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:40 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0