
-----------------------------------
evildaddy911
Tue May 08, 2012 10:43 am

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

-----------------------------------
Dreadnought
Tue May 08, 2012 12:47 pm

Re: classes help
-----------------------------------
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?

-----------------------------------
evildaddy911
Tue May 08, 2012 2:54 pm

Re: classes help
-----------------------------------
on lines 223 and 224 (ive made some changes, so the old file may have this on different lines), i have
player -> initialize ("player", Rand.Int (50, 200), Rand.Int (50, 200), Rand.Int (500, 2000), player -> get_xp, player -> get_lv) %   sets up random player/enemy stats
enemy -> initialize ("enemy", Rand.Int (50, 200), Rand.Int (50, 200), Rand.Int (500, 2000), enemy -> get_xp, enemy -> get_lv)
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

-----------------------------------
Zren
Tue May 08, 2012 6:58 pm

RE:classes help
-----------------------------------

    function get_attk : real
        result temp.Atk
    end get_attk

    function get_def : real
        result temp.Atk
    end get_def


-----------------------------------
evildaddy911
Thu May 10, 2012 3:06 pm

RE:classes help
-----------------------------------
thanks, fixed now
