Beispiel #1
0
        public FinalBoss(float x, float y, GameWorld gameWorld) : base(x, y, 110, 150, 0.1f, 370, gameWorld)
        {
            idleback    = CacheDataLoader.getInstance().getAnimation("boss_idle");
            idleforward = CacheDataLoader.getInstance().getAnimation("boss_idle");
            idleforward.flipAllImage();

            shootingback    = CacheDataLoader.getInstance().getAnimation("boss_shooting");
            shootingforward = CacheDataLoader.getInstance().getAnimation("boss_shooting");
            shootingforward.flipAllImage();

            slideback    = CacheDataLoader.getInstance().getAnimation("boss_slide");
            slideforward = CacheDataLoader.getInstance().getAnimation("boss_slide");
            slideforward.flipAllImage();

            setTimeForNoBehurt(500 * 1000000);
            setDamage(10);

            attackType[0] = "NONE";
            attackType[1] = "shooting";
            attackType[2] = "NONE";
            attackType[3] = "slide";

            timeAttack.Add("NONE", 2000);
            timeAttack.Add("shooting", 500);
            timeAttack.Add("slide", 5000);
        }
Beispiel #2
0
 public SmallRedGun(float x, float y, GameWorldState gameWorld) : base(x, y, 127, 89, 0, 30, gameWorld)
 {
     backAnim    = CacheDataLoader.getInstance().getAnimation("smallredgun");
     forwardAnim = CacheDataLoader.getInstance().getAnimation("smallredgun");
     forwardAnim.flipAllImage();
     startTimeToShoot = DateTime.Now;
     setTimeForNoBehurt(300);
 }
Beispiel #3
0
 public RedEyeDevil(float x, float y, GameWorld gameWorld) : base(x, y, 127, 89, 0, 100, gameWorld)
 {
     backAnim    = CacheDataLoader.getInstance().getAnimation("redeye");
     forwardAnim = CacheDataLoader.getInstance().getAnimation("redeye");
     forwardAnim.flipAllImage();
     startTimeToShoot = 0;
     setDamage(10);
     setTimeForNoBehurt(300000000);
     shooting = CacheDataLoader.getInstance().getSound("redeyeshooting");
 }
Beispiel #4
0
        public RocketBullet(float x, float y, GameWorld gameWorld) : base(x, y, 30, 30, 1.0f, 10, gameWorld)
        {
            backBulletAnimUp   = CacheDataLoader.getInstance().getAnimation("rocketUp");
            backBulletAnimDown = CacheDataLoader.getInstance().getAnimation("rocketDown");
            backBulletAnim     = CacheDataLoader.getInstance().getAnimation("rocket");

            forwardBulletAnimUp = CacheDataLoader.getInstance().getAnimation("rocketUp");
            forwardBulletAnimUp.flipAllImage();
            forwardBulletAnimDown = CacheDataLoader.getInstance().getAnimation("rocketDown");
            forwardBulletAnimDown.flipAllImage();
            forwardBulletAnim = CacheDataLoader.getInstance().getAnimation("rocket");
            forwardBulletAnim.flipAllImage();
        }
Beispiel #5
0
        //private AudioClip hurtingSound;
        //private AudioClip shooting1;

        public MegaMan(float x, float y, GameWorldState gameWorld) : base(x, y, 70, 90, 0.1f, 100, gameWorld)
        {
            //shooting1 = CacheDataLoader.getInstance().getSound("bluefireshooting");
            //hurtingSound = CacheDataLoader.getInstance().getSound("megamanhurt");

            setTeamType(TeamType.LEAGUE_TEAM);

            setTimeForNoBehurt(0);

            runForwardAnim = CacheDataLoader.getInstance().getAnimation("run");
            runBackAnim    = CacheDataLoader.getInstance().getAnimation("run");
            runBackAnim.flipAllImage();

            idleForwardAnim = CacheDataLoader.getInstance().getAnimation("idle");
            idleBackAnim    = CacheDataLoader.getInstance().getAnimation("idle");
            idleBackAnim.flipAllImage();

            dickForwardAnim = CacheDataLoader.getInstance().getAnimation("dick");
            dickBackAnim    = CacheDataLoader.getInstance().getAnimation("dick");
            dickBackAnim.flipAllImage();

            flyForwardAnim = CacheDataLoader.getInstance().getAnimation("flyingup");
            flyForwardAnim.setIsRepeated(false);
            flyBackAnim = CacheDataLoader.getInstance().getAnimation("flyingup");
            flyBackAnim.setIsRepeated(false);
            flyBackAnim.flipAllImage();

            landingForwardAnim = CacheDataLoader.getInstance().getAnimation("landing");
            landingBackAnim    = CacheDataLoader.getInstance().getAnimation("landing");
            landingBackAnim.flipAllImage();

            climWallBack    = CacheDataLoader.getInstance().getAnimation("clim_wall");
            climWallForward = CacheDataLoader.getInstance().getAnimation("clim_wall");
            climWallForward.flipAllImage();

            behurtForwardAnim = CacheDataLoader.getInstance().getAnimation("hurting");
            behurtBackAnim    = CacheDataLoader.getInstance().getAnimation("hurting");
            behurtBackAnim.flipAllImage();

            idleShootingForwardAnim = CacheDataLoader.getInstance().getAnimation("idleshoot");
            idleShootingBackAnim    = CacheDataLoader.getInstance().getAnimation("idleshoot");
            idleShootingBackAnim.flipAllImage();

            runShootingForwarAnim = CacheDataLoader.getInstance().getAnimation("runshoot");
            runShootingBackAnim   = CacheDataLoader.getInstance().getAnimation("runshoot");
            runShootingBackAnim.flipAllImage();

            flyShootingForwardAnim = CacheDataLoader.getInstance().getAnimation("flyingupshoot");
            flyShootingBackAnim    = CacheDataLoader.getInstance().getAnimation("flyingupshoot");
            flyShootingBackAnim.flipAllImage();
        }
