简体   繁体   中英

How to load spritesheet from SD card in AndEngine

I am new to AndEngine. I'm trying to play an animation by using the spritesheet(generated using TexturePacker) and I successfully animated by referring this question ( Load Animation with Texture Packer in andengine )

Q 1. How to load spritesheet and xml files from the SD card. (In above example spritesheet and xml files are loading from the Asset folder).

Q 2. I want to add sound to the animation. Is there is a way to do it?

Havent tried this but you have the ability to set the base path for your assets using BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/"); Try changing from gfx to the path on your SD card.

Yes, you can add sounds

Drop your sound files (ogg) into res\\raw folder and use the following code

MediaPlayer mp = MediaPlayer.create(getApplicationContext(), soundType);
mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
mp.start();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM