How to reset AnalogOnScreenControl's Knob?

  ... discussions about development with the GLES1 branch of AndEngine.

How to reset AnalogOnScreenControl's Knob?

Postby RynoRn » Thu Mar 29, 2012 1:08 am

I'm using an AnalogOnScreenControl to control a Sprite. It works pretty cool like in the AndEngineExamples, but when I pop a new Scene like Level Completed during using the controller and then I hide that Scene, the controller's Knob is stucked in the last position I used it to move my object. And it keeps moving my object on starting the next level but I'm not even touching the controller. How can I reset it's Knob's position?

I tried these codes and they aren't working at all. Maybe I did something wrong..

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. 1. analogOnScreenControl.reset();
  2.  
  3. 2. analogOnScreenControl.getControlKnob().reset();
  4.  
  5. 3. analogOnScreenControl.getControlKnob().setInitialPosition();
  6.     analogOnScreenControl.refreshControlKnobPosition();
  7.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


None of these works.

Any idea welcomed!
Thanks a lot!
R
RynoRn
 
Posts: 7
Joined: Wed Mar 28, 2012 11:19 pm

Re: How to reset AnalogOnScreenControl's Knob?

Postby RealMayo » Thu Mar 29, 2012 4:52 pm

You need to completely remove the controls at the end of level1 and then re-add the controls at the beginning of level2.
User avatar
RealMayo
 
Posts: 1682
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

Re: How to reset AnalogOnScreenControl's Knob?

Postby RynoRn » Thu Mar 29, 2012 5:08 pm

I'll try that.

Thanks!
RynoRn
 
Posts: 7
Joined: Wed Mar 28, 2012 11:19 pm

Re: How to reset AnalogOnScreenControl's Knob?

Postby RynoRn » Fri Mar 30, 2012 7:45 pm

It's working! Thanks a lot! :)
RynoRn
 
Posts: 7
Joined: Wed Mar 28, 2012 11:19 pm


Return to GLES1

Who is online

Users browsing this forum: Google [Bot], illunara, ttttkk and 16 guests