Beispiel #6
0
        public DarkRaise(float x, float y, GameWorldState gameWorld) : base(x, y, 127, 89, 0, 30, gameWorld)
        {
            backAnim    = CacheDataLoader.getInstance().getAnimation("darkraise");
            forwardAnim = CacheDataLoader.getInstance().getAnimation("darkraise");
            forwardAnim.flipAllImage();
            startTimeToShoot = DateTime.Now;
            setTimeForNoBehurt(300000000);

            x1 = x - 100;
            x2 = x + 100;
            setSpeedX(1);

            setDamage(10);
        }
Beispiel #7
0
        public GameFrame()
        {
            InitializeComponent();
            this.Size          = new Size(SCREEN_WIDTH, SCREEN_HEIGHT);
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Text          = "Game Megaman";

            CacheDataLoader.getInstance().LoadData();

            gamePanel = new GamePanel();
            this.Controls.Add(gamePanel);
            gamePanel.Dock = DockStyle.Fill;

            this.KeyDown += GameFrame_KeyDown;
            this.KeyUp   += GameFrame_KeyUp;
        }
Beispiel #8
0
        public void draw(Graphics g)
        {
            Camera camera = getGameWorld().camera;

            for (int i = 0; i < map.GetLength(0); i++)
            {
                for (int j = 0; j < map.GetLength(1); j++)
                {
                    if (map[i, j] != 0 && j * tileSize - camera.getPosX() > -30 && j * tileSize - camera.getPosX() < GameFrame.SCREEN_WIDTH &&
                        i * tileSize - camera.getPosY() > -30 && i * tileSize - camera.getPosY() < GameFrame.SCREEN_HEIGHT)
                    {
                        g.DrawImage(CacheDataLoader.getInstance().getFrameImage("tiled" + map[i, j]).getImage(), (int)getPosX() + j * tileSize - (int)camera.getPosX(),
                                    (int)getPosY() + i * tileSize - (int)camera.getPosY());
                    }
                }
            }
        }
Beispiel #9
0
        public GameFrame() : base()
        {
            this.Size          = new Size(SCREEN_WIDTH, SCREEN_HEIGHT);
            this.StartPosition = FormStartPosition.CenterScreen;
            try
            {
                CacheDataLoader.getInstance().LoadData();
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message);
            }

            gamePanel      = new GamePanel();
            gamePanel.Dock = DockStyle.Fill;
            this.Controls.Add(gamePanel);
            gamePanel.Focus();
        }
Beispiel #10
0
        //private AudioClip shooting;

        public RobotR(float x, float y, GameWorldState gameWorld) : base(x, y, 127, 89, 0, 30, gameWorld)
        {
            backAnim    = CacheDataLoader.getInstance().getAnimation("robotR");
            forwardAnim = CacheDataLoader.getInstance().getAnimation("robotR");
            forwardAnim.flipAllImage();
            startTimeToShoot = DateTime.Now;
            setTimeForNoBehurt(300);
            setDamage(10);

            x1 = x - 100;
            x2 = x + 100;
            y1 = y - 50;
            y2 = y + 50;

            setSpeedX(1);
            setSpeedY(1);

            //shooting = CacheDataLoader.getInstance().getSound("robotRshooting");
        }
Beispiel #11
0
        public void draw(Graphics g2)
        {
            Camera     camera = getGameWorld().camera;
            SolidBrush brush  = new SolidBrush(Color.White);

            //g2.setColor(Color.RED);
            brush.Color = Color.Red;
            for (int i = 0; i < map.GetLength(0); i++)
            {
                for (int j = 0; j < map.GetLength(1); j++)
                {
                    if (map[i, j] != 0 && j * tileSize - camera.getPosX() > -30 && j * tileSize - camera.getPosX() < GameFrame.SCREEN_WIDTH &&
                        i * tileSize - camera.getPosY() > -30 && i * tileSize - camera.getPosY() < GameFrame.SCREEN_HEIGHT)
                    {
                        g2.DrawImage(CacheDataLoader.getInstance().getFrameImage("tiled" + map[i, j]).getImage(), (int)getPosX() + j * tileSize - (int)camera.getPosX(),
                                     (int)getPosY() + i * tileSize - (int)camera.getPosY());
                    }
                }
            }
        }
Beispiel #12
0
        public GameWorld(GamePanel gamePanel)
        {
            texts1[0] = "Tôi là Nguyễn Xuân Luân\nMSSV 18521066....";
            texts1[1] = "Ms.T đã đàn áp chúng ta hơn 10 năm qua\n"
                        + "và chúng ta đã phải học trong môi trường đáng sợ đó....";
            texts1[2]    = "Bây giờ là thời gian của chúng ta giành lại tự do!....";
            texts1[3]    = "      LET'S GO!.....";
            textTutorial = texts1[0];

            bufferedImage = new Bitmap(GameFrame.SCREEN_WIDTH, GameFrame.SCREEN_HEIGHT);
            megaman       = new Megaman(400, 400, this);
            megaman.setTeamType(ParticularObject.LEAGUE_TEAM);
            backgroundMap = new BackgroundMap(0, 0, this);
            physicalMap   = new PhysicalMap(0, 0, this);
            camera        = new Camera(0, 0, GameFrame.SCREEN_WIDTH, GameFrame.SCREEN_HEIGHT, this);
            bulletManager = new BulletManager(this);

            particularObjectManager = new ParticularObjectManager(this);
            particularObjectManager.addObject(megaman);

            initEnemies();

            bgMusic = CacheDataLoader.getInstance().getSound("bgmusic");
        }
Beispiel #13
0
        public override void Render(Graphics g2)
        {
            //Graphics g2 = Graphics.FromImage(bufferedImage);
            SolidBrush brush = new SolidBrush(Color.White);
            Font       font  = new Font("Verdana", 14);

            if (g2 != null)
            {
                // NOTE: two lines below make the error splash white screen....
                // need to remove this line
                ////g2.setColor(Color.WHITE);
                //g2.FillRectangle(brush,0, 0, GameFrame.SCREEN_WIDTH, GameFrame.SCREEN_HEIGHT);


                //physicalMap.draw(g2);

                switch (state)
                {
                case GameState.INIT_GAME:
                    brush.Color = Color.Black;
                    g2.FillRectangle(brush, 0, 0, GameFrame.SCREEN_WIDTH, GameFrame.SCREEN_HEIGHT);
                    brush.Color = Color.White;
                    g2.DrawString("PRESS ENTER TO CONTINUE", font, brush, 400, 300);
                    break;

                case GameState.PAUSEGAME:
                    brush.Color = Color.Black;
                    g2.FillRectangle(brush, 300, 260, 500, 70);
                    brush.Color = Color.White;
                    g2.DrawString("PRESS ENTER TO CONTINUE", font, brush, 400, 300);
                    break;

                case GameState.TUTORIAL:
                    backgroundMap.draw(g2);
                    if (tutorialState == TutorialState.MEETreadonlyBOSS)
                    {
                        particularObjectManager.draw(g2, gameTime);
                    }
                    TutorialRender(g2);

                    break;

                case GameState.GAMEWIN:
                case GameState.GAMEPLAY:
                    backgroundMap.draw(g2);
                    particularObjectManager.draw(g2, gameTime);
                    bulletManager.draw(g2, gameTime);

                    brush.Color = Color.Gray;
                    g2.FillRectangle(brush, 19, 59, 102, 22);
                    brush.Color = Color.Red;
                    g2.FillRectangle(brush, 20, 60, megaMan.getBlood(), 20);

                    for (int i = 0; i < numberOfLife; i++)
                    {
                        g2.DrawImage(CacheDataLoader.getInstance().getFrameImage("hearth").getImage(), 20 + i * 40, 18);
                    }


                    if (state == GameState.GAMEWIN)
                    {
                        g2.DrawImage(CacheDataLoader.getInstance().getFrameImage("gamewin").getImage(), 300, 300);
                    }

                    break;

                case GameState.GAMEOVER:
                    brush.Color = Color.Black;
                    g2.FillRectangle(brush, 0, 0, GameFrame.SCREEN_WIDTH, GameFrame.SCREEN_HEIGHT);
                    brush.Color = Color.White;
                    g2.DrawString("GAME OVER!", font, brush, 450, 300);
                    break;
                }
            }
        }
