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

View Single Post
Old 03-26-2009, 07:04 PM   #13 (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

Quote:
Originally Posted by LeopardDevX View Post
I`m really sorry for dum questions...
,but by "in a void" i mean in a method...
And i dont have the code to spawn a enemy..
Thanks for the arc for random code i will use that.. when i know how to spawn enemies.....
And what is the newEnemy is that reffered to "spawnedEnemy" or what is it for?
Thanks...

Sorry im a newb....
And you have helped me alot....
No problem. You usually start the timer once, with an interval like 30 times a second. It's unusual to change the timer interval during the games.
Code:
timer = [NSTimer scheduledTimerWithTimeInterval: 0.033f
                 target: self
                 selector: @selector(handleTimer:)
                 userInfo: nil
                 repeats: YES];
If you want to change the interval later, you have to call [timer invalidate] and create a new timer. You should probably good for a timer example to get all the code for starting/stopping a timer.


The code I gave above spawns 10 balls on the screen - you could use it to spawn enemies too.
__________________

Free Games!
smasher is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,726
Threads: 89,185
Posts: 380,516
Top Poster: BrianSlick (7,127)
Welcome to our newest member, donbran2
Powered by vBadvanced CMPS v3.1.0

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