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 02-18-2011, 03:30 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 5
syndrome is on a distinguished road
Default add array to a NSMutableArray ?

I have this method:

Code:
		
for(CCSprite *sprite in mySprites){
		 
		CGPoint posizioneActual = sprite.position;
		NSInteger posizioneInt = 0;

		if (i determine the position of the sprite) posizioneInt = ..;
		else if..
		else if..

NSInteger spriteRotation = 0;
		
		if(sprite.rotation == -90) spriteRotation = 1;
		else if(sprite.rotation == 0) spriteRotation = 2;
		else if(sprite.rotation == 90) spriteRotation = 3;
		else if(sprite.rotation == 180) spriteRotation = 4;

NSArray *lastPosition = [NSArray arrayWithObjects:[NSNumber numberWithInt:posizioneInt], [NSNumber numberWithInt:spriteRotation], nil];

		[actualState addObject:lastPosition];
actualState is a NSMutableArray, and I want to add all the position of the sprite (now contained in lastPosition) in actualState, so I have an array that contains other arrays.

But [actualState addObject:lastPosition]; doesn't work, the console sais:

2011-02-18 10:19:12.664 game[28165:207] actualState count = 0

Maybe I have to transform my array to add it as an object... but how?
syndrome is offline   Reply With Quote
Old 02-18-2011, 08:02 AM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Where do you create actualState?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Reply

Bookmarks

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: 428
9 members and 419 guests
7twenty7, chemistry, ChrisYates, hussain1982, Retouchable, skrew88, SLIC, walex, xzoonxoom
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:11 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0