Giter Club home page Giter Club logo

battleship's Introduction

Battleship

Battleship game created in Pygame Zero

Based on the Battleship game featured in Beginning Game Programming with Pygame Zero:

Book Beginning Game Programming with Pygame Zero - Apress / Springer

This is simple battleship game, where you have to outsmart the computer by sinking all their fleet first.

This has now been developed further. It supports two different screen sizes. To enable small screen size (used for pip) then update battleship.py with

SIZE_SML = True

For a large screen size update battleship.py with

SIZE_SML = False

To run

python3 battleship.py

Game play

First you need to position your ships on your grid on the left. The ship will be placed where your cursor is. It will show a rectangle showing the approximate position of the ship.

After placing your ships you fire shots at the enemy grid on the right. Take it in turn to fire shots with your enemy. Misses are marked with a splash and hits with an explosion. Once an entire ship is destroyed it will become visible.

The first person to destroy all the enemy ships will be the winner.

To exit press Q on a keyboard.

Work in progress / support for the pip

This is currently work in progress. In particular I am currently making some changes so it can work with the pip Raspberry Pi based handheld games console.

You will need a keyboard and mouse connected at the moment, but I plan to change that in future.

More information

See the project website:

Battleship Python Pygame Zero Game by PenguinTutor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.