Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Don't work a control animation.

Don't work a control animation.

Put your problem here if it does not fit any of the other categories.

Don't work a control animation.

Postby izludec » Tue Mar 27, 2012 6:23 pm

Sorry for my very stupid code and my bed English.
I'am learning Java,Android,Andengine only 1 month.
I would like to make the program that when the user pressed the right side of the screen animation moved to the right and when on left that to the left. But when I launch a program on my smartphone my control dont't work.
Here's my code:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. imports .....
  2.  
  3. public class SlimeActivity extends BaseGameActivity {
  4.  
  5.     public static Camera mCamera;
  6.     public static final int Camera_width = 800;
  7.     public static final int Camera_height = 480;
  8.     private static final long delay = 1000;
  9.     float touchX;
  10.     float touchY;
  11.     int touch=1;
  12.     int xPos;
  13.     int count;
  14.     public static Scene MainScene;
  15.       TiledTextureRegion _TiledSprite_TR;
  16.      TiledTextureRegion _TiledSprite_TR2;
  17.      TextureRegion _Sprite_TR;  
  18.      public boolean onTouchEvent(MotionEvent event)
  19.          {
  20.                  if((event.getAction() == MotionEvent.ACTION_DOWN) || (event.getAction() == MotionEvent.ACTION_MOVE) )
  21.          {
  22.                  touchX = event.getX();
  23.              touchY = event.getY();
  24.              touch=0;    
  25.                  }
  26.                  else {
  27.                          if (event.getAction() == MotionEvent.ACTION_UP){
  28.                          touch = 1;
  29.                          }
  30.                 }
  31.                  return true;          
  32.                                  }              
  33.     @Override
  34.     public void onCreate(Bundle savedInstanceState) {
  35.         super.onCreate(savedInstanceState);
  36.     }
  37.     @Override
  38.     public Engine onLoadEngine() {        
  39.         mCamera = new Camera(0, 0, Camera_width, Camera_height);      
  40.         return new Engine(                
  41.                 new EngineOptions(
  42.                         true,   //режим Fullscreen = true
  43.                         ScreenOrientation.LANDSCAPE,    
  44.                         new RatioResolutionPolicy(Camera_width, Camera_height),mCamera)
  45.                 .setNeedsSound(true)    
  46.                 .setNeedsMusic(true));  
  47.     }
  48.     @Override
  49.     public void onLoadResources() {
  50.          BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");        
  51.         BitmapTextureAtlas Texture1 = new BitmapTextureAtlas(1024, 1024, TextureOptions.NEAREST_PREMULTIPLYALPHA);
  52.         BitmapTextureAtlas Texture2 = new BitmapTextureAtlas(1024, 1024, TextureOptions.NEAREST_PREMULTIPLYALPHA);
  53.         _TiledSprite_TR = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(Texture1, this, "anim.png", 0, 0, 9, 1);
  54.         _Sprite_TR = BitmapTextureAtlasTextureRegionFactory.createFromAsset(Texture2, this, "face.png", 0, 0);
  55.         mEngine.getTextureManager().loadTextures(Texture1);        
  56.     }
  57.     @Override
  58.     public Scene onLoadScene() {
  59.         MainScene = new Scene();
  60.         if (touch==0){
  61.         if (touchX > 400){
  62.         AnimatedSprite _AnimSprite = new AnimatedSprite(70, 400, _TiledSprite_TR);
  63.         _AnimSprite.registerEntityModifier(new MoveModifier(5, 70, Camera_width - _AnimSprite.getWidth(), 400, 400));
  64.         _AnimSprite.animate(50);
  65.         MainScene.attachChild(_AnimSprite);
  66.         xPos = _TiledSprite_TR.getTexturePositionX();
  67.         count = 1;
  68.         }
  69.         else{
  70.                 if (touchX < 400){
  71.                         AnimatedSprite _AnimSprite = new AnimatedSprite(70, 400, _TiledSprite_TR);
  72.                 _AnimSprite.registerEntityModifier(new MoveModifier(5, 70, Camera_width - _AnimSprite.getWidth(), 400, 400));
  73.                 _AnimSprite.animate(50);
  74.                 MainScene.attachChild(_AnimSprite);
  75.                 xPos = _TiledSprite_TR.getTexturePositionX();
  76.                 count = 1;            
  77.                 }              
  78.                 else{
  79.                         if((touch == 1) && (count==1)){
  80.                                 Sprite _Sprite = new Sprite(xPos, 400, _Sprite_TR);
  81.                         MainScene.attachChild(_Sprite);                                
  82.                         }
  83.                         else {
  84.                                 if(touch == 1){
  85.                                         Sprite _Sprite = new Sprite(70, 400, _Sprite_TR);
  86.                                         MainScene.attachChild(_Sprite);
  87.                                 }                  
  88.                         }                      
  89.                 }              
  90.         }
  91.         }
  92.         else {
  93.   Sprite _Sprite = new Sprite(70, 400, _Sprite_TR);
  94.         MainScene.attachChild(_Sprite);
  95.                         }              
  96.         return this.MainScene;        
  97.           }
  98.         @Override
  99.         public void onLoadComplete() {
  100.                 // TODO Auto-generated method stub            
  101.         }
  102.     }
  103.  
Parsed in 0.018 seconds, using GeSHi 1.0.8.4
izludec
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Mar 27, 2012 6:19 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 9 guests