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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

Thread: Platform game
View Single Post
Old 02-09-2010, 04:30 PM   #4 (permalink)
smasher
Senior Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
Default

I would definitely start with one *stationary* platform at the center of the screen, get that working, and once you understand that it will be easier to expand to multiple platforms.

There's code in this thread, which explains how to add images to the current view and how to move them around. How will you control the ball, by the way? Swiping the screen, or accelerometer?
http://www.iphonedevsdk.com/forum/ip...dom-rocks.html

Do not copy that code directly, but look for the method for adding imageviews and moving imageviews.

I'd make one "platform" graphic that's wider than the screen and with a hole in the center. That'll make the math easier. For now, put one platform at y=100, with the center at x= 150.

For the motion of the ball, you'll want it to fall down unless it's rolling on the platform, right? You know it's on the platform when the y value of the ball is just a little less than the y value of the platform. Then you can change to the rolling behavior.

In short, I'd break it down into getting these steps working:
1) get a ball falling down the screen
2) add the platform
3) get the ball to stop when it hits the platform
4) get the ball to roll in the right direction when it's on the platform
5) get the ball to fall through the hole (when ball center x is close to platform center x)
6) change to an array of platforms; you'll have to use a loop to check each platform.
7) change code to make platforms move up, and "push" the ball up when the ball is on a platform.
__________________

Free Games!

Last edited by smasher; 02-09-2010 at 04:32 PM.
smasher is offline   Reply With Quote
 

» Advertisements
» Online Users: 325
21 members and 304 guests
ADY, AppAnnex, chemistry, fkmtc, HemiMG, her-ur, iDifferent, ilmman, leahov, MarkC, marto1914, Meoz, nicko, padsoftware, Raffaello, sneaky, sojourner, syver, tathaastu, timle8n1, ziocleto
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,877
Threads: 89,219
Posts: 380,713
Top Poster: BrianSlick (7,129)
Welcome to our newest member, peterkessler45
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:37 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.