Skip to content

Commit

Permalink
Version 0.1.0 (06/12/2023)
Browse files Browse the repository at this point in the history
0.1.0 (06-12-2023)
Main menu:
>> Title added
>> X exit button added
>> X button functionality implemented
>> Background image added
>> Screen set to fullscreen
>> Level buttons added (not clickable yet)
>> When mouse over a button, a hand courser appears
  • Loading branch information
DanielDekhtyar committed Dec 6, 2023
1 parent e3b1cf3 commit 556477f
Show file tree
Hide file tree
Showing 25 changed files with 515 additions and 24 deletions.
12 changes: 12 additions & 0 deletions Final Project/changlog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Version : 0.1.0
Last update : 06/12/2023

0.1.0 (06-12-2023)
Main menu:
>> Title added
>> X exit button added
>> X button functionality implemented
>> Background image added
>> Screen set to fullscreen
>> Level buttons added (not clickable yet)
>> When mouse over a button, a hand courser appears
8 changes: 0 additions & 8 deletions Final Project/class/word.py

This file was deleted.

1 change: 1 addition & 0 deletions Final Project/data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import csv
58 changes: 58 additions & 0 deletions Final Project/data/level1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
topic,word
Animals,DOG
Animals,CAT
Animals,OWL
Animals,FOX
Fruits,APPLE
Fruits,PEAR
Fruits,GRAPE
Fruits,KIWI
Colors,RED
Colors,BLUE
Colors,YELLOW
Colors,GREEN
Countries,FRANCE
Countries,SPAIN
Countries,CHINA
Countries,SOUTH KOREA
Countries,ISRAEL
Celebrities,LEONARDO DICAPRIO
Celebrities,ANGELINA JOLIE
Celebrities,BEYONCE
Celebrities,KEANU REEVES
Transportation,CAR
Transportation,BIKE
Transportation,TRAIN
Transportation,BOAT
Fictional Characters,HARRY POTTER
Fictional Characters,KATNISS EVERDEEN
Fictional Characters,SPONGEBOB SQUAREPANTS
Fictional Characters,SIMBA
Musical Instruments,PIANO
Musical Instruments,GUITAR
Musical Instruments,VIOLIN
Musical Instruments,TRUMPET
Furniture,CHAIR
Furniture,TABLE
Furniture,BED
Furniture,SOFA
Food,PIZZA
Food,BURGER
Food,PASTA
Food,SUSHI
Movies,THE SHAWSHANK REDEMPTION
Movies,INCEPTION
Movies,THE GODFATHER
Movies,PULP FICTION
Sports,SOCCER
Sports,BASKETBALL
Sports,TENNIS
Sports,GOLF
Video Games,MARIO KART
Video Games,THE LEGEND OF ZELDA
Video Games,PAC-MAN
Video Games,MINECRAFT
Music,ROCK
Music,POP
Music,JAZZ
Music,CLASSICAL
57 changes: 57 additions & 0 deletions Final Project/data/level2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
topic,word
Animals,ELEPHANT
Animals,GIRAFFE
Animals,ZEBRA
Animals,MONKEY
Fruits,BANANA
Fruits,MANGO
Fruits,ORANGE
Fruits,PEACH
Colors,ORANGE
Colors,PURPLE
Colors,BROWN
Colors,PINK
Countries,COLUMBIA
Countries,MALAYSIA
Countries,TURKEY
Countries,EGYPT
Celebrities,TOM HANKS
Celebrities,JENNIFER ANISTON
Celebrities,MORGAN FREEMAN
Celebrities,SCARLETT JOHANSSON
Transportation,PLANE
Transportation,BUS
Transportation,MOTORCYCLE
Transportation,SUBWAY
Fictional Characters,LARA CROFT
Fictional Characters,JAMES BOND
Fictional Characters,MICKEY MOUSE
Fictional Characters,ARAGORN
Musical Instruments,HARMONICA
Musical Instruments,HARP
Musical Instruments,ACCORDEON
Musical Instruments,BANJO
Furniture,DINING TABLE
Furniture,ARMCHAIR
Furniture,CABINET
Furniture,OTTOMAN
Food,WATERMELON
Food,STRAWBERRY
Food,BLUEBERRY
Food,RASPBERRY
Movies,FIGHT CLUB
Movies,THE MATRIX
Movies,STAR WARS
Movies,AVATAR
Sports,FOOTBALL
Sports,SWIMMING
Sports,VOLLEYBALL
Sports,CRICKET
Video Games,SONIC THE HEDGEHOG
Video Games,PONG
Video Games,SUPER MARIO BROS
Video Games,STREET FIGHTER
Music,HIP-HOP
Music,COUNTRY
Music,REGGAE
Music,ELECTRONIC
57 changes: 57 additions & 0 deletions Final Project/data/level3.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
topic,word
Animals,CHEETAH
Animals,PENGUIN
Animals,KANGAROO
Animals,DOLPHIN
Fruits,WATERMELON
Fruits,STRAWBERRY
Fruits,BLUEBERRY
Fruits,RASPBERRY
Colors,TURQUOISE
Colors,MAGENTA
Colors,INDIGO
Colors,BEIGE
Countries,PERU
Countries,THAILAND
Countries,MEXICO
Countries,SOUTH AFRICA
Celebrities,MERYL STREEP
Celebrities,MICHAEL JACKSON
Celebrities,ROBERT DOWNEY JR
Celebrities,EMMA THOMPSON
Transportation,HELICOPTER
Transportation,TRUCK
Transportation,TRAM
Transportation,YACHT
Fictional Characters,SHERLOCK HOLMES
Fictional Characters,WONDER WOMAN
Fictional Characters,LUKE SKYWALKER
Fictional Characters,HANNIBAL LECTER
Musical Instruments,SITAR
Musical Instruments,BAGPIPES
Musical Instruments,KALIMBA
Musical Instruments,PAN FLUTE
Furniture,RECLINER
Furniture,BAR STOOL
Furniture,CUPBOARD
Furniture,HUTCH
Food,PINEAPPLE
Food,BLACKBERRY
Food,CRANBERRY
Food,PERSIMMON
Movies,THE DARK KNIGHT
Movies,SCHINDLER'S LIST
Movies,THE LORD OF THE RINGS
Movies,TITANIC
Sports,BASEBALL
Sports,GYMNASTICS
Sports,ICE HOCKEY
Sports,SNOOKER
Video Games,THE WITCHER
Video Games,FORTNITE
Video Games,LEAGUE OF LEGENDS
Video Games,ASSASSIN'S CREED
Music,ROCK 'N' ROLL
Music,BLUES
Music,OPERA
Music,DISCO
57 changes: 57 additions & 0 deletions Final Project/data/level4.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
topic,word
Animals,CHIMPANZEE
Animals,PORCUPINE
Animals,RHINOCEROS
Animals,HYENA
Fruits,GUAVA
Fruits,JABUTICABA
Fruits,LYCHEE
Fruits,KUMQUAT
Colors,SAFFRON
Colors,OCHER
Colors,EMERALD
Colors,AZURE
Countries,VIETNAM
Countries,CAMBODIA
Countries,ROMANIA
Countries,PORTUGAL
Celebrities,LIONEL MESSI
Celebrities,CHARLIZE THERON
Celebrities,DAVID BECKHAM
Celebrities,HALLE BERRY
Transportation,SEGWAY
Transportation,KAYAK
Transportation,HANG GLIDER
Transportation,ELECTRIC SCOOTER
Fictional Characters,ATTICUS FINCH
Fictional Characters,DARTH VADER
Fictional Characters,LISBETH SALANDER
Fictional Characters,ELLEN RIPLEY
Musical Instruments,SARANGI
Musical Instruments,DJEMBE
Musical Instruments,CONTRABASSOON
Musical Instruments,SHAMISEN
Furniture,CREDENZA
Furniture,TUFFET
Furniture,OTTOMAN
Furniture,GAMING CHAIR
Food,GYROS
Food,QUINOA
Food,KIMCHI
Food,PAELLA
Movies,INTERSTELLAR
Movies,THE GREEN MILE
Movies,THE SHINING
Movies,CASABLANCA
Sports,RUGBY
Sports,BADMINTON
Sports,ARCHERY
Sports,FENCING
Video Games,DARK SOULS
Video Games,DEUS EX
Video Games,WORLD OF WARCRAFT
Video Games,UNCHARTED
Music,HEAVY METAL
Music,RAP
Music,CLASSIC ROCK
Music,TECHNO
Empty file removed Final Project/database/__init__.py
Empty file.
1 change: 1 addition & 0 deletions Final Project/font/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import os
Binary file added Final Project/font/fonts/Architex.ttf
Binary file not shown.
Binary file added Final Project/font/fonts/Cheveuxdange.ttf
Binary file not shown.
Binary file added Final Project/font/fonts/Crosshatcher D.otf
Binary file not shown.
Binary file added Final Project/font/fonts/Fine College.ttf
Binary file not shown.
23 changes: 23 additions & 0 deletions Final Project/font/get_font.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os