Beispiel #14
0
 public DarkRaiseBullet(float x, float y, GameWorldState gameWorld) : base(x, y, 30, 30, 1.0f, 10, gameWorld)
 {
     forwardBulletAnim = CacheDataLoader.getInstance().getAnimation("darkraisebullet");
     backBulletAnim    = CacheDataLoader.getInstance().getAnimation("darkraisebullet");
     backBulletAnim.flipAllImage();
 }
Beispiel #15
0
 public YellowFlowerBullet(float x, float y, GameWorldState gameWorld) : base(x, y, 30, 30, 1.0f, 10, gameWorld)
 {
     forwardBulletAnim = CacheDataLoader.getInstance().getAnimation("yellow_flower_bullet");
     backBulletAnim    = CacheDataLoader.getInstance().getAnimation("yellow_flower_bullet");
     backBulletAnim.flipAllImage();
 }
Beispiel #16
0
 public BlueFire(float x, float y, GameWorld gameWorld) : base(x, y, 60, 30, 1.0f, 10, gameWorld)
 {
     forwardBulletAnim = CacheDataLoader.getInstance().getAnimation("bluefire");
     backBulletAnim    = CacheDataLoader.getInstance().getAnimation("bluefire");
     backBulletAnim.flipAllImage();
 }
Beispiel #17
0
 public RobotRBullet(float x, float y, GameWorldState gameWorld) : base(x, y, 60, 30, 1.0f, 10, gameWorld)
 {
     forwardBulletAnim = CacheDataLoader.getInstance().getAnimation("robotRbullet");
     backBulletAnim    = CacheDataLoader.getInstance().getAnimation("robotRbullet");
     backBulletAnim.flipAllImage();
 }
Beispiel #18
0
        public void Render()
        {
            Graphics g = Graphics.FromImage(bufferedImage);

            if (g != null)
            {
                switch (state)
                {
                case INIT_GAME:
                    g.FillRectangle(Brushes.Black, 0, 0, GameFrame.SCREEN_WIDTH, GameFrame.SCREEN_HEIGHT);
                    g.DrawString("PRESS ENTER TO CONTINUE", new Font("Arial", 8), Brushes.White, 400, 290);
                    break;

                case PAUSEGAME:
                    g.FillRectangle(Brushes.Black, 300, 260, 400, 70);
                    g.DrawString("PRESS ENTER TO CONTINUE", new Font("Arial", 8), Brushes.White, 415, 290);
                    break;

                case TUTORIAL:
                    backgroundMap.draw(g);
                    if (tutorialState == MEETFINALBOSS)
                    {
                        particularObjectManager.draw(g);
                    }
                    TutorialRender(g);

                    break;

                case GAMEWIN:
                case GAMEPLAY:
                    backgroundMap.draw(g);
                    particularObjectManager.draw(g);
                    bulletManager.draw(g);

                    if (tutorialState == MEETFINALBOSS)
                    {
                        g.FillRectangle(Brushes.Gray, 599, 59, 372, 22);
                        g.FillRectangle(Brushes.Blue, 600, 60, boss.getBlood(), 20);
                    }

                    g.FillRectangle(Brushes.Gray, 19, 59, 102, 22);
                    g.FillRectangle(Brushes.Red, 20, 60, megaman.getBlood(), 20);

                    for (int i = 0; i < numberOfLife; i++)
                    {
                        g.DrawImage(CacheDataLoader.getInstance().getFrameImage("hearth").getImage(), 20 + i * 40, 18);
                    }


                    if (state == GAMEWIN)
                    {
                        g.DrawImage(CacheDataLoader.getInstance().getFrameImage("gamewin").getImage(), 300, 300);
                    }

                    break;

                case GAMEOVER:
                    g.FillRectangle(Brushes.Black, 0, 0, GameFrame.SCREEN_WIDTH, GameFrame.SCREEN_HEIGHT);
                    g.DrawString("GAME OVER!", new Font("Arial", 8), Brushes.White, 450, 300);
                    break;
                }
            }
        }
Beispiel #19
0
 public PhysicalMap(float x, float y, GameWorldState gameWorld) : base(x, y, gameWorld)
 {
     this.tileSize = 30;
     phys_map      = CacheDataLoader.getInstance().getPhysicalMap();
 }
Beispiel #20
0
 public BackgroundMap(float x, float y, GameWorldState gameWorld) : base(x, y, gameWorld)
 {
     map      = CacheDataLoader.getInstance().getBackgroundMap();
     tileSize = 30;
 }
Beispiel #21
0
 public RedEyeBullet(float x, float y, GameWorld gameWorld) : base(x, y, 30, 30, 1.0f, 10, gameWorld)
 {
     forwardBulletAnim = CacheDataLoader.getInstance().getAnimation("redeyebullet");
     backBulletAnim    = CacheDataLoader.getInstance().getAnimation("redeyebullet");
     backBulletAnim.flipAllImage();
 }