Game is an interactive way of using leisure and even pass time. People love to play games irrespective of age. When doing python application development, why not build your own game to interact with your computer. Some logics and knowledge of few libraries and you can have your own game in laptop/computer desktop by programming it with python.
We would be using basically two libraries random and pygame, one for logic and other for the GUI work. At the start it may not look so good but in the later stages when you practice and improve on graphical work it would be lovely to play this game.
Game Development Kit will be shipped to you and you can learn and build using tutorials. You can start for free today!
OUTLINE:
This is a very simple game that can be played on the GUI interface also but to make it user friendly we add the GUI window with graphics. The game would be of two players, who would turn wise get random words which have letters jumbled. 1 point for correct, 0 for incorrect or no word filling. It will continue until the players selected to stop and in the end, it declares to scores with winner name.
PREREQUISITE:
Want to develop practical skills on Game Development? Checkout our latest projects and start learning for free
REQUIREMENTS:
Hardware:
Software/Technology:
IMPLEMENTATION:
We will be doing it in parts and combine in one to make it work, before that in the first two lines import random, import pygame:-
LOGIC ( can be used on CUI ):
this will be done in 4 steps:
1. Create a library of words for the game
pick=random.choice(words)
2. define a function to jumble words
jumbled="".join(random.sample(word,len(word)))
3. function to give ending lines of game
4. define the game
GUI (user friendly):
import tkinter as tk
import math, random
from PIL import Image, ImageTk
from tkinter import Tk, RIGHT, BOTH, RAISED
from tkinter.ttk import Frame, Label, Button, Style
root= tk.Tk()
root.title(“title”)
canvas1 = tk.Canvas(root, width = 1080, height = 800, relief = 'raised')
canvas1.pack()
player1_entry = tk.Entry(root)
entry_label = tk.Label(root, text='enter players profile')
entry_label.config(font=('helvetica', 25))
canvas1.create_window(500, 50, window=entry_label)
player1_label.destroy()
The game is made and if you want you can work on pygame , the only problem is that it does not take input as no method in the library of it so you can get the library wanted on github just search “ pygame_textinput ” use this by importing the module.
You want then turn it into exe file
You can get help from my github profile:
https://github.com/vaibhavkumar-779/
Skyfi Labs helps students learn practical skills by building real-world projects.
You can enrol with friends and receive kits at your doorstep
You can learn from experts, build working projects, showcase skills to the world and grab the best jobs.
Get started today!
Join 250,000+ students from 36+ countries & develop practical skills by building projects
Get kits shipped in 24 hours. Build using online tutorials.
Stay up-to-date and build projects on latest technologies