def font(font_file):
"""
The function "font" takes a font file name as input and returns the full path to the font file.
:param font_file: The `font_file` parameter is a string that represents the name of the font file
(including the file extension) that you want to use
:return: the full path to the font file by joining the font folder path and the font filename.
"""
# The path to the folder containing the font file
font_folder = r"CS50P\Final Project\font\fonts"

# The name of the TTF file
font_filename = font_file

# Construct the full path to the font file
return os.path.join(font_folder, font_filename)


if __name__ == "__main__":
font()
23 changes: 23 additions & 0 deletions Final Project/font/set_font.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from font import get_font

"""
The above code defines functions that return different fonts for different purposes in a
graphical user interface.
:return: The functions are returning different fonts.
"""


def title_font():
return get_font.font("Fine College.ttf")


def topic_font():
return get_font.font("Architex.ttf")


def exit_button_font():
return get_font.font("Crosshatcher D.otf")


def level_button_font():
return get_font.font("Light And Airy.ttf")
Binary file added Final Project/images/background_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Final Project/images/level buttons/level 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Final Project/images/level buttons/level 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Final Project/images/level buttons/level 3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Final Project/images/level buttons/level 4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 45 additions & 16 deletions Final Project/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,70 @@
"""


import sys
import pygame

from src import start_screen
from src import game_loop


def main():
"""
This function initializes the Pygame module, sets up the game window, loads and displays the
background image, renders the title and buttons on the screen, and runs the game loop until the
player clicks the X button to exit the game.
"""
pygame.init()
# This is like a header in HTMl
pygame.display.set_caption("Hang man (Daniel's CS50P Final Project)")
# Set screen dimensions
screen = pygame.display.set_mode((1500, 1000))

# Game runs until 'playing' is set to false. aka click the X button
pygame.display.set_caption("Hangman (Daniel's CS50P Final Project)")
# Set screen size and alow the screen to be resizable
# (0, 0) means that the screen size will be set automatically
screen = pygame.display.set_mode((0, 0), pygame.RESIZABLE, pygame.FULLSCREEN)
screen_width = screen.get_width()
screen_height = screen.get_height()

# Select the background image
bg_image_path = "CS50P/Final Project/images/background_image.png"
# Load the background image
bg_image = pygame.image.load(bg_image_path)
# Clean the screen. Make it completely white
screen.fill((255, 255, 255))
# Scale the background image to the size of the screen
bg_image = pygame.transform.scale(bg_image, (screen_width, screen_height))
# Draw the background image.(0, 0) the image will render at the top left corner of the screen
screen.blit(bg_image, (0, 0))

# Render the title "HANGMAN"
title_rect: pygame.Rect = start_screen.render_title(screen)
# Render the buttons "Level 1", "Level 2", "Level 3", "Level 4"
level_buttons_rect: pygame.Rect = start_screen.render_buttons(screen, title_rect)
# Render the X button on the top right corner
X_button_rect: pygame.Rect = start_screen.render_X_button(screen)
# Game runs until 'is_playing' is set to False. aka click the red X button
is_playing: bool = True
while is_playing:
screen.fill((255, 255, 255))

keyboard_key = pygame.key.get_pressed()

# check all the events and if the red X button is clicked, the game will exit
# The Game loop. It will run until 'is_playing' is set to False. aka click the X button.
while is_playing:
for event in pygame.event.get():
if event.type == pygame.QUIT:
# the next 'while playing' loop would not execute
is_playing = False
# Making pointing hand cursor when hovering over a button
game_loop.mouse_when_over_button(X_button_rect, level_buttons_rect)
# If the X button is clicked, the game will exit
is_playing = game_loop.exit_game(X_button_rect, event)
if is_playing is False:
break

# updating the screen each time we change something
# Updating the screen each time we change something
pygame.display.flip()

pygame.quit()
sys.exit(0)


def function_1():
def level_setter(level: int):
...


def function_2():
def guess_letter(letter: chr, word):
...


Expand Down
Loading

0 comments on commit 556477f

Please sign in to comment.