From eceea2691c261c1201d925dfa41fd9878db1e4b5 Mon Sep 17 00:00:00 2001 From: Tasdik Rahman Date: Mon, 18 Jan 2016 18:56:10 +0530 Subject: [PATCH] added controls in README and instructions on building the executable --- BUILDING_EXECUTABLE.rst | 34 +++++++++++++++++++++++ CONTRIBUTING.rst | 4 ++- LICENSE.txt | 8 +++++- README.md | 60 ++++++++++++++++++++++++++++++----------- spaceShooter.py | 4 +-- 5 files changed, 91 insertions(+), 19 deletions(-) create mode 100644 BUILDING_EXECUTABLE.rst diff --git a/BUILDING_EXECUTABLE.rst b/BUILDING_EXECUTABLE.rst new file mode 100644 index 0000000..ff04620 --- /dev/null +++ b/BUILDING_EXECUTABLE.rst @@ -0,0 +1,34 @@ +Creating the Executable +======================= + +For ``Debain/Ubuntu`` based systems +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1. I used `pyinstaller `__ to create the executable. + +After installing it and adding the changes. Inside the ``spaceShooter`` directory, simply run the command + +.. code:: bash + + $ pyinstaller --onefile --windowed spaceShooter.py + +This will create an executable and place it inside the directory ``dist`` + +2. Place the folders ``assets`` and ``sounds`` together with the excutable inside a single folder and zip it. + +For ``Windows`` based systems +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1. `cx_freeze `__ was used to create the excutable for Windows based systems + +2. Use the `setup.py `__ file for building the executable. + +3. Go to the directory ``spaceShooter`` and then run the command + +.. code:: python + + $ python setup.py build + +This will create a new folder inside ``spaceShooter``. + +4. Rename it and zip that file diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 81e4c18..3515d76 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -5,6 +5,8 @@ Contributing 2. Clone it +Make sure you have installed `pygame `__ installed on your system + create a `virtualenv `__ .. code:: bash @@ -34,4 +36,4 @@ Conform to `PEP8 `__ and if everythin 6. Create new Pull Request -Hack away! +Hack away! \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt index d83f703..c09e13a 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -5,4 +5,10 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +The images used in the game are taken from [http://opengameart.org/](http://opengameart.org/), more particulary from the [Space shooter content pack](http://opengameart.org/content/space-shooter-redux) from [@kenney](http://opengameart.org/users/kenney). + +License for them is in `Public Domain` + +The game sounds were again taken from [http://opengameart.org/](http://opengameart.org/). The game music, [Frozen Jam](http://opengameart.org/content/frozen-jam-seamless-loop) by [tgfcoder](https://twitter.com/tgfcoder) licensed under [CC-BY-3](http://creativecommons.org/licenses/by/3.0/) diff --git a/README.md b/README.md index ca08f99..1588082 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ The classic retro game recreated using `Pygame` and `python`. ## Demo +Follow the youtube video to see how I fared on ``spaceShooter`` + [![Space Shooter Demo - Youtube](http://i.imgur.com/bHjlJfG.jpg)](https://www.youtube.com/watch?v=o99zpLsM-ZI) ## Screenshots @@ -25,25 +27,54 @@ The classic retro game recreated using `Pygame` and `python`. - 3 lives per game - Fun to play :) +## Controls + +- To move the spaceship + - To left : left + - to right : right +- To fire the bullets : spacebar + ## Installation ### For `Windows` -- Download the prebuilt `zip file` [from here](https://github.com/prodicus/spaceShooter/releases/download/v0.0.1/spaceShooter-0.0.1-windows.zip) -- Unzip it and run the executable named `spaceShooter` +- Download the prebuilt `zip file` [from here](https://github.com/prodicus/spaceShooter/releases/download/v0.0.1/spaceShooter-0.0.1-windows.zip) and extract the file to your preferred destination by using [7-zip](http://www.7-zip.org/download.html) or [winzip](http://www.winzip.com/prod_down.html) or any other similar program of your choice. +- Run the executable named `spaceShooter` inside the extracted file. ### For `MAC OS X` and `Linux/Debian` based systems -#### Option 1: Download the Executable file +#### Option 1: Download the zipped executable file - Download the [latest zip file](https://github.com/prodicus/spaceShooter/releases/download/v0.0.1/SpaceShooter-0.0.1.Linux.zip) +- Unzip the file + +If your download was saved on the `~/Downloads` folder + +Press Ctrl + Alt + T to open the shell if you are on `GNU/Linux` based systems and type + +```bash +$ unzip SpaceShooter-0.0.1.Linux.zip -d ~/Desktop +$ cd ~/Desktop +~/Desktop $ chmod +x spaceShooter +~/Desktop $ ./spaceShooter +``` + +This will unzip the file on your `Desktop`, you can replace it with the directory of your choice + +**NOTE** : If it gives you an error, you probably don't have `unzip` installed in your system. + +```bash +$ sudo apt-get install unzip +``` +That should fix the error. + - Run the executable named `spaceShooter` -**NOTE** : Make `spaceShooter` executable by doing a `chmod +x spaceShooter` +A Similar process would be followed for `OS X` #### Option 2: Build from source -You need to have `pygame` installed for this option +You need to have `pygame` installed for this option. ##### Ubuntu/Debian @@ -72,23 +103,24 @@ $ cd spaceShooter/ $ python spaceShooter.py ``` -This game was written in one day, so the coding standards might not be up the mark. - -Enjoy the game :smile: +Enjoy the game! ## To-do: - [x] Add the windows executable file - [ ] Add main menu for the game -- [ ] Fix bug which stops the background music from looping +- [ ] Fix [bug](https://github.com/prodicus/spaceShooter/blob/master/spaceShooter.py#L372) which stops the background music from looping +- [ ] add feature to replay the game after all players die ## Contributing -Please refer [Contributing page for details](https://github.com/prodicus/spaceShooter/blob/master/CONTRIBUTING.rst) +This game was written in one day, so the coding standards might not be up the mark. Don't be shy to make a Pull request :) + +For details, please refer [the Contributing page](https://github.com/prodicus/spaceShooter/blob/master/CONTRIBUTING.rst) ## Issues -Please report the bugs at the [issue tracker](https://github.com/prodicus/spaceShooter/issues) +You can report the bugs at the [issue tracker](https://github.com/prodicus/spaceShooter/issues) ## License @@ -96,10 +128,8 @@ Please report the bugs at the [issue tracker](https://github.com/prodicus/spaceS You can find a copy of the License at http://prodicus.mit-license.org/ -The images used in the game are taken from [http://opengameart.org/](http://opengameart.org/), more particulary from the [Space shooter content pack](http://opengameart.org/content/space-shooter-redux) from [@kenney](http://opengameart.org/users/kenney). +- The images used in the game are taken from [http://opengameart.org/](http://opengameart.org/), more particulary from the [Space shooter content pack](http://opengameart.org/content/space-shooter-redux) from [@kenney](http://opengameart.org/users/kenney). License for them is in `Public Domain` -The game sounds were again taken from [http://opengameart.org/](http://opengameart.org/) - -- The game music, [Frozen Jam](http://opengameart.org/content/frozen-jam-seamless-loop) by [tgfcoder](https://twitter.com/tgfcoder) licensed under [CC-BY-3](http://creativecommons.org/licenses/by/3.0/) +- The game sounds were again taken from [http://opengameart.org/](http://opengameart.org/). The game music, [Frozen Jam](http://opengameart.org/content/frozen-jam-seamless-loop) by [tgfcoder](https://twitter.com/tgfcoder) licensed under [CC-BY-3](http://creativecommons.org/licenses/by/3.0/) diff --git a/spaceShooter.py b/spaceShooter.py index c6a0724..2699d11 100644 --- a/spaceShooter.py +++ b/spaceShooter.py @@ -4,7 +4,7 @@ # @Date: 2016-01-17 # @Email: prodicus@outlook.com Github username: @prodicus # @Last Modified by: tasdik -# @Last Modified time: 2016-01-17 +# @Last Modified time: 2016-01-18 # MIT License. You can find a copy of the License @ http://prodicus.mit-license.org ## Game music Attribution @@ -200,7 +200,7 @@ def __init__(self): self.radius = int(self.rect.width *.90 / 2) self.rect.x = random.randrange(0, WIDTH - self.rect.width) self.rect.y = random.randrange(-150, -100) - self.speedy = random.randrange(1, 8) ## for randomizing the speed of the Mob + self.speedy = random.randrange(5, 20) ## for randomizing the speed of the Mob ## randomize the movements a little more self.speedx = random.randrange(-3, 3)