6 years, 9 months ago.

FRDM-K64F , private variables are reset/modified when methods are called from another class.

Hi, this issue has been troubling myself and some peers all day and I am yet to find any kind of solution.

Basically I am using a premade game peripheral board and trying to make a simple platforming game.

Right now I have a class that works on randomly generating some platforms and displaying them on an LCD, I also have a class to generate a player (just a box for now).

However, I have an issue in the "GameEngine.cpp" method. When I attempt to call the player.init and the map.init methods one after another they wipe all the data stored in each other, I tried to make this visible with the inclusion of some extra methods to display the private variables.

This whole error is really cofusing because I have no idea how calling another method could possibility effect private variables.

I am programming on an FRDM-K64F, hopefully you'll have similar results on different MBED boards.

My current project code is attached.

Any insight or solution would be more than welcome, I feel like I have hit a brick wall with this.

Be the first to answer this question.