Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 03-26-2009, 06: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: 2,570
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.
__________________
smasher is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Online Users: 334
24 members and 310 guests
adison, ashish1405, crooksy88, edcruise, Erle, Eskema, Falcon80, gbaldwin9, h2h, iSdkDev, JimGeldermann, JJJohan, jyu, Leopard, lepetitapps, MarkC, maverick0, neil_l, NeoNate, opipes, tester, wilky94, ZunePod
Most users ever online was 779, 05-11-2009 at 09:55 AM.
» Stats
Members: 24,239
Threads: 39,016
Posts: 171,115
Top Poster: smasher (2,570)
Welcome to our newest member, Hololon
Powered by vBadvanced CMPS v3.1.0

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