Skip to content

Commit

Permalink
Merge pull request #6 from djeof-1/master
Browse files Browse the repository at this point in the history
Final pull.
  • Loading branch information
shreyasiyer14 committed Dec 22, 2015
2 parents 9ad38a3 + 9c7bcca commit ab050fd
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 26 deletions.
60 changes: 48 additions & 12 deletions main.py → FlipOut!.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
green = (0,120,0)
yellow =(255,255,0)


screenWidth = 800
screenHeight = 640
fps = 120
Expand All @@ -31,9 +30,34 @@
score = 0
count = 0
lives = 3

pygame.mixer.init()

creeper = pygame.image.load('Assets/Images/creeper.bmp')
def pre_game_start():
global lives
global score
pygame.mixer.music.stop()
bg = pygame.image.load('Assets/Images/background.bmp')
tx,ty = 0,0
tw,th = 800,640
game = message()
while True:
gameDisplay.fill(black)
gameDisplay.blit(bg,(0,0))
pygame.draw.rect(gameDisplay,black,(tx,ty,tw,th))
tx += 10
ty += 10
tw -= 20
th -= 20


game.display_score("Score "+str(score),350,250)
game.display_score("Lives "+str(lives),350,320)
if tx == 800:
gamem()
pygame.display.update()

def detectCollisions(x1,y1,w1,h1,x2,y2,w2,h2):
if (x2+w2>=x1>=x2 and y2+h2>=y1>=y2):
return True
Expand Down Expand Up @@ -102,12 +126,14 @@ def message_to_screen(self,msg,color,y_displace=0,size="small",text="start",intr
return intro
def GameOver():
global lives
global score
gameExit = True
game = message()
gameOver = True
pygame.mixer.music.stop()
while gameOver:
gameOver=game.message_to_screen("Game over",red,y_displace=-50,size="medium")
gameOver=game.message_to_screen(" Press C to play again or Q to quit ",black,y_displace = 50,size="small")
gameOver=game.message_to_screen("Game over",(255,155,105),y_displace=-50,size="medium")
gameOver=game.message_to_screen(" Press C to play again or Q to quit ",white,y_displace = 50,size="small")

pygame.display.update()
for event in pygame.event.get():
Expand Down Expand Up @@ -143,7 +169,8 @@ def game_intr():

dx = random.randrange(-10,10)
dy = random.randrange(-10,10)

change = 10
count1 = 1
while intro:
if count%3==0:
grass = IntroGrass(800,608)
Expand All @@ -163,16 +190,21 @@ def game_intr():
dx *= -1
if (y < 0):
dy *= -1
elif (y > 608):
elif (y > 608-32):
dy *= -1
x += dx
y += dy
pygame.draw.rect(gameDisplay, black, (x - 2, y - 2, 36, 36))
gameDisplay.blit(creeper, (x,y))
intro=game.message_to_screen("FlipOut!",(135,155,105),-150,size="large",text="none")
intro=game.message_to_screen("FlipOut!",(135-change,155+change,105+change),-150 + change,size="large",text="none")
intro=game.message_to_screen("START GAME",(139,0,139),-20)
intro=game.message_to_screen("EXIT GAME",(139,0,139),20,text="exit")
clock.tick(15)
clock.tick(60)
count1 += 1
if (count1%2):
change -= 10
else:
change += 10
for event in pygame.event.get():
if event.type == pygame.QUIT:
intro = False
Expand All @@ -184,7 +216,6 @@ def game_intr():
lives = 3
sp_itms = 0
def gamem():

pygame.mixer.music.stop()
pygame.mixer.music.load('Assets/Sounds/gameMusic.mp3')
pygame.mixer.music.play(-1)
Expand Down Expand Up @@ -249,7 +280,7 @@ def gamem():
gameOver,img = player.update(brickList,gameOver,img)
if (gameOver):
lives -= 1
gamem()
pre_game_start()
player.render(gameDisplay,img)
if (int(count)%50==0):
score+=1
Expand All @@ -266,11 +297,16 @@ def gamem():
game.display_score("Lives "+str(lives),690,0)
game.display_score("Time "+str(int(time)),420,0)
if lives == 0 or int(time) == 0:
gameDisplay.fill(black)
GameOver()
if (player.x >= 92*32):
gameDisplay.fill(black)
game.display_score("Congratulations! You completed the level!",350,320)
pygame.display.update()
clock.tick(fps)

game_intr()
pygame.quit()
quit()
if __name__ == "__main__":
game_intr()
pygame.quit()
quit()

Binary file removed Fonts/eddie.ttf
Binary file not shown.
7 changes: 7 additions & 0 deletions INSTALL.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
echo "FlipOut! requires pygame to be installed on your system. This script will install all the necessary dependencies on your system. Please make sure that you are connected to the internet."

echo "Mac OSX users might need to download and install an open-source software tool called 'Mac Ports'. After installing, type in 'sudo port install pygame'"

sudo apt-get install pygame


24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,36 @@ Making this game was really fun, and the concept of the game makes it addictive.
<br />
1) Download the repository as a .zip, and extract it on your system.
<br />
2) Now change your directory to the extracted folder, and then run the shell script 'bootstrap.sh', by saying:<br />
`chmod +x bootstrap.sh`
2) Now change your directory to the extracted folder, and then run the shell script 'INSTALL.sh', by typing:<br />
`chmod +x INSTALL.sh`
<br />
`./bootstrap.sh`
`./INSTALL.sh`
<br />
3) Now, with the dependencies installed, you are good to go! Fire up the game by writing: <br />
`python main.py`
3) Now, with the dependencies installed, you are good to go! Fire up the game by typing: <br />
`python FlipOut!.py`

***

**Snapshots:**
<br>
(Game Intro)
![Alt text](https://github.com/djeof-1/API-HackDayProject/blob/master/Screen Shot 2015-12-20 at 12.47.40 PM.png " Screenshot #1")
![Alt text](https://github.com/djeof-1/FlipOut/blob/master/Screenshots/Screenshot%232.png "Screenshot #1")

***

(In-game)
![Alt text](https://github.com/djeof-1/API-HackDayProject/blob/master/Screen Shot 2015-12-20 at 12.48.02 PM.png "Screenshot #2")
![Alt text](https://github.com/djeof-1/FlipOut/blob/master/Screenshots/Screenshot%231.png "Screenshot #2")

***

<b>The music used in the game were royalty-free and copyright free. All the music used in the game were taken from Free Music Archive</b>
<b> The music used in the game were royalty-free and copyright free. All the music used in the game were taken from Free Music Archive</b>

www.freemusicarchive.org
<br />
<b> The fonts used in the game were royalty-free and open for public use, hence do not come under copyright infringement case.</b>
<br />
<b> The images used in the game are copyrighted under different organizations (Mojang, Nintendo and others). The images were taken purely for educational purposes. Any artist who can make his/her own images are more than welcome to contribute to the game and make it completely original.</b>

***

The software has been licensed with MIT License 2015.
File renamed without changes
File renamed without changes
6 changes: 0 additions & 6 deletions bootstrap.sh

This file was deleted.

0 comments on commit ab050fd

Please sign in to comment.