Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/PyLadder.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Snake_Ladder/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Snake_Ladder/.idea/Snake_Ladder.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions Snake_Ladder/.idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Snake_Ladder/.idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Snake_Ladder/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Snake_Ladder/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Snake_Ladder/assets/background.jpg
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 Snake_Ladder/assets/blue.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 Snake_Ladder/assets/board.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 Snake_Ladder/assets/dice_image1.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 Snake_Ladder/assets/dice_image2.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 Snake_Ladder/assets/dice_image3.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 Snake_Ladder/assets/dice_image4.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 Snake_Ladder/assets/dice_image5.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 Snake_Ladder/assets/dice_image6.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 Snake_Ladder/assets/red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
126 changes: 126 additions & 0 deletions Snake_Ladder/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import pygame
from random import randint

# Initializing pygame
pygame.init()

# Display Window
width_screen = 1366
height_screen = 768
window = pygame.display.set_mode((width_screen, height_screen))

# Caption Title
pygame.display.set_caption('Pythoneer')

# clock = pygame.time.Clock()

# window_height = window.get_height()
# window_width = window.get_width()

# Background
background = pygame.image.load("assets/background.jpg")
main_background = pygame.transform.smoothscale(background, (1366, 768))

# Board
board = pygame.image.load("assets/board.png")

# All Point
red_point = pygame.image.load("assets/red.png")
red_point = pygame.transform.smoothscale(red_point, (36, 51))

blue_point = pygame.image.load("assets/blue.png")
blue_point = pygame.transform.smoothscale(blue_point, (36, 51))

# All Dice
d1 = pygame.image.load("assets/dice_image1.png")
d2 = pygame.image.load("assets/dice_image2.png")
d3 = pygame.image.load("assets/dice_image3.png")
d4 = pygame.image.load("assets/dice_image4.png")
d5 = pygame.image.load("assets/dice_image5.png")
d6 = pygame.image.load("assets/dice_image6.png")

# Font and Size
font = pygame.font.Font('freesansbold.ttf', 32)

# Start Text
text_start = font.render('Start >>', True, (0, 0, 0), (255, 255, 255))


# Cells Sites Function
def cells_sites(cell):
cells = [[391, 581], [441, 581], [491, 581], [541, 581], [591, 581], [641, 581], [691, 581], [741, 581], [791, 581],
[841, 581], [891, 581], [891, 535], [841, 535], [791, 535], [741, 535], [691, 535], [641, 535], [591, 535],
[541, 535], [491, 535], [441, 535], [441, 481], [491, 481], [541, 481], [591, 481], [641, 481], [691, 481],
[741, 481], [791, 481], [841, 481], [891, 481], [891, 435], [841, 435], [791, 435], [741, 435], [691, 435],
[641, 435], [591, 435], [541, 435], [491, 435], [441, 435], [441, 381], [491, 381], [541, 381], [591, 381],
[641, 381], [691, 381], [741, 381], [791, 381], [841, 381], [891, 381], [891, 335], [841, 335], [791, 335],
[741, 335], [691, 335], [641, 335], [591, 335], [541, 335], [491, 335], [441, 335], [441, 281], [491, 281],
[541, 281], [591, 281], [641, 281], [691, 281], [741, 281], [791, 281], [841, 281], [891, 281], [891, 235],
[841, 235], [791, 235], [741, 235], [691, 235], [641, 235], [591, 235], [541, 235], [491, 235], [441, 235],
[441, 181], [491, 181], [541, 181], [591, 181], [641, 181], [691, 181], [741, 181], [791, 181], [841, 181],
[891, 181], [891, 135], [841, 135], [791, 135], [741, 135], [691, 135], [641, 135], [591, 135], [541, 135],
[491, 135], [441, 135]]
return cells[cell][0], cells[cell][1]


def dice(d):
if d == 1:
d = d1
elif d == 2:
d = d2
elif d == 3:
d = d3
elif d == 4:
d = d4
elif d == 5:
d = d5
elif d == 6:
d = d6

time_clock = pygame.time.get_ticks()
while pygame.time.get_ticks() - time_clock < 1000:
window.blit(d, (280, 450))
# pygame.display.update()

# Turn
# sc, lefted, section
def turn():
d = randint(1, 6) # player dice roll
if d == 6:
six = True
else:
six = False

dice(d)
x, y = cells_sites(d)

return x, y



running = True
tuen_p = 1
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False

window.blit(main_background, (0, 0))
window.blit(board, (433, 134))

window.blit(text_start, (260, 592))


if tuen_p:
turn_p = 0
x_red, y_red = turn()
x_blue, y_blue = turn()


# x_red, y_red = cells_sites(0)
window.blit(red_point, (x_red, y_red))

# x_blue, y_blue = cells_sites(2)
window.blit(blue_point, (x_blue, y_blue))

pygame.display.update()