Basic android Game Design Space Ship Game - part 5 (Enemy Ship)

package com.chitraksh.chigamebasicbuilding;

import java.util.Random;

import android.content.Context;

public class EnemyShip {
    private Bitmap bitmap;
    private int x, y;
    private int speed = 1;
    // Detect enemies leaving the screen
    private int maxX;
    private int minX;
    // Spawn enemies within screen bounds
    private int maxY;
    private int minY;
    public Bitmap getBitmap(){
        return bitmap;
    public int getX() {
        return x;
    public int getY() {
        return y;
    public EnemyShip(Context context, int screenX, int screenY){
        bitmap = BitmapFactory.decodeResource
                (context.getResources(), R.drawable.enemy);
        maxX = screenX;
        maxY = screenY;
        minX = 0;
        minY = bitmap.getHeight();
        Random generator = new Random();
        speed = generator.nextInt(6)+10;
        x = screenX;
        y = generator.nextInt(maxY);
        else if(y>=(maxY - bitmap.getHeight()))
            y=generator.nextInt(maxY) - bitmap.getHeight();
    public Rect getRectangle()
        Rect rect=new Rect(x, y, x+bitmap.getWidth(), y+bitmap.getHeight());
        return rect;
    public void update(int playerSpeed){
        // Move to the left
        x -= playerSpeed;
        x -= speed;
        //respawn when off screen
        if(x < minX-bitmap.getWidth()){
            Random generator = new Random();
            speed = generator.nextInt(10)+10;
            x = maxX;
            y = generator.nextInt(maxY) - bitmap.getHeight();

share on whatapp

Comments came to your Fusion Info Soft - Website and Mobile Application Development page and noticed you could have a lot more traffic. I have found that the key to running a website is making sure the visitors you are getting are interested in your subject matter. There is a company that you can get traffic from and they let you try it for free. I managed to get over 500 targeted visitors to day to my website. Check it out here:
Private Policy   Terms of Service   10066