Site Loader
Rock Street, San Francisco

AN INTRODUCTION     This Greenfoot file is an inspired Mario 8-bit Game, the game I used to play when I was Child. It consists of a Maze World with Sand Blocks, a Golden-Ball, Sand Stone and some Black Holes.  The Golden-Ball only moves on the Sand It doesn’t go on the background screen and as it reaches the SandStone, the ball won’t move cause that the end of the game.As It is inspired by The Mario Game, it has its background almost as same as the sky in the Mario game and all the sound effects in the game are taken from that game.In this game, One has to use Keyboard keys to make the ball move and make it reach the winning place which is the Sand Stone.  About Greenfoot:  This is a software available on the Internet for free where usually students go and use it for learning the basic java so that they can use it and make basic 2-D games.It is a product of Oracle Company and It is available for all Windows, Linux, and MacOS.   EVIDENCE OF WORKING IN A GROUP    It took our group almost 3 weeks to complete this Project.I  tried to change the Golden-ball picture to Mario Picture and the Sand Stone Picture to the Princess Picture from the game Mario and I was quite successful until Manish (One of the Group member) noticed that the rules for this assignment aren’t allowing us to the layout of this project.When I decided to put the Original Golden-Ball back, the game started facing a problem that was the game gets over without going to the Blackhole.It was because of the pixels of the black hole, so we had to adjust the pixels online through a website (picresize.com) and finally after an hour we made it possible It was so fun programming a game in real life and doing it with friends who have the same interest in the game as I do was exciting. When we started to programming the game, It didn’t work how we thought cause whenever we want to make the ball move left it moved opposite, same for the up-down-side.   I exactly don’t have any disadvantage except for choosing the after-game message as some member want’s it to be “Congrats!” and some wanted it to be “THE END”.But I’ve got a dozen of Advantages as I saw some really creative ideas at a moment.Everyone wanted something special and that gave me so much inspiration towards working in a group. Second Advantages would be that If we get bored with a class i.e. Golden-Ball, Sand, etc. We could easily change the class and work in other class without getting bored.Lastly, I noticed that if someone works in group and gets disappointed after a heavy work with no results, group head or other member is always there to cheer you up.        INTRODUCTION     The task in this project is the move the Golden-Ball without hitting the black hole and make the ball reach the end i.e. to place it in the SandStone.To Start this game first we have to click on the RUN-Button.Then we have to use the UP, right, left and down-key from the keyboard buttons to make the ball move.The ball doesn’t go the background screen. If you reach the Blackhole you’ll lose the game and you’ll receive a message “You Lose! Try again” And If you reach the SandStone you’ll win the game and you’ll receive a message “The End!”.    ANALYSIS AND DESIGN    The Design is same as what was required by the College Lecturer.There are some special features which are the background music, movement sound, and the background image.A character is also added which is the BlackHole which makes the whole project more interesting.     FINAL CODE(INCLUDES ONLY CHANGED CLASSES)  GAMEWORLD import greenfoot.*; public class GameWorld extends World {     GreenfootSound backgroundMusic = new GreenfootSound(“bg.mp3”);     public void started() {     backgroundMusic.playLoop(); }     public GameWorld()     {          super (1000, 850, 1);          for (int loop=40;loop<960;loop=loop+60)         {             addObject(new Sand(), loop,50);             addObject(new Sand(), loop,230);             addObject(new Sand(), loop,410);             addObject(new Sand(), loop,590);             addObject(new Sand(), loop,770);                      }         for (int loop_2=0;loop_2<=1;loop_2=loop_2+1)             {                 addObject(new Sand(), 100,110+(loop_2*60));                 addObject(new Sand(), 340,110+(loop_2*60));                 addObject(new Sand(), 580,110+(loop_2*60));                 addObject(new Sand(), 160,290+(loop_2*60));                 addObject(new Sand(), 400,290+(loop_2*60));                 addObject(new Sand(), 700,290+(loop_2*60));                 addObject(new Sand(), 100,470+(loop_2*60));                 addObject(new Sand(), 340,470+(loop_2*60));                 addObject(new Sand(), 760,470+(loop_2*60));                 addObject(new Sand(), 160,650+(loop_2*60));                 addObject(new Sand(), 400,650+(loop_2*60));             }            addObject(new WIN(), 40,770);            addObject(new GoldenBall(),940 ,50);            addObject(new END(),460 ,50);            addObject(new END(),220 ,230);            addObject(new END(),520 ,230);            addObject(new END(),580 ,410);            addObject(new END(),280 ,410);            addObject(new END(),220 ,590);            addObject(new END(),340 ,770);     }      public void stopped() {      backgroundMusic.pause(); } } GOLDENBALL import greenfoot.*;  public class GoldenBall extends Actor {     public void act()      {                  Greenfoot.setSpeed(30);         key();         win();         lose();     }         public boolean canMove(int x, int y)     {                  Actor sand;         sand=getOneObjectAtOffset(x,y,Sand.class);         boolean flag=false;         if (sand !=null)         {             flag=true;         }         return flag;     }     public void key()     {        int leftChange=(-60);         int rightChange=60;         int upChange=(-60);         int downChange=60;          if (Greenfoot.isKeyDown("left"))         {             if (canMove(leftChange, 0)==true){                 Greenfoot.playSound("move.mp3");             setLocation(getX()+leftChange, getY()) ;}             else             Greenfoot.playSound("down.mp3");         }         if (Greenfoot.isKeyDown("right"))         {            if (canMove(rightChange, 0)==true){                Greenfoot.playSound("move.mp3");             setLocation(getX()+rightChange, getY()) ;}             else             Greenfoot.playSound("down.mp3");         }         if (Greenfoot.isKeyDown("up"))         {             if (canMove(0, upChange)==true){                 Greenfoot.playSound("move.mp3");             setLocation(getX(), getY()+upChange) ;}             else             Greenfoot.playSound("down.mp3");         }         if (Greenfoot.isKeyDown("down"))         {             if (canMove(0, downChange)==true){                 Greenfoot.playSound("move.mp3");             setLocation(getX(), getY()+downChange) ;}             else             Greenfoot.playSound("down.mp3");         }     }     public void win()     {         Actor win;         win=getOneObjectAtOffset(0,0,WIN.class);         if (win !=null)         {             World myWorld = getWorld();             congrats congrats = new congrats();             myWorld.addObject(congrats, myWorld.getWidth()/2, myWorld.getHeight()/2);             Greenfoot.playSound("win.mp3");             Greenfoot.stop();         }     }            public void lose()     {         Actor lose;         lose=getOneIntersectingObject(END.class);         if (lose !=null)         {             World myWorld = getWorld();             sorry sorry = new sorry();             myWorld.addObject(sorry, myWorld.getWidth()/2, myWorld.getHeight()/2);             getWorld().removeObject( lose );             Greenfoot.playSound("lose.mp3");             Greenfoot.stop();         }     } } SORRY import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)   /** * Write a description of class LOSE_MES here. *  * @author (your name)  * @version (a version number or a date) */ public class sorry extends Actor {     /**      * Act - do whatever the LOSE_MES wants to do. This method is called whenever      * the 'Act' or 'Run' button gets pressed in the environment.      */     public sorry()      {         setImage(new GreenfootImage("You Lose", 100, Color.GREEN , Color.WHITE)); // Add your action code here.     }     } END import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)   /** * Write a description of class Gomba here. *  * @author (your name)  * @version (a version number or a date) */ public class END extends Actor {     /**      * Act - do whatever the Gomba wants to do. This method is called whenever      * the 'Act' or 'Run' button gets pressed in the environment.      */     public void act()      {        Actor a =this.getOneIntersectingObject(GoldenBall.class);        if (a != null)        {            this.getWorld().removeObject( a );            Greenfoot.playSound("lose.mp3");         }             }     } CONGRATS import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)   /** * Write a description of class WIN_MES here. *  * @author (your name)  * @version (a version number or a date) */ public class congrats extends Actor {     /**      * Act - do whatever the WIN_MES wants to do. This method is called whenever      * the 'Act' or 'Run' button gets pressed in the environment.      */     public congrats()     {         setImage(new GreenfootImage("The End!", 100, Color.GREEN , Color.WHITE)); // Add your action code here.     }     }       TESTING     There is no particular video that I have as my testing report but I do have the images how it used to look before and after I completed my project(Different Pixel sizes).    OLD PICTURE WITH LARGE PIXELS   FINAL PICTURE WITH CORRECT PIXELS CONCLUSION    Q1-What did you find out? You could include any conclusions you drew about group work here as well.    A1- I used to think that java coding would never allow me to make an interesting game.I have made a game some years ago; Number Game. It was an interesting game but only for a person who is a programmer because he could know how the algorithms  I've included in that game but for a normal person, it wouldn't be that interesting. So this project changed my way of learning and observing java language.    Q2-What are the Strengths and Weakness of your solution?    A2- The Strengths would be the sound effect and the after game messages which let you know about if you win or not.For Weakness, I would say if you click on RUN-Button after winning or losing the game, the music will start playing again which is quite Irritating after an amount of time.    Q3-What changes could be made if you were starting again? How would you improve your solution?    A3-If I could get some more time,  I would add the win and lose message when the whole screen becomes Blank and I really wanted to change the character because after changing the Graphical Interface the game looks more Interesting.  

Post Author: admin

x

Hi!
I'm Eunice!

Would you like to get a custom essay? How about receiving a customized one?

Check it out