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 Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-18-2011, 12:28 AM   #1 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 7
Doodl3 is on a distinguished road
Default Rotate an object.

Hi, i was just wondering. If i had a game where i wanted you to make an arrow switch directions, and if i split my screen in half, and declared in my touchesbegan method That the right half of the screen was Krighttouch and the left half Klefttouch , and i had a uiimage of an arrow (depicted as this in my post "--->" ) That sat in the middle of the screen pointing to the right. what would i do to rotate the arrow from facing the right to the left IF you touched the left side, and right if you touched the right side of the screen. for example,

If you touched the right side of the screen the arrow would look like this. --->
Or if you touched the left side of the screen the arrow would look like this <---

So basicly you would rotate the image 180 degrees on its Y axis if you touched / pushed your finger and held it down on the right or left side. any help would be greatly apreciated! Also, I searched the forum and i couldnt fidn information on what im doing specifically , and remember that it cant just be a line of code that says spin the object 180 degrees, because if the user pushes down and holds his/her finger on the screen, it will spam that and the image will just spin 360's. Thanks for your time!

Last edited by Doodl3; 03-18-2011 at 12:36 AM.
Doodl3 is offline   Reply With Quote
Old 03-21-2011, 10:46 PM   #2 (permalink)
Registered Member
 
missing_no's Avatar
 
Join Date: Feb 2011
Posts: 41
missing_no is on a distinguished road
Default

Quote:
Originally Posted by Doodl3 View Post
Hi, i was just wondering. If i had a game where i wanted you to make an arrow switch directions, and if i split my screen in half, and declared in my touchesbegan method That the right half of the screen was Krighttouch and the left half Klefttouch , and i had a uiimage of an arrow (depicted as this in my post "--->" ) That sat in the middle of the screen pointing to the right. what would i do to rotate the arrow from facing the right to the left IF you touched the left side, and right if you touched the right side of the screen. for example,

If you touched the right side of the screen the arrow would look like this. --->
Or if you touched the left side of the screen the arrow would look like this <---

So basicly you would rotate the image 180 degrees on its Y axis if you touched / pushed your finger and held it down on the right or left side. any help would be greatly apreciated! Also, I searched the forum and i couldnt fidn information on what im doing specifically , and remember that it cant just be a line of code that says spin the object 180 degrees, because if the user pushes down and holds his/her finger on the screen, it will spam that and the image will just spin 360's. Thanks for your time!
I actually just answered this question in a thread like one week ago. If you would just read the Apple SDK documentation it's all there.

http://www.iphonedevsdk.com/forum/ip...animation.html

and to keep if from continuously flipping you need to use BOOLs to flag the current orientation or use both touchesBegan AND touchesEnd along with segregating the self.view to look for a location (CGPoint perhaps)

Last edited by missing_no; 03-21-2011 at 10:49 PM.
missing_no is offline   Reply With Quote
Reply

Bookmarks

Tags
animation, image, rotate

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: 423
5 members and 418 guests
chemistry, hussain1982, Retouchable, skrew88, SLIC
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,128
Posts: 402,921
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

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