Does anyone know a good way...
Does anyone know a good way to get the players experience in a game? Say like if you beat a certain level opponent you gain a certain amount of experience? Sorry if i''m being unclear about this
Cory Fisher
Favorite Quotes:Gandalf: You cannot pass!|Smeagol: We don't need you!|Sloth: Hey you guys!|
Um...
Store the player''s experience in a variable, store experience_given as another variable for each enemy. When player kills enemy, experience += experience_given .
Store the player''s experience in a variable, store experience_given as another variable for each enemy. When player kills enemy, experience += experience_given .
January 14, 2003 09:29 PM
Couldn''t you just test to see if the enemy is dead, and if he is, increment experience? Perhaps make a experience increment method in you player class like this:
RaiseExp(int level) { // send the level of the enemy killed if(level == 1) { experience += 10; } if(level == 2) { experience += 20; } // and so on}
if you know anything about switch statements, you could use those. If not, nevermind.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement