1
votes

So I'm programming an iOS game and it works perfectly fine with the iPhone 5S, but fails for the iPhone 5.

//This is my code
animationFrames = [SKTexture(imageNamed:"enemy1"),SKTexture(imageNamed:"enemy2")]

SKAction.animateWithTextures(animationFrames, timePerFrame: 0.1)

I'm guessing that the error being caused by the Array and the iPhone 5 doesn't like it that I've called an Array variable that may already be in use? This animation is for the enemy sprite and it spawns at around 10 nodes on the screen at any given time.

Any ideas of alternate ways to program an animation using Swift and SpriteKit? Or any ideas of what I need to do to fix the Array?

FIXED: Honestly don't exactly know what was wrong, but I moved the SKTextures and SKAnimation from the func() I created and into the init() and now it works fine in the simulator for all devices.

Also, iPhone 5S makes assumptions of input types, so I had to update a bunch of Double() and CGFloat() in the code for the iPhone 5

1

1 Answers

1
votes

You shouldn't need to have anything like separate animation arrays for the same animation to be run on the same sprites. When you say "fails" is this an error, or are the images a rex X in place of your animation images?

You might try deleting the app from both devices (or simulators) and do a Product -> Clean, Product -> Clean Build Folder (hold down option key). Then rebuild and run.

If that fails and you are unable to determine the cause, you could update your answer with the output in the console or a little more information about what and how it is failing.