Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Jose Zamudio
Jose Zamudio
3,328 Points

spriteNodeWithImageNamed: big red X

Hi! I'm using SprikeKit to build a game but I'm having issues using the atlas, whenever I use the spriteNodeWithImageNamed: i do not get an error but when I run the app I get a big red X square where my image is suppose to be, I have imported the Sprites.atlas following the tutorial here but when I run it I just can't get my images working, any help would be greatly appreciated!

this is my code: alt text

and this is what i get in the simulator: alt text

Robert Bojor
Robert Bojor
Courses Plus Student 29,439 Points

Normally the "big x" appears when the images are not present in the project.

When you dragged the Sprites.atlas folder into your project did you check the "Copy files to destination folder..."?

Jose Zamudio
Jose Zamudio
3,328 Points

Robert Bojor I did, when I copy the files independently and not in an .atlas folder the images load up correctly, but if they are in an .atlas folder I keep getting the big old X

Here is my app folder to show the files are in there:

alt text

1 Answer

Robert Bojor
PLUS
Robert Bojor
Courses Plus Student 29,439 Points

Is that Xcode6-Beta3 and iOS8? I want to test this.

Tested it in Xcode5 and last iOS production version available and it works like a charm, see https://www.dropbox.com/s/ti3hwby7b086z83/Screenshot%202014-07-10%2019.22.14.png.

Jose Zamudio
Jose Zamudio
3,328 Points

It's Xcode 5 running on Yosemite, weird thing is that when I build the Space Cat app (from Build a Game with Sprite Kit tutorial) the Sprites work like a charm, but in my app they won't, I will start from scratch again and see if that fixes the issues and let you know...

Robert Bojor
Robert Bojor
Courses Plus Student 29,439 Points

As I said, they only time that happened to me was when the image was not copied or the spelling of the name was not correct. I've only built a copy of Flappy Bird to test my Sprite Kit knowledge until now mainly because of lack of ideas and graphic skills :)

Jose Zamudio
Jose Zamudio
3,328 Points

I got it working! I think what I did wrong (or Apple maybe? :P) is that when I created the project I did it in Xcode6-Beta3, but since it was running really slow when compiling and running I switched back to Xcode 5... Now that I created the project on Xcode 5 everything is running smooth... Thanks for the help Robert!