diff --git a/brython-snake-master/brython-snake-master/Python_Games-main.zip b/brython-snake-master/brython-snake-master/Python_Games-main.zip new file mode 100644 index 00000000..033bd393 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main.zip differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/Shoot.py b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/Shoot.py new file mode 100644 index 00000000..09ddd88b --- /dev/null +++ b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/Shoot.py @@ -0,0 +1,36 @@ +import pgzrun +from random import randint +apple = Actor("apple") +orange = Actor("orange") +pineapple = Actor("pineapple") +def draw(): + screen.clear() + screen.fill("pink") + apple.draw() + pineapple.draw() + orange.draw() +def place_apple(): + apple.x = randint(50, 400) + apple.y = randint(50,400) +def place_pineapple(): + pineapple.x = randint(90, 600) + pineapple.y = randint(90,400) +place_pineapple() +def place_orange(): + orange.x = randint(100, 800) + orange.y = randint(100,300) +place_orange() +def on_mouse_down(pos): + + if apple.collidepoint(pos): + print("Good shot!") + place_apple() + + else: + print("You missed!") + if pineapple.collidepoint(pos): + place_pineapple() + if orange.collidepoint(pos): + place_orange() + +pgzrun.go() diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/images.rar b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/images.rar new file mode 100644 index 00000000..d2b76907 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/images.rar differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/images/apple.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/images/apple.png new file mode 100644 index 00000000..27a39e1f Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/images/apple.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/images/orange.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/images/orange.png new file mode 100644 index 00000000..c50ccff2 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/images/orange.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/images/pineapple.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/images/pineapple.png new file mode 100644 index 00000000..ebd2aa4b Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/1_Fruit_Shooter/images/pineapple.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/2_Mario_Bounty_Hunter/bai2.rar b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/2_Mario_Bounty_Hunter/bai2.rar new file mode 100644 index 00000000..dd1618e6 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/2_Mario_Bounty_Hunter/bai2.rar differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/2_Mario_Bounty_Hunter/mario.py b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/2_Mario_Bounty_Hunter/mario.py new file mode 100644 index 00000000..9f4e8d7d --- /dev/null +++ b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/2_Mario_Bounty_Hunter/mario.py @@ -0,0 +1 @@ +#test diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/3_Google_Translate/test.py b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/3_Google_Translate/test.py new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/3_Google_Translate/test.py @@ -0,0 +1 @@ + diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/3_Google_Translate/tutorial.rar b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/3_Google_Translate/tutorial.rar new file mode 100644 index 00000000..a862f944 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/3_Google_Translate/tutorial.rar differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/Among_Us_Flow_Chart.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/Among_Us_Flow_Chart.png new file mode 100644 index 00000000..c21cfb4b Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/Among_Us_Flow_Chart.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/codeform.py b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/codeform.py new file mode 100644 index 00000000..f0c1d296 --- /dev/null +++ b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/codeform.py @@ -0,0 +1,46 @@ +import pgzrun +import random +FONT_COLOR = (255, 255, 255) #màu RGB +WIDTH = 1300 +HEIGHT = 700 +CENTER_X = WIDTH / 2 +CENTER_Y = HEIGHT / 2 +CENTER = (CENTER_X, CENTER_Y) +def draw(): + screen.clear() + screen.blit("dark",(0,0)) + +def update(): + pass + +def make_impostors(number_of_impostors): + pass + +def get_colors_to_create(number_of_impostors): + pass + +def create_impostors(colors_to_create): + pass + +def layout_impostors(impostors_to_layout): + pass + +def animate_impostors(impostors_to_animate): + pass + +def handle_game_over(): + pass + +def on_mouse_down(pos): + pass + +def red_impostor_click(): + pass + +def stop_animations(animations_to_stop): + pass + +def display_message(heading_text, sub_heading_text): + pass + +pgzrun.go() diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/images/blue-im.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/images/blue-im.png new file mode 100644 index 00000000..78e08311 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/images/blue-im.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/images/dark.jpg b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/images/dark.jpg new file mode 100644 index 00000000..dfbd22f3 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/images/dark.jpg differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/images/orange-im.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/images/orange-im.png new file mode 100644 index 00000000..2ac98580 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/images/orange-im.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/images/red-im.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/images/red-im.png new file mode 100644 index 00000000..48eed090 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/4_Among_Us/images/red-im.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/04B_19.TTF b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/04B_19.TTF new file mode 100644 index 00000000..6338c199 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/04B_19.TTF differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/FileGame.rar b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/FileGame.rar new file mode 100644 index 00000000..84fc2ee6 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/FileGame.rar differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/background-night.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/background-night.png new file mode 100644 index 00000000..8b4d6a6a Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/background-night.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/floor.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/floor.png new file mode 100644 index 00000000..c374f2b3 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/floor.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/gameover.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/gameover.png new file mode 100644 index 00000000..b1df7f57 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/gameover.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/message.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/message.png new file mode 100644 index 00000000..00f87a76 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/message.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/pipe-green.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/pipe-green.png new file mode 100644 index 00000000..a7aae2cf Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/pipe-green.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/yellowbird-downflap.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/yellowbird-downflap.png new file mode 100644 index 00000000..e9e1c77b Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/yellowbird-downflap.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/yellowbird-midflap.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/yellowbird-midflap.png new file mode 100644 index 00000000..2ca3c2d0 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/yellowbird-midflap.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/yellowbird-upflap.png b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/yellowbird-upflap.png new file mode 100644 index 00000000..2f693da6 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/assests/yellowbird-upflap.png differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/game.py b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/game.py new file mode 100644 index 00000000..783d6140 --- /dev/null +++ b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/game.py @@ -0,0 +1,156 @@ +import pygame, sys, random +#Tạo hàm cho trò chơi +def draw_floor(): + screen.blit(floor,(floor_x_pos,650)) + screen.blit(floor,(floor_x_pos+432,650)) +def create_pipe(): + random_pipe_pos = random.choice(pipe_height) + bottom_pipe = pipe_surface.get_rect(midtop =(500,random_pipe_pos)) + top_pipe = pipe_surface.get_rect(midtop =(500,random_pipe_pos-650)) + return bottom_pipe, top_pipe +def move_pipe(pipes): + for pipe in pipes : + pipe.centerx -= 5 + return pipes +def draw_pipe(pipes): + for pipe in pipes: + if pipe.bottom >= 600 : + screen.blit(pipe_surface,pipe) + else: + flip_pipe = pygame.transform.flip(pipe_surface,False,True) + screen.blit(flip_pipe,pipe) +def check_collision(pipes): + for pipe in pipes: + if bird_rect.colliderect(pipe): + hit_sound.play() + return False + if bird_rect.top <= -75 or bird_rect.bottom >= 650: + return False + return True +def rotate_bird(bird1): + new_bird = pygame.transform.rotozoom(bird1,-bird_movement*3,1) + return new_bird +def bird_animation(): + new_bird = bird_list[bird_index] + new_bird_rect = new_bird.get_rect(center = (100,bird_rect.centery)) + return new_bird, new_bird_rect +def score_display(game_state): + if game_state == 'main game': + score_surface = game_font.render(str(int(score)),True,(255,255,255)) + score_rect = score_surface.get_rect(center = (216,100)) + screen.blit(score_surface,score_rect) + if game_state == 'game_over': + score_surface = game_font.render(f'Score: {int(score)}',True,(255,255,255)) + score_rect = score_surface.get_rect(center = (216,100)) + screen.blit(score_surface,score_rect) + + high_score_surface = game_font.render(f'High Score: {int(high_score)}',True,(255,255,255)) + high_score_rect = high_score_surface.get_rect(center = (216,630)) + screen.blit(high_score_surface,high_score_rect) +def update_score(score,high_score): + if score > high_score: + high_score = score + return high_score +pygame.mixer.pre_init(frequency=44100, size=-16, channels=2, buffer=512) +pygame.init() +screen= pygame.display.set_mode((432,768)) +clock = pygame.time.Clock() +game_font = pygame.font.Font('04B_19.ttf',35) +#Tạo các biến cho trò chơi +gravity = 0.25 +bird_movement = 0 +game_active = True +score = 0 +high_score = 0 +#chèn background +bg = pygame.image.load('assets/background-night.png').convert() +bg = pygame.transform.scale2x(bg) +#chèn sàn +floor = pygame.image.load('assets/floor.png').convert() +floor = pygame.transform.scale2x(floor) +floor_x_pos = 0 +#tạo chim +bird_down = pygame.transform.scale2x(pygame.image.load('assets/yellowbird-downflap.png').convert_alpha()) +bird_mid = pygame.transform.scale2x(pygame.image.load('assets/yellowbird-midflap.png').convert_alpha()) +bird_up = pygame.transform.scale2x(pygame.image.load('assets/yellowbird-upflap.png').convert_alpha()) +bird_list= [bird_down,bird_mid,bird_up] #0 1 2 +bird_index = 0 +bird = bird_list[bird_index] +#bird= pygame.image.load('assets/yellowbird-midflap.png').convert_alpha() +#bird = pygame.transform.scale2x(bird) +bird_rect = bird.get_rect(center = (100,384)) + +#tạo timer cho bird +birdflap = pygame.USEREVENT + 1 +pygame.time.set_timer(birdflap,200) +#tạo ống +pipe_surface = pygame.image.load('assets/pipe-green.png').convert() +pipe_surface = pygame.transform.scale2x(pipe_surface) +pipe_list =[] +#tạo timer +spawnpipe= pygame.USEREVENT +pygame.time.set_timer(spawnpipe, 1200) +pipe_height = [200,300,400] +#Tạo màn hình kết thúc +game_over_surface = pygame.transform.scale2x(pygame.image.load('assets/message.png').convert_alpha()) +game_over_rect = game_over_surface.get_rect(center=(216,384)) +#Chèn âm thanh +flap_sound = pygame.mixer.Sound('sound/sfx_wing.wav') +hit_sound = pygame.mixer.Sound('sound/sfx_hit.wav') +score_sound = pygame.mixer.Sound('sound/sfx_point.wav') +score_sound_countdown = 100 +#while loop của trò chơi +while True: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + pygame.quit() + sys.exit() + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_SPACE and game_active: + bird_movement = 0 + bird_movement =-11 + flap_sound.play() + if event.key == pygame.K_SPACE and game_active==False: + game_active = True + pipe_list.clear() + bird_rect.center = (100,384) + bird_movement = 0 + score = 0 + if event.type == spawnpipe: + pipe_list.extend(create_pipe()) + if event.type == birdflap: + if bird_index < 2: + bird_index += 1 + else: + bird_index =0 + bird, bird_rect = bird_animation() + + screen.blit(bg,(0,0)) + if game_active: + #chim + bird_movement += gravity + rotated_bird = rotate_bird(bird) + bird_rect.centery += bird_movement + screen.blit(rotated_bird,bird_rect) + game_active= check_collision(pipe_list) + #ống + pipe_list = move_pipe(pipe_list) + draw_pipe(pipe_list) + score += 0.01 + score_display('main game') + score_sound_countdown -= 1 + if score_sound_countdown <= 0: + score_sound.play() + score_sound_countdown = 100 + else: + screen.blit(game_over_surface,game_over_rect) + high_score = update_score(score,high_score) + score_display('game_over') + #sàn + floor_x_pos -= 1 + draw_floor() + if floor_x_pos <= -432: + floor_x_pos =0 + + pygame.display.update() + clock.tick(120) diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_die.wav b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_die.wav new file mode 100644 index 00000000..f35882bd Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_die.wav differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_hit.wav b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_hit.wav new file mode 100644 index 00000000..1533ab42 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_hit.wav differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_point.wav b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_point.wav new file mode 100644 index 00000000..f0bbd419 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_point.wav differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_swooshing.wav b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_swooshing.wav new file mode 100644 index 00000000..d6105219 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_swooshing.wav differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_wing.wav b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_wing.wav new file mode 100644 index 00000000..92cbc067 Binary files /dev/null and b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/5_Flappy_Bird/sound/sfx_wing.wav differ diff --git a/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/README.md b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/README.md new file mode 100644 index 00000000..5ee2932d --- /dev/null +++ b/brython-snake-master/brython-snake-master/Python_Games-main/Python_Games-main/README.md @@ -0,0 +1,7 @@ +# Python_Games + +- [1. Fruit Shooter Game](./1_Fruit_Shooter) +- [2. Mario Bounty Hunter](./2_Mario_Bounty_Hunter) +- [3. Google Translate](./3_Google_Translate) +- [4. Among Us](./4_Among_Us) +- [5. Flappy Bird](./5_Flappy_Bird) diff --git a/brython-snake-master/brython-snake-master/brython.html b/brython-snake-master/brython-snake-master/brython.html index 486147c6..2ed7bba0 100644 --- a/brython-snake-master/brython-snake-master/brython.html +++ b/brython-snake-master/brython-snake-master/brython.html @@ -82,92 +82,164 @@