I'm making a Laser Tag game and I'm not at home so I can't test this code. If any of you could tell me how "good" or "bad" this code is, it would be appreciated.
Sorting Players Based on Score:
proc/pickHighest(var/i)
var/highest=0
var/mob/R
for(;i<players.len;i++)
if(players[i].score >= highest) //Not sure if you can access a mob's vars from a list like this.
highest=players[i].score
R=players[i]
return R
proc/sortPlayers()//This is sort the players by picking the highest out of the list, eliminating one, each run through the loop.
var/i=1
for(var/mob/M in players)
scores[i]=pickHighest(i)
i++
Calculating Score:
mob/proc/calAccuracy()
if(src.client)
return((Shots_Hit/Shots_Fired)*100)
else
return 0 // or null
mob/proc/calScore()
if(src.client)
var/temp_score= src.Shots_Hit * 3.5 // 3.5 is not definite, not sure how high I want the scores to go.
return temp_score + (temp_score * (src.calAccuracy()/100))
else
return 0 // or null
Thats what I've got for now, what do you guys/girls think?
Is it good?
Will it work?
Is it efficient?
-KirbyAllStar