wasn't sure how title this, need count how many enemies player killed before die , respawn point , health system.
my idea set variable gets 1 added on each collide , when player killed takes amount of stored score variable , uses point , health system, move on screen up.
some super pseudo code like:
var storedplayerscore = 0 var healthplus = skaction.moveby(cgvectormake(0, (10 * storedplayerscore)), duration: 0.05) i've got both of defined in gamescene.
and down in didbegincontact i'd storedplayerscore++ whenever 2 correct objects collide.
so before when making sure health going worked, had number in stored variable was, when use gives me "gamescene.type doesn't have variable named storedplayerscore"
am on right track here? how clear error i'm getting?
you trying access on type rather on instance of type.
class gamescene { var storedplayerscore: int = 0 } var score1 = gamescene.storedplayerscore // error let mygamescene = gamescene() var score2 = mygamescene.storedplayerscore // works this confusion brought on names you're choosing variables. in code above, have variable called healthplus named capital first letter. makes type instead of instance. convention variable names start lowercase letter, while type declarations start capital letter. should healthplus instead.
Comments
Post a Comment