Home How to create a method for AnimatedSprite to run above the ITiledMap
Reply: 0

How to create a method for AnimatedSprite to run above the ITiledMap

Noviwidi
1#
Noviwidi Published in 2017-11-14 22:06:54Z

I want to create an AnimatedSprite that moved by DigitanOnScreenControl on TMX Map. But there's trouble, the AnimatedSprite still can go over the obstacles I made. So, How do I create a method for AnimatedSprite to run above the ITiledMap ?

This is the AnimatedSprite :

musuh = new AnimatedSprite(90, 90, this.mMusuhTextureRegion);

And here is DigitalOnSceenControl :

public void onControlChange(final BaseOnScreenControl pBaseOnScreenControl, 
                final float pValueX, final float pValueY) {
                    physicsHandler2.setVelocity(pValueX * 100, pValueY * 100);
                    // Set the correct walking animation
                 if (pValueY == 1){
                     // Up
                     if (playerDirection != PlayerDirection.UP){
                             musuh.animate(ANIMATE_DURATION, 0, 2, false);
                             playerDirection = PlayerDirection.UP;
                     }
             }else if (pValueY == -1){
                     // Down
                     if (playerDirection != PlayerDirection.DOWN){
                             musuh.animate(ANIMATE_DURATION, 9, 11, false);
                             playerDirection = PlayerDirection.DOWN;
                     }
             }else if (pValueX == -1){
                     // Left
                     if (playerDirection != PlayerDirection.LEFT){
                             musuh.animate(ANIMATE_DURATION, 3, 5, false);
                             playerDirection = PlayerDirection.LEFT;
                     }
             }else if (pValueX == 1){
                     // Right
                     if (playerDirection != PlayerDirection.RIGHT){
                             musuh.animate(ANIMATE_DURATION, 6, 8, false);
                             playerDirection = PlayerDirection.RIGHT;
                     }
             }else{
                     if (musuh.isAnimationRunning()){
                             musuh.stopAnimation();
                             playerDirection = PlayerDirection.NONE;
                     }
             }
            }
        });

I need a method for AnimatedSprite to run above the ITiledMap (the code plz). Help. Thanks ^^

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.298454 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO