Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

How to change an int in a different class (for score)

$
0
0
So what i'm trying to achieve is that everytime a zombies health reaches 0 the players score is increased by one. I currently have no clue why this sin't working. Here is my code Code within the enemy class: if (health <= 1) { SurvivalScore SS = (SurvivalScore)target.GetComponent ("killscore"); SS.killscore (+1); } Code within the scoring system: public int zombieskilled public void killscore(int adj) { zombieskilled += adj; } Any help will be appreciated as currently the score is always displayed at 0.

Viewing all articles
Browse latest Browse all 1488

Trending Articles