您现在的位置是:网站首页> 编程资料编程资料
Python+Pygame实现海洋之神大冒险游戏_python_
2023-05-25
387人已围观
简介 Python+Pygame实现海洋之神大冒险游戏_python_
利用pygame自制小游戏。
海洋之神在漆黑的海底深处,利用自身的光勇敢前进!在海里收集鱼骨头,有些鱼骨头可以转化为武器,用来攻击敌人。
开始:

游戏开始的界面:

快通关啦!

结尾致敬超级马里奥,碰到小蘑菇就可以去下一关冒险!

海底背景自己画的,按钮图案自己画的,通关蘑菇自己画的。
特效代码
import pygame import random import sys import time pygame.init() clock = pygame.time.Clock() win = pygame.display.set_mode((800, 600)) pygame.display.set_caption("Particles") particles = [] colors = [(255, 255,250), (235, 65, 54), (255, 69, 0)] class Particle(): def __init__(self, x, y, xvel, yvel, radius, color, gravity=None): self.x = x self.y = y self.xvel = xvel self.yvel = yvel self.radius = radius self.color = color self.gravity = gravity def render(self, win): self.x += self.xvel self.y += self.yvel if self.gravity != None: self.yvel += self.gravity self.radius -= 0.1 pygame.draw.circle(win, self.color, (self.x, self.y), self.radius) def DrawParticles(): for particle in particles: particle.render(win) if particle.radius <= 0: particles.remove(particle) while True: clock.tick(60) for event in pygame.event.get(): pos = pygame.mouse.get_pos() if event.type == pygame.QUIT: pygame.quit() sys.exit(0) for x in range(random.randint(5, 20)): particle = Particle(pos[0], pos[1], random.randint(-100, 0) / 10, random.randint(1, 3), random.randint(2, 5), random.choice(colors)) particles.append(particle) win.fill((0, 0, 0)) DrawParticles() pygame.display.update()Credits:
游戏主角形象 :Cute Girl - Free Sprites | OpenGameArt.org
地图编辑器参考:https://github.com/russs123/LevelEditor
Fish Pack:
Gunner - Animated Character by Secret Hideout
Fantasy Game Music | Soundimage.org
Bullet Whizzing By Sounds | Effects | Sound Bites | Sound Clips from SoundBible.com
以上就是Python+Pygame实现海洋之神大冒险游戏的详细内容,更多关于Python Pygame游戏的资料请关注其它相关文章!
您可能感兴趣的文章:
相关内容
- Python实现检测照片中的人脸数_python_
- 如何使用Python实现名片管理系统_python_
- Python语言中的Selenium环境搭建_python_
- Python中寻找数据异常值的3种方法_python_
- 一文详解Python中的Map,Filter和Reduce函数_python_
- NumPy对数组按索引查询实战方法总结_python_
- Python numpy下几种fft函数的使用方式_python_
- Python如何提取csv数据并筛选指定条件数据详解_python_
- Python实现格式化输出的实例详解_python_
- 一文详解凯撒密码的原理及Python实现_python_
