hello, for a school project i have to create a fighting game. After displaying player 1's characters, I would like player 1 to select a character from their list. Can you help me ? thank you
Swift
func list() {
print("here are the three characters :")
for characters in Character {
print("\(characters.charactersName), \(characters.weapon), \(characters.lifePoint)")
}
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm beginner in the coding and I block on the line "let fighter = Fighter () '
Xcode displays "Missing argument for parameter 'name' in call"
class Player{
var name: String
var characters: [Character] = []
init(name: String){
self.name = name
}
func chooseYourCharacter() {
if let readline = readLine() {
if let choose = Int(readline) {
switch choose {
case 1:
let fighter = Fighter()
fighter.namedCharacter()
if fighter.goodCharacterName(arrayOfCharacter: self.characters) == true {
characters.append(fighter)
}