Giter Club home page Giter Club logo

tkinter-scotland_yard's Introduction

Tkinter - Scotland Yard

A python implementation of the board game 'Scotland Yard'. This gui replictes the famous Scotland Yard. "Scotland Yard is a board game in which a team of players controlling different detectives cooperate to track down a player controlling a criminal as they move around a board representing the streets of London." you may have seen its ad on the tv by funskool.

It's my first GUI. Currently i have learned python and i'm trying to see python capabilites or you can say application. It's made with Tkinter module in python. The program uses a other similar module, customTkinter. Thanks to this guy Tom Schimansky GitHub i got this amazing thing. It just make the old looking tkinter so much modern.

I've designed my Scotland Yard game in Tkinter with the UI divided into three main sections: the left frame, which shows moves and ticket options, the bottom frame for the start and quit buttons, and the map frame, where the actual map is displayed. To handle the images—like player pieces, the map itself, and the path highlighters—I’ve used the Pillow library since it works well with Tkinter.

For setting up stations and their possible routes, I’ve manually written coordinates into two text files. One file defines station objects with possible paths (bus, taxi, underground), and the other places sky-blue highlighters on stations where players can move. I use the linecache module to read these coordinates from the files and segregate the information accordingly.

I’ve written three key classes: stop: This class handles possible routes from a given station. player: It stores details about each player, like their current location and how many tickets they have for each transport type. Mr_X: This class inherits from player and represents the criminal that the detectives are trying to catch.

The game starts with the main() function, which sets up the player classes and objects. Then, the next() function highlights the possible moves a player can make by placing interactive highlighters on the map. When one of these highlighters is clicked, it triggers the move() function, which creates a dropdown menu on the left frame showing available tickets for travel. Once a ticket is selected and "travel" is pressed, the player’s position is updated using update_player().

To keep track of everything, I store various objects in lists, which I can easily access based on the player's turn. I’ve also added an auto-scroll feature to the map, which shifts the view to the current player’s location at the start of each turn. This keeps the focus on the player who’s actively making a move.

Demo video

Watch the video

Screenshots

Screenshot(25)

App Screenshot

Screenshot(31)

App Screenshot

More screenshots here

Installation

Download the Scotland_Yard_exe.zip

Unzip it in your laptop and look for the Scotland yard exe in it . That's the application. Have fun!😊

Documentation

Game rules

Issues

The game window is not responsive yet it works okay till a 5 inch laptop further I have no idea😅.

The code is ain't efficient yet.

Future Goals

I will want to add animation to player pieces and other stuff.

Add sounds too.

A continue functionality.

Map zooming option.

And the most important responsive.

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.