Computer Science Canada classes help |
Author: | evildaddy911 [ Tue May 08, 2012 10:43 am ] |
Post subject: | classes help |
What is it you are trying to achieve? I'm trying to replicate the pokemon combat system, in the hopes that i can create a new game with it What is the problem you are having? when i use the initialize procedure of the character class, the player's data gets replaced by the enemy -> initialize parameters Describe what you have tried to solve this problem this is one of my first projects with classes, so i have no idea what is wrong if anyone can help me clean up my code, it would be appreiciated too Please specify what version of Turing you are using open atm, the school has 4.0.5, my home has 4.1.1a |
Author: | Dreadnought [ Tue May 08, 2012 12:47 pm ] |
Post subject: | Re: classes help |
evildaddy911 wrote: when i use the initialize procedure of the character class, the player's data gets replaced by the enemy -> initialize parameters
I'm not sure what the expected behavior is. What is supposed to happen that is not happening, or what is happening that shouldn't? |
Author: | evildaddy911 [ Tue May 08, 2012 2:54 pm ] | ||
Post subject: | Re: classes help | ||
on lines 223 and 224 (ive made some changes, so the old file may have this on different lines), i have
[ proc initialize (name : string, attack, defence : real, health, Exp, Level : int) ] what is happening, is the second initialize call is overriding the first, giving both enemy and player identical stats. I dont want this, i want the player and enemy to have different stats. I thought that when you defined variables for one object, they would not alter another object of the same class's variables. I have no idea why this is happening, so im asking how to fix it |
Author: | Zren [ Tue May 08, 2012 6:58 pm ] | ||
Post subject: | RE:classes help | ||
|
Author: | evildaddy911 [ Thu May 10, 2012 3:06 pm ] |
Post subject: | RE:classes help |
thanks, fixed now |