public void surfaceCreated(SurfaceHolder holder) { renderThread = new DashTillPuffRenderThread(this); slicing1_x2 = getWidth(); slicing1_y2 = getHeight(); slicing2_x1 = slicing1_x2; slicing2_x2 = 2 * slicing2_x1; slicing2_y2 = slicing1_y2; spaceship_y1 = getHeight() / 2 - spaceship_size / 2; spaceship_y2 = spaceship_y1 + spaceship_size; // Create the sliding background , cosmic factory , and the space ship BitmapFactory.Options options = new BitmapFactory.Options(); background = BitmapFactory.decodeResource( this.getResources(), R.drawable.dashtillpuffwallpaper, options); spaceship = BitmapFactory.decodeResource( this.getResources(), R.drawable.dashtillpuffspaceship, options); blackhole = BitmapFactory.decodeResource( this.getResources(), R.drawable.dashtillpuffblackhole, options); blueplanet = BitmapFactory.decodeResource( this.getResources(), R.drawable.dashtillpuffblueplanet, options); cloud = BitmapFactory.decodeResource(this.getResources(), R.drawable.dashtillpuffcloud, options); earth = BitmapFactory.decodeResource(this.getResources(), R.drawable.dashtillpuffearth, options); glossyplanet = BitmapFactory.decodeResource( this.getResources(), R.drawable.dashtillpuffglossyplanet, options); goldenstar = BitmapFactory.decodeResource( this.getResources(), R.drawable.dashtillpuffgoldenstar, options); neutronstar = BitmapFactory.decodeResource( this.getResources(), R.drawable.dashtillpuffneutronstar, options); shinystar = BitmapFactory.decodeResource( this.getResources(), R.drawable.dashtillpuffshinystar, options); star1 = BitmapFactory.decodeResource(this.getResources(), R.drawable.dashtillpuffstar1, options); star2 = BitmapFactory.decodeResource(this.getResources(), R.drawable.dashtillpuffstar2, options); // putting the cosmic project in an array to easily randomly choose them cosmicArray = new Bitmap[10]; cosmicArray[0] = blackhole; cosmicArray[1] = blueplanet; cosmicArray[2] = cloud; cosmicArray[3] = earth; cosmicArray[4] = glossyplanet; cosmicArray[5] = goldenstar; cosmicArray[6] = neutronstar; cosmicArray[7] = shinystar; cosmicArray[8] = star1; cosmicArray[9] = star2; trajectory = new Trajectory(this); trajectory.setList(); cosmicfactory = new CosmicFactory(this, trajectory); cosmicfactory.setClusterList(); safe_distance = spaceship_size / 2 + cosmicfactory.cell_width / 2 - 5; renderThread.start(); }