UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Best approach for a feature.

Forums > Swift

Hi, Looking for some guidance on the best way to approach putting a feature in a card game app. Its a straight forward blackjack app that plays a set of sound files randomly.

There are 7 arrays of sounds that contain 6 sound files in each. Each array contains files that are relevant to different game scenarios. The 6 sound files in each array play randomly when triggered.

This all works fine. The next stage is to change the 7 arrays to another 7 arrays when the player score reaches 20 and then again at 40, 60 and so on. I tend to work slowly as I am a newby so I don`t want to spend days or weeks heading down the wrong path for a solution. Any advice would be appreciated.

Would an array of arrays possibly work in this situation.

2      

Hi, I think creating dedicated data structure (your own struct) would work better here than array since you know how many sound files and how many different arrays you have. And then you could associate these structs with your score to always get correct one.

2      

thank you. i will have a look at structs and get my head round them.

That will send in the right direction hopefully.

2      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.