WORKING
This commit is contained in:
parent
c654e30d30
commit
4c9336cd3b
32
PyGame/practice/gameprac/pygame template.py
Normal file
32
PyGame/practice/gameprac/pygame template.py
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import pygame
|
||||||
|
import random
|
||||||
|
|
||||||
|
WIDTH = 360
|
||||||
|
HEIGHT = 480
|
||||||
|
FPS = 30
|
||||||
|
|
||||||
|
WHITE = (255, 255, 255)
|
||||||
|
BLACK = (0, 0, 0)
|
||||||
|
RED = (255, 0, 0)
|
||||||
|
GREEN = (0, 255, 0)
|
||||||
|
BLUE = (0, 0, 255)
|
||||||
|
|
||||||
|
pygame.init()
|
||||||
|
pygame.mixer.init()
|
||||||
|
screen = pygame.display.set_mode(360, 480)
|
||||||
|
pygame.display.set_caption("My Game")
|
||||||
|
clock = pygame.time.Clock()
|
||||||
|
|
||||||
|
running = True
|
||||||
|
while running:
|
||||||
|
clock.tick(FPS)
|
||||||
|
for event in pygame.event.get():
|
||||||
|
if event.type == pygame.QUIT:
|
||||||
|
running = False
|
||||||
|
screen.fill(BLACK)
|
||||||
|
pygame.display.flip()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pygame.QUIT()
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
def game():
|
|
||||||
|
|
||||||
answer=input('Would you like to play a game?(y/n)')
|
|
||||||
|
|
||||||
if answer.lower() =='y':
|
|
||||||
print('Welcome to the Adventure')
|
|
||||||
start = True
|
|
||||||
inventory = []
|
|
||||||
|
|
||||||
else:
|
|
||||||
print( 'Ok Maybe Some other time' )
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
game()
|
|
85
PyGame/practice/textadventure/texadv.py
Normal file
85
PyGame/practice/textadventure/texadv.py
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
|
||||||
|
|
||||||
|
def game():
|
||||||
|
|
||||||
|
answer=input('Would you like to play a game?(y/n)')
|
||||||
|
|
||||||
|
if answer.lower() =='y':
|
||||||
|
print('Welcome to the Adventure')
|
||||||
|
start = True
|
||||||
|
inventory = []
|
||||||
|
|
||||||
|
else:
|
||||||
|
print( 'Ok Maybe Some other time' )
|
||||||
|
|
||||||
|
|
||||||
|
name = input("Enter Your Name : ")
|
||||||
|
print("Greetings, " + name + "\n###Let's Start the Game###")
|
||||||
|
|
||||||
|
print("""\nAs you slowly regained consciousness, you found yourself in a strange room bathed in an eerie glow.
|
||||||
|
There are three imposing doors, each beckoning you towards a different path.
|
||||||
|
Which door would you choose---1, 2 or 3???""")
|
||||||
|
|
||||||
|
door = input(">")
|
||||||
|
|
||||||
|
if(door == "1"):
|
||||||
|
print("You entered the First room and through time travelling you found yourself in a an ancient Battle")
|
||||||
|
print("By looking at the Flag of an Empire you come to knw that\nIt is the battle of Spartans")
|
||||||
|
print("You hide in the bush and finds a Sword lying on the ground")
|
||||||
|
print("What would you do???")
|
||||||
|
print("1-Pick the Sword and Run from the Battleground")
|
||||||
|
print("2-Pick the Sword and Fight for your life")
|
||||||
|
print("3-Leave it and come back to Present time without altering the timeline")
|
||||||
|
|
||||||
|
options = input(">")
|
||||||
|
if(options == "1"):
|
||||||
|
print("As you started running\nomeone from back hit you with the Arrow!\nBoom!!!You are dead.")
|
||||||
|
elif(options == "2"):
|
||||||
|
print("You started fighting from the spartans side, \nluckily you survived the battlefield and lived the rest of the life as a commander in the Army\nYou stucked in the past for the rest of your life")
|
||||||
|
elif(options == "3"):
|
||||||
|
print("You leaved the sword in its place and witnessed the ancient war.\nCame back to present time\nWith the memories of the huge Battlefield, which you can't share with anyone.\n###You Won the Game###")
|
||||||
|
else:
|
||||||
|
print("Type a Number!!!\nGAME OVER\nPLEASE RESTART the GAME")
|
||||||
|
|
||||||
|
if(door == "2"):
|
||||||
|
print("You entered the Second room and found yourself in a remote jungle with an ancient map beside you")
|
||||||
|
print("The Map contains a route leading to a treasure hidden in the forest")
|
||||||
|
print('What would you do???')
|
||||||
|
print("1-Wait for the help.")
|
||||||
|
print("2-Find for an exit on on your own.")
|
||||||
|
print("3-Take the Map.")
|
||||||
|
|
||||||
|
forest = input(">")
|
||||||
|
if(forest == "1"):
|
||||||
|
print("No one was there to help you.\nYou hide from the wild animals for a while.\nGets killed by the Wolf in the End")
|
||||||
|
elif(forest == "2"):
|
||||||
|
print("You look for an exit in jungle on your own.\nIn the pain of hunger you ate poisoned berries.\nGood job! You Died!!!")
|
||||||
|
elif(forest == "3"):
|
||||||
|
print("You followed the Map, discovered some beautiful sceneries of deep forest.\nFinally reached the treasure chest.\nYou opened the chest but it was empty")
|
||||||
|
print("You get disappointed\nAfter walking for a while.\nYou saw a river and sat near the river and relaxed.\n###You Won the Game###")
|
||||||
|
else:
|
||||||
|
print("Type a Number!!!\nGAME OVER\nPLEASE RESTART the GAME")
|
||||||
|
if (door == "3"):
|
||||||
|
print("You entered the Third room and found yourself in front of a Witch brewing Potions")
|
||||||
|
print("She ask-What are you doing here young boy?")
|
||||||
|
print("What will you answer-")
|
||||||
|
print("1-You tell her that you're lost, and want to get out of here.")
|
||||||
|
print("2-You stab her with a knife.")
|
||||||
|
print("3-You try to runway.")
|
||||||
|
|
||||||
|
witch = input(">")
|
||||||
|
if(witch == "1"):
|
||||||
|
print("She cast a spell on you and you become unconscious.")
|
||||||
|
print("She brewed you into her potion")
|
||||||
|
print("Good bye! You Died")
|
||||||
|
elif(witch == "2"):
|
||||||
|
print("You come close to her and swing your knife at her face and then stab her to death.")
|
||||||
|
print("Good job. You are free now.\nWith a tag of Murderer!!!\n###But You Won the Game###")
|
||||||
|
elif(witch == "3"):
|
||||||
|
print("She casts a spell that freezes you in place.")
|
||||||
|
print("She prisoned you in her cabin.")
|
||||||
|
print("Good job! You became her slave for the rest of your life.")
|
||||||
|
else:
|
||||||
|
print("Type a Number!!!\nGAME OVER\nPLEASE RESTART the GAME")
|
||||||
|
|
||||||
|
game()
|
Loading…
Reference in New Issue
Block a user