java - Instance variable reseting their value -


This code is showing weird behavior The basac class calls just in order: Init Profex, Init Graphics and On Crate (only one Times) and then work (for each frame). The expected behavior is that in order to use this value to set the x position of the object to the fixX value (which is actually -6) in the onCreate method, each frame has the X-OXY object Keeps to the stable. I work by inserting a debug point on the street and it is called properly. When

  fxx meets =) GetPosition () X;  

It receives value 6, as expected, but can return fxx to value 0. When I change the fixx variable, the things work as expected. I do not know how I will put a system on the constructor of the BirdOut so that it can be ensured that the object is created only once. The body set transforms the transformer into a Jenny interface for C + + LibGadex with box 2D engine. Public square birdactor baseactor (private float fixedx = 0; public birdactor () {System.out.println ("created");} @ Override protected body init profesionation () {return assets Get ready to get rid of override (0);} @ override protected form () {fixX = getBody (). GetPosition () .x;} @ Override Public Zero Act () {GetBody (.) SetTransform (fixx, getBody (). GetPosition (). Y, 0); super.act ();} @ Override Protected Sprite Init Graph Ix () {Sprite Sprite = New Sprite (Assets.TechnctionsBird); Return Phantom;}}

There may be a problem because you call the virtual method in the constructor.

Then there is the call list:

  1 baseactor () 2. Creating of Bird Acct 3 () The BirdActer () is in Fxx 0 = 0. After initializing  FxX , it will be used for  onCreate ()  method  fixX  initialization ( = 0 ). 


Comments