added the .py files and the *temporary* sprite assets

Šī revīzija ir iekļauta:
Raphael Lacroix 2020-07-27 20:29:39 +02:00
vecāks fa4d021d2c
revīzija e7a2d86699
24 mainīti faili ar 218 papildinājumiem un 0 dzēšanām

Parādīt failu

@ -0,0 +1,12 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N802" />
</list>
</option>
</inspection_tool>
</profile>
</component>

Parādīt failu

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml Parasts fails
Parādīt failu

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Parasts fails
Parādīt failu

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/untitled.iml" filepath="$PROJECT_DIR$/.idea/untitled.iml" />
</modules>
</component>
</project>

Parādīt failu

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/untitled.iml Parasts fails
Parādīt failu

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml Parasts fails
Parādīt failu

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

Binārs
bg.jpg Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 349 KiB

Binārs
ground.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 99 KiB

Binārs
obs10.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 153 B

Binārs
obs20.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 167 B

Binārs
obs30.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 176 B

Binārs
obs40.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 183 B

Binārs
obs50.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 202 B

Binārs
obs60.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 206 B

Binārs
obs70.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 209 B

16
setup.py Parasts fails
Parādīt failu

@ -0,0 +1,16 @@
from cx_Freeze import setup, Executable
base = None
executables = [Executable("tests.py", base=base)]
packages = ["idna", "random", "pygame"]
options = {
'build_exe': {
'packages':packages,
},
}
setup(
name = "dino à 2 balles",
options = options,
version = "1.0",
description = 'FC ça passe',
executables = executables
)

147
tests.py Parasts fails
Parādīt failu

@ -0,0 +1,147 @@
import pygame
import random
pygame.init()
pygame.font.init()
win = pygame.display.set_mode((500, 500))
pygame.display.set_caption("test")
bigFont = pygame.font.SysFont('Impact', 50)
smallFont = pygame.font.SysFont('Impact', 35)
posGround = 405
posPlayer = 40
posy = posGround -64
jumpCount = 21
walkCount = 0
bgCount = 0
groundCount =0
jump = False
class Obstacle:
def __init__(self, position, width):
self.position = position
self.width = width
obs1 = Obstacle(600, random.randrange(10, 70, 10))
obs2 = Obstacle(1000, random.randrange(10, 70, 10))
obs3 = Obstacle(1400, random.randrange(10, 70, 10))
obs4 = Obstacle(2000, random.randrange(10, 70, 10))
obs5 = Obstacle(2200, random.randrange(10, 70, 10))
obs6 = Obstacle(2600, random.randrange(10, 70, 10))
def jumpHeight(count):
return (-0.02*count*count+8)*20
walkSprite = [pygame.image.load('walk1.png'), pygame.image.load('walk2.png'), pygame.image.load('walk3.png'), pygame.image.load('walk4.png'), pygame.image.load('walk5.png'), pygame.image.load('walk6.png')]
obstacleSprite =[pygame.image.load('obs10.png'), pygame.image.load('obs20.png'), pygame.image.load('obs30.png'), pygame.image.load('obs40.png'), pygame.image.load('obs50.png'), pygame.image.load('obs60.png'), pygame.image.load('obs70.png')]
bg = pygame.image.load('bg.jpg')
ground = pygame.image.load('ground.png')
program_Running = True
game_Running = True
while program_Running:
while game_Running:
print('yay')
pygame.time.delay(int(1000/60))
obstacles = [obs1, obs2, obs3, obs4, obs5, obs6]
for event in pygame.event.get():
if event.type == pygame.QUIT:
game_Running = False
program_Running = False
key = pygame.key.get_pressed()
if key[pygame.K_SPACE] and jumpCount == 21:
jump = True
jumpCount = -20
if jump and jumpCount <= 20:
posy = posGround - int(jumpHeight(jumpCount)) - 64
jumpCount += 1
for i in range(0, 6):
if abs(obstacles[i].position - posPlayer)<obstacles[i].width/2:
if posy > posGround -64 -50:
game_Running = False
win.fill((0, 0, 0))
win.blit(bg, (0+int(bgCount/3), 0))
win.blit(ground, (groundCount, posGround))
win.blit(walkSprite[(walkCount % 18)//3], (posPlayer, posy))
for i in range(0, 6):
if obstacles[i].position < 500:
if obstacles[i].width == 10:
win.blit(obstacleSprite[0], (obstacles[i].position, posGround-50))
elif obstacles[i].width == 20:
win.blit(obstacleSprite[1], (obstacles[i].position, posGround-50))
elif obstacles[i].width == 30:
win.blit(obstacleSprite[2], (obstacles[i].position, posGround-50))
elif obstacles[i].width == 40:
win.blit(obstacleSprite[3], (obstacles[i].position, posGround-50))
elif obstacles[i].width == 50:
win.blit(obstacleSprite[4], (obstacles[i].position, posGround-50))
elif obstacles[i].width == 60:
win.blit(obstacleSprite[5], (obstacles[i].position, posGround-50))
elif obstacles[i].width == 70:
win.blit(obstacleSprite[6], (obstacles[i].position, posGround-50))
obstacles[i].position -= 5
if obstacles[i].position < -1 * obstacles[i].width:
obstacles[i].width = random.randrange(10, 70, 10)
obstacles[i].position = 2400
print(i, ": position: ", obstacles[i].position)
pygame.display.update()
walkCount += 1
groundCount -= 5
if groundCount <= -641:
groundCount = 0
lostText = bigFont.render('YOU LOST', False, (255, 0, 0))
lostText2 = smallFont.render("Press Spacebar to replay", False, (255, 0, 0))
win.fill((0, 0, 0))
win.blit(lostText, (150, 150))
win.blit(lostText2, (75, 250))
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
program_Running = False
key = pygame.key.get_pressed()
if key[pygame.K_SPACE]:
game_Running = True
# reseting every variable:
posy = posGround - 64
jumpCount = 21
walkCount = 0
bgCount = 0
groundCount = 0
jump = False
obs1 = Obstacle(600, random.randrange(10, 70, 10))
obs2 = Obstacle(1000, random.randrange(10, 70, 10))
obs3 = Obstacle(1400, random.randrange(10, 70, 10))
obs4 = Obstacle(2000, random.randrange(10, 70, 10))
obs5 = Obstacle(2200, random.randrange(10, 70, 10))
obs6 = Obstacle(2600, random.randrange(10, 70, 10))

Binārs
walk1.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 693 B

Binārs
walk2.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 739 B

Binārs
walk3.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 650 B

Binārs
walk4.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 670 B

Binārs
walk5.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 712 B

Binārs
walk6.png Parasts fails

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 1,1 KiB