Note that there are some explanatory texts on larger screens.

plurals
  1. POBlack screen before starting this class in andengine
    primarykey
    data
    text
    <p>Before starting my game activity it shows me black screen... can anyone knows what is the reason?</p> <p>Below i mentioned my code:</p> <p>public class BaseSpriteBackgroundnow extends BaseGameActivity implements IAccelerometerListener, IOnSceneTouchListener, IOnMenuItemClickListener, IUpdateHandler, ITimerCallback {</p> <pre><code>// Layer Background private static final int LAYER_BACKGROUND = 0; private static final int LAYER_BOTTOM = LAYER_BACKGROUND + 1; private static final int LAYER_MIDDLE = LAYER_BOTTOM + 1; private static final int LAYER_TOP = LAYER_MIDDLE + 1; // MAX WIDTH &amp; HEIGHT of DEVICE public static final int INNER_BOX_WIDTH = 64; static final int OUTTER_BOX_WIDTH = (INNER_BOX_WIDTH * 1); public static final int CAMERA_WIDTH = INNER_BOX_WIDTH * 5; public static final int CAMERA_HEIGHT = INNER_BOX_WIDTH * 3; static final int CAMERA_WIDTH_OUTER = OUTTER_BOX_WIDTH * 5; static final int CAMERA_HEIGHT_OUTER = OUTTER_BOX_WIDTH * 3; /* * final int inner_maxX = (CAMERA_WIDTH - INNER_BOX_WIDTH) + * (INNER_BOX_WIDTH / 2); final int inner_maxY = (int) (INNER_BOX_WIDTH * * 2.5); final int inner_minX = INNER_BOX_WIDTH / 2; final int inner_minY = * INNER_BOX_WIDTH / 2; */ AccelerometerData pLocalAccelorometer; int gameTime; boolean levelcomplete; double angleCng = 0; int restoreSplashCounter = 0; // counter to remove the splashed image when // it reached 100 static float exactHalfX = PathArray.xDiff / 2; static float exactHalfY = PathArray.xDiff / 2; int counter = 0; int counterX = 0, counterY = 0; public int BUGS_COUNT = 0; public int HIT_COUNT = 0; private Font game_over_font, timeUpdateFont, scorePopUp_font, scoreBoard_Font; public static Scene scene; // private Camera mCamera; private SmoothCamera mCamera; private TextureRegion MbgImg; private long lastSensorUpdate = -1; public Sprite mPauseBtnSprite, mPlayBtnSprite; public Body body; public static int BALL_STATE = 0;// 0 - Ball at rest 1- Ball is Active public ArrayList&lt;AnimatedSprite&gt; bugsArray; Boolean modifierfinished = false; private Texture bgTexture, antTexture, beetleTexture, flyTexture, beeTexture, spiderTexture, ballTexture, game_over_font_texture, scorePopUp_font_texture, scoreBoard_Font_texture, time_font_texture, pause_btn_texture, play_btn_texture, splash_texture, blood_splash_texture, menu_star_anim_texture1,menu_star_anim_texture2,menu_star_anim_texture3; public TextureRegion pause_btn_texure_region, play_btn_texture_region; public static AnimatedSprite spiderAnimatedSprite, bugs_splashSprite; private static AnimatedSprite ball_splashSprite; private AnimatedSprite antAnimatedSprite, beetleAnimatedSprite; static AnimatedSprite hitBallAnimateSprite; private AnimatedSprite beeAnimatedSprite, flysAnimatedSprite; TiledTextureRegion antTextureRegion, beetleTextureRegion, flyTextureRegion, beeTextureRegion, SpiderTextureRegion, spider_splash_texture_region, blood_splashTextureRegion; private static TiledTextureRegion hitBallTextureRegion; public static double currentX = 0, currentY = 0, currentZ = -12; private int isFirstmove = 0; private double lastZ = 0.0; static Path Ballpath; public int Starscore = 0; // private static final FixtureDef FIXTURE_DEF = // PhysicsFactory.createFixtureDef(0, 0, 0); private static Sound BallHitSound, smashSound[]; private static Music BallMissHitSound; public static boolean removeBool = false; public static Options options; // pauseMenu Variables // protected MenuScene levelMenu, restartMenu; protected CustomMenuScene levelmenu, mMenuScene; public Text textCenter; private Texture mMenuTexture, levelMenuTexture; protected TextureRegion mMenuResumeTextureRegion; protected TextureRegion mMenuHomeTextureRegion; protected TextureRegion mMenuResetTextureRegion; protected TextureRegion levelMenuRestartTextureRegion; protected TextureRegion levelMenuCancelTextureRegion; protected TextureRegion levelMenuNextTextureRegion; protected final int MENU_RESUME = 0; protected final int MENU_QUIT = MENU_RESUME + 1; protected final int MENU_RESET = MENU_QUIT + 1; protected final int MENU_PLAYAGAIN = MENU_RESET + 1; protected final int MENU_NEXT_LEVEL = MENU_PLAYAGAIN + 1; protected final int MENU_CANCEL = MENU_NEXT_LEVEL + 1; protected final int MENU_STAR_ANIMATION = MENU_CANCEL + 1; public int STAR_COUNT = 0; SharedPreferences myPrefs; SharedPreferences.Editor prefsEditor; private static ScoreBoard hud; Texture scoreboard_background_texture; TextureRegion ScoreBoardTextureRegion; Sprite scoreBoardBGSprite; TextureRegion PauseBackgroundRegion, menuStarTextureRegion,menuStarTextureRegion2,menuStarTextureRegion3; Sprite pauseBGSprite; Texture ScorePopup_texture; TextureRegion ScorePopUpBackgroundRegion; static Sprite ScoreBGSprite; public Sprite Star2ani; public Sprite Star3ani; public Sprite starAnimatedSprite; public SpriteMenuItem nextMenuItem; public SpriteMenuItem restartMenuItem; public SpriteMenuItem cancelMenuItem; public SpriteMenuItem reseumemenudummy; Texture menu_bg_texture; TextureRegion MenuBGTextureRegion; Sprite menuBGSprite; public TimerHandler timeHandler; public PauseGame pauseObject; int releaseTimeIntevel = 0; GamePauseMenu gmPause; // Score Calculation variables static int numberofHits = 0; static int textureSum = 0; static int timeleftBonus = 0; static int levelScore = 0; SpriteBackground gmImg, gmImg1; ArrayList&lt;BaseSprite&gt; bgStack; // Camcorder Try private CamcorderView cv; public Engine onLoadEngine() { // this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT); this.mCamera = new SmoothCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT, 10, 10, 1.0f); Log.d("dd", "onloadEng"); myPrefs = this.getSharedPreferences("SPLATPREFF", MODE_WORLD_READABLE); prefsEditor = myPrefs.edit(); options = new Options(BaseSpriteBackgroundnow.this); return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera).setNeedsSound(true).setNeedsMusic(true)); } public void onLoadResources() { bgStack = new ArrayList&lt;BaseSprite&gt;(); for (int i = 1; i &lt;= 6; i++) { this.bgTexture = new Texture(1024, 512, TextureOptions.DEFAULT); bgStack.add(new BaseSprite(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT_OUTER, TextureRegionFactory.createFromAsset(bgTexture, this, "bg/bg/bgLevel" + i + ".jpg", 0, 0)) { }); this.mEngine.getTextureManager().loadTexture(this.bgTexture); } pLocalAccelorometer = new AccelerometerData(); releaseTimeIntevel = myPrefs.getInt("release", 0); Log.d("dd", "onLoad Resource"); TextureRegionFactory.setAssetBasePath("bg/"); pause_btn_texture = new Texture(32, 32, TextureOptions.BILINEAR); pause_btn_texure_region = TextureRegionFactory.createFromAsset( pause_btn_texture, this, "pause_btn.png", 0, 0); play_btn_texture = new Texture(32, 32, TextureOptions.BILINEAR); play_btn_texture_region = TextureRegionFactory.createFromAsset( play_btn_texture, this, "play_btn.png", 0, 0); scoreboard_background_texture = new Texture(256, 128, TextureOptions.BILINEAR); ScoreBoardTextureRegion = TextureRegionFactory.createFromAsset( scoreboard_background_texture, this, "splash_left.png", 0, 0); PauseBackgroundRegion = TextureRegionFactory.createFromAsset( scoreboard_background_texture, this, "splash_right.png", 64, 0); ScorePopup_texture = new Texture(256, 128, TextureOptions.BILINEAR); menu_bg_texture = new Texture(1024, 1024, TextureOptions.BILINEAR); MenuBGTextureRegion = TextureRegionFactory.createFromAsset( menu_bg_texture, this, "menu_bg.png", 0, 0); FontFactory.setAssetBasePath("fonts/"); game_over_font_texture = new Texture(256, 256, TextureOptions.BILINEAR); game_over_font = FontFactory.createFromAsset(game_over_font_texture, this, "bugsfont.ttf", 20, true, Color.WHITE); time_font_texture = new Texture(128, 128, TextureOptions.BILINEAR); timeUpdateFont = FontFactory.createFromAsset(time_font_texture, this, "AllerDisplay.ttf", 18, true, Color.WHITE); scorePopUp_font_texture = new Texture(128, 128, TextureOptions.BILINEAR); scorePopUp_font = FontFactory.createFromAsset(scorePopUp_font_texture, this, "AllerDisplay.ttf", 16, true, Color.GREEN); scoreBoard_Font_texture = new Texture(128, 128, TextureOptions.BILINEAR); scoreBoard_Font = FontFactory.createFromAsset( scoreboard_background_texture, this, "AllerDisplay.ttf", 18, true, Color.WHITE); // Bugs Texture this.antTexture = new Texture(512, 128, TextureOptions.BILINEAR_PREMULTIPLYALPHA); antTextureRegion = TextureRegionFactory.createTiledFromAsset( this.antTexture, this, "bugs/ant_final.png", 0, 48, 6, 1); this.beetleTexture = new Texture(512, 128, TextureOptions.BILINEAR_PREMULTIPLYALPHA); beetleTextureRegion = TextureRegionFactory.createTiledFromAsset( this.beetleTexture, this, "bugs/beetle_final.png", 0, 48, 6, 1); this.beeTexture = new Texture(512, 128, TextureOptions.BILINEAR_PREMULTIPLYALPHA); this.beeTextureRegion = TextureRegionFactory.createTiledFromAsset( this.beeTexture, this, "bugs/bee_final.png", 0, 48, 6, 1); this.flyTexture = new Texture(512, 128, TextureOptions.BILINEAR_PREMULTIPLYALPHA); this.flyTextureRegion = TextureRegionFactory.createTiledFromAsset( this.flyTexture, this, "bugs/fly_final.png", 0, 48, 6, 1); this.spiderTexture = new Texture(512, 128, TextureOptions.BILINEAR_PREMULTIPLYALPHA); this.SpiderTextureRegion = TextureRegionFactory.createTiledFromAsset( this.spiderTexture, this, "bugs/spider_final.png", 0, 48, 6, 1); this.ballTexture = new Texture(512, 512, TextureOptions.BILINEAR_PREMULTIPLYALPHA); BaseSpriteBackgroundnow.hitBallTextureRegion = TextureRegionFactory .createTiledFromAsset(this.ballTexture, this, "ball_final.png", 0, 32, 3, 8); splash_texture = new Texture(256, 256, TextureOptions.BILINEAR); spider_splash_texture_region = TextureRegionFactory .createTiledFromAsset(this.splash_texture, this, "splat_images.png", 0, 32, 6, 4); blood_splash_texture = new Texture(128, 64, TextureOptions.BILINEAR); blood_splashTextureRegion = TextureRegionFactory.createTiledFromAsset( this.blood_splash_texture, this, "splash_sprite_final.png", 0, 32, 4, 1); try { SoundFactory.setAssetBasePath("sounds/"); BallHitSound = SoundFactory.createSoundFromAsset( this.mEngine.getSoundManager(), BaseSpriteBackgroundnow.this, "fire.ogg"); smashSound = new Sound[7]; for (int i = 1; i &lt;= 6; i++) smashSound[i] = SoundFactory.createSoundFromAsset( this.getSoundManager(), this, "BugSplatSound" + i + ".ogg"); MusicFactory.setAssetBasePath("sounds/"); BallMissHitSound = MusicFactory.createMusicFromAsset( this.getMusicManager(), this, "hit_miss.ogg"); } catch (final IOException e) { Debug.e(e); } // Pause Menu textures this.mMenuTexture = new Texture(512, 512, TextureOptions.BILINEAR_PREMULTIPLYALPHA); this.mMenuResumeTextureRegion = TextureRegionFactory.createFromAsset( this.mMenuTexture, this, "menu_resume_b.png", 0, 0); this.mMenuHomeTextureRegion = TextureRegionFactory.createFromAsset( this.mMenuTexture, this, "menu_home_a.png", 0, 100); this.mMenuResetTextureRegion = TextureRegionFactory.createFromAsset( this.mMenuTexture, this, "menu_reset_b.png", 0, 200); this.mEngine.getTextureManager().loadTexture(this.mMenuTexture); // Level Complete menu levelMenuTexture = new Texture(512, 512, TextureOptions.BILINEAR_PREMULTIPLYALPHA); levelMenuRestartTextureRegion = TextureRegionFactory.createFromAsset( levelMenuTexture, this, "menu_replay_c.png", 0, 0); levelMenuCancelTextureRegion = TextureRegionFactory.createFromAsset( levelMenuTexture, this, "menu_home_a.png", 0, 100); levelMenuNextTextureRegion = TextureRegionFactory.createFromAsset( levelMenuTexture, this, "menu_nextlevel_c.png", 0, 200); menu_star_anim_texture1 = new Texture(256,256, TextureOptions.BILINEAR_PREMULTIPLYALPHA); this.menuStarTextureRegion = TextureRegionFactory.createFromAsset( this.menu_star_anim_texture1, this, "star_1.png", 32, 0); menu_star_anim_texture2 = new Texture(256,256, TextureOptions.BILINEAR_PREMULTIPLYALPHA); this.menuStarTextureRegion2 = TextureRegionFactory.createFromAsset( this.menu_star_anim_texture2, this, "star_1.png", 32, 0); menu_star_anim_texture3 = new Texture(256,256, TextureOptions.BILINEAR_PREMULTIPLYALPHA); this.menuStarTextureRegion3 = TextureRegionFactory.createFromAsset( this.menu_star_anim_texture3, this, "star_1.png", 32, 0); this.mEngine.getTextureManager().loadTexture( this.menu_star_anim_texture1); this.mEngine.getTextureManager().loadTexture( this.menu_star_anim_texture2); this.mEngine.getTextureManager().loadTexture( this.menu_star_anim_texture3); this.mEngine.getTextureManager().loadTexture(this.levelMenuTexture); this.mEngine.getTextureManager().loadTextures(this.splash_texture, this.antTexture, this.beeTexture, this.beetleTexture, this.flyTexture, spiderTexture, this.ballTexture, game_over_font_texture, scorePopUp_font_texture, scoreBoard_Font_texture, time_font_texture, pause_btn_texture, play_btn_texture, ScorePopup_texture, blood_splash_texture, scoreboard_background_texture, menu_bg_texture); this.mEngine.getFontManager().loadFont(timeUpdateFont); this.mEngine.getFontManager().loadFont(game_over_font); this.mEngine.getFontManager().loadFont(scorePopUp_font); this.mEngine.getFontManager().loadFont(scoreBoard_Font); // this.enableAccelerometerSensor(this); } </code></pre> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload