Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
nisarg14 authored Oct 17, 2019
1 parent bf6e7fb commit 69f2c95
Show file tree
Hide file tree
Showing 47 changed files with 224 additions and 0 deletions.
Binary file added L1.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 L10E.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 L11E.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 L1E.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 L2.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 L2E.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 L3.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 L3E.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 L4.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 L4E.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 L5.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 L5E.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 L6.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 L6E.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 L7.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 L7E.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 L8.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 L8E.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 L9.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 L9E.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 R1.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 R10E.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 R11E.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 R1E.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 R2.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 R2E.png
Binary file added R3.png
Binary file added R3E.png
Binary file added R4.png
Binary file added R4E.png
Binary file added R5.png
Binary file added R5E.png
Binary file added R6.png
Binary file added R6E.png
Binary file added R7.png
Binary file added R7E.png
Binary file added R8.png
Binary file added R8E.png
Binary file added R9.png
Binary file added R9E.png
Binary file added bg.jpg
133 changes: 133 additions & 0 deletions final_practice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import pygame
pygame.init()
win = pygame.display.set_mode((850,480))

pygame.display.set_caption("hello there ")

walkRight = [pygame.image.load('R1.png'), pygame.image.load('R2.png'), pygame.image.load('R3.png'), pygame.image.load('R4.png'), pygame.image.load('R5.png'), pygame.image.load('R6.png'), pygame.image.load('R7.png'), pygame.image.load('R8.png'), pygame.image.load('R9.png')]
walkLeft = [pygame.image.load('L1.png'), pygame.image.load('L2.png'), pygame.image.load('L3.png'), pygame.image.load('L4.png'), pygame.image.load('L5.png'), pygame.image.load('L6.png'), pygame.image.load('L7.png'), pygame.image.load('L8.png'), pygame.image.load('L9.png')]
bg = pygame.image.load('bg.jpg')
char = pygame.image.load('standing.png')

clock=pygame.time.Clock()

class player(object):
def __init__(self,x,y,height,width):
self.x= x
self.y=y
self.height=height
self.width=width
self.vel=10
self.isJump=False
self.jumpCount=10
self.Left=False
self.Right=False
self.Walk=0
self.standing = True

def draw(self,win):
if self.Walk + 1 >= 27:
self.Walk = 0

if not(self.standing):
if self.Left:
win.blit(walkLeft[self.Walk // 3], (self.x, self.y))
self.Walk += 1

elif self.Right:
win.blit(walkRight[self.Walk // 3], (self.x, self.y))
self.Walk += 1
else:
if self.Right:
win.blit(walkRight[0],(self.x,self.y))
else:
win.blit(walkLeft[0],(self.x,self.y))

class projectile(object):
def __init__(self,x,y,radius,color,facing):
self.x=x
self.y=y
self.radius=radius
self.color=color
self.facing=facing
self.vel=8*facing

def draw(self,win):
pygame.draw.circle(win,self.color,(self.x,self.y),self.radius )





def redrawGameWindow():

win.blit(bg,(0,0))
man.draw(win)
for bullet in bullets:
bullet.draw(win)
pygame.display.update()

#main loop
man = player(50,380,64,64)
run = True
bullets = []
while run:
clock.tick(27)

for event in pygame.event.get():
if event.type == pygame.QUIT:
run =False
for bullet in bullets:
if bullet.x < 850 and bullet.x>0:
bullet.x += bullet.vel
else:
bullets.pop(bullets.index(bullet))

keys=pygame.key.get_pressed()

if keys[pygame.K_SPACE]:
if man.Left:
facing= -1
else:
facing=1
if len(bullets)<5:
bullets.append(projectile(round(man.x + man.width//2),round(man.y , man.height//2),6,(0,0,0),facing))

if keys[pygame.K_LEFT] and man.x > man.vel:
man.x -= man.vel
man.Left= True
man.Right=False
man.standing=False

elif keys[pygame.K_RIGHT] and man.x < 800:
man.x += man.vel
man.Right=True
man.Left=False
man.standing=False
else:
man.standing=True
man.Walk=0
if not(man.isJump):

if keys[pygame.K_UP] :
man.isJump = True
man.Right=False
man.Left=False
man.Walk=0

else :
if man.jumpCount >= -10:
neg = 1
if man.jumpCount<0:
neg= -1
man.y -= (man.jumpCount ** 2)* 0.5 * neg
man.jumpCount -= 1
else :
man.isJump =False
man.jumpCount=10

redrawGameWindow()



pygame.quit
32 changes: 32 additions & 0 deletions game_final_practice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import pygame

pygame.init()

win = pygame.display.set_mode((500,500))

pygame.display.set_caption("my first pygame project")

x=50
y=50
height=40
width=60
vel=5

run = True

while run:
pygame.time.delay(100)

for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False

keys = pygame.key.get_pressed( )

if keys[pygame.K_w]:
x += vel

win.fill((0,0,0))
pygame.draw.rect(win, (253,52,1), (x,y,height,width))
pygame.display.update()
pygame.quit
56 changes: 56 additions & 0 deletions game_practice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import pygame
pygame.init()
#every time use this upper line to initial pygame

win = pygame.display.set_mode((500,500))
#this upper line makes window to play game in , here "win" is variable for that window

pygame.display.set_caption("my first pygame")

x=50
y=400
height=40
width= 40
vel = 5

isJump= True
jumpCount = 10
jumpHeight = 50

run = True

while run:
pygame.time.delay(100)

for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False

keys = pygame.key.get_pressed()

if keys[pygame.K_d] and x < 450:
x += vel
if keys[pygame.K_a] and x > vel:
x -= vel
if not(isJump):
` y += vel
if keys[pygame.K_w] and y > vel:
y -= vel
if keys[pygame.K_SPACE] :
isJump= True
else:
if jumpCount >= -10:
heg=1
if jumpCount<0:
heg= -1
y -= (jumpCount ** 2)* 0.5 * heg
jumpCount -= 1
else :
isJump = False
jumpCount=10

win.fill((0,0,0))
pygame.draw.rect(win, (253,52,1), (x,y,height,width))
pygame.display.update()

pygame.quit()
Binary file added music.mp3
Binary file not shown.
3 changes: 3 additions & 0 deletions pyvenv.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
home = C:\Users\ADMIN\AppData\Local\Programs\Python\Python37-32
include-system-site-packages = false
version = 3.7.3
Binary file added standing.png

0 comments on commit 69f2c95

Please sign in to comment.