Problem with class hot swap
Reported by: Eldar Bertsel
September 21, 2023
THE PROBLEM
When I started creating classes, having one class was no problem. All the stats, models and abilities where correct, but when I added multiple classes, each having different model, stats and abilities and started swapping them, current class would be overridden with the information of the next class to which the player would swap resulting in one class left regardless of which class you chose to swap. Basically, you started playing as a knight, then swapped to a magician, then swapped to rogue. Knight would now have all the parameters of the Magician class, Magician class would now have all the parameters that Rogue class has. If you click long enough you can make it so every class is the same thing. Unfortunately, it also saved those changed when I closed the game mode so I had to fill out the information for each class again.
THE SOLUTION
To solve that issue I had to create a temp variables each parameter of the class, then, when swapping the parameters I would first assign them to those temp variables and in another function I would take a value from the tamp and assign it to the actual parameters of the current class that should take place. Figuring out that I need a temp value to hold the data took me a lot of time because I was trying to find a way where I could directly swap parameters, but it is either I was doing something wrong or you must have to have a temp value.
Get Psyche
Psyche
Welcome to your next great souls-like adventure!
Status | In development |
Author | Sad Ogre Studios |
Genre | Role Playing, Adventure |
Tags | Atmospheric, Fantasy, Indie, mind-bending, psyche, Sci-fi, Singleplayer, Souls-like, Third Person |
More posts
- Problem: Harder Isn't Always More FunDec 14, 2023
- How to make the controller feel more responsiveDec 14, 2023
- ModelMayhem: A Programmer's TaleDec 08, 2023
- Problem: Face Your FearsDec 03, 2023
- Time to show our real main characterDec 01, 2023
- Problems: melee combat system is too boringNov 24, 2023
- Problem: Frames Win Games?Nov 17, 2023
- Problem with camera transitionNov 16, 2023
- Combo Attack systemNov 11, 2023
- Problems with code reusabilityNov 03, 2023
Leave a comment
Log in with itch.io to leave a comment.