Computer Science Canada RPG game eperience calculating problem |
Author: | shoobyman [ Sun Feb 12, 2006 6:01 pm ] | ||
Post subject: | RPG game eperience calculating problem | ||
This is my code for my RPG game, as you can see, when you kill the black dot, you keep getting exp, i want it to just add exp once then it is over to help me, you need to know the controls: arrow keys to move when you get close to the black dot, game pauses (it enters attack mode)and you must click to attack, the stats in the top corner change to show your HP and enemy HP. please help me solve the EXP problem.
|
Author: | [Gandalf] [ Sun Feb 12, 2006 6:35 pm ] |
Post subject: | |
An RPG eh? Good luck. Although I strongly suggest you learn far more from the Turing Walkthrough before continuing, especially considering you just leart basic arrays. Otherwise, I fear you won't get very far in your RPG. Anyways, the problem is that once the enemy is dead, the condition is met at every iteration of the loop and you gain xp. What you have to do is put the gaining of xp somewhere that will only be executed at the moment that you kill the enemy. How does right after you exit the fight loop sound? |
Author: | shoobyman [ Sun Feb 12, 2006 6:45 pm ] |
Post subject: | |
that sounds great, and i thank you for your concern, but i read the tutorial on RPGs and it doesn't look too hard. anyways, it won't be too much of an advanced RPG, just walking around and killing as well as buying new items then killing some more. leveling up, gaing exp, buying armour and weapons, you know, the RPG stuff. |
Author: | pavol [ Mon Feb 13, 2006 11:58 am ] |
Post subject: | |
your program keeps adding the experience points because the enemyHP is still <= 0. after you kill the enemy (hp reaches 0) then add 1 or whatever amount of experience points and make the enemyHp something like 100 again or more if you wish to have advanced levels or something hope it helps ![]() |
Author: | codemage [ Mon Feb 13, 2006 1:26 pm ] |
Post subject: | |
When you kill the enemy, reset it to full health & another location. |