diff --git a/Plane_Fighting/README.md b/Plane_Fighting/README.md deleted file mode 100644 index 2e4232f..0000000 --- a/Plane_Fighting/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Plane Fighting (plane_fighting) -## 简介 -一个跨平台的简易"飞机大战"小游戏 -## 支持 -基于Python & PyGame 运行 -可通过 Buildozer 打包为移动应用 -## 协议 -图标库(./images/)来自 IconFont -音效库(./sound/)来自网络 -字体库(./font)来自 Ubuntu -相应的版权归作者所有 -本目录中其他所有的源代码文件根据 GPL 3.0 协议开源 \ No newline at end of file diff --git a/Plane_Fighting/buildozer.spec b/Plane_Fighting/buildozer.spec deleted file mode 100644 index 665c3ea..0000000 --- a/Plane_Fighting/buildozer.spec +++ /dev/null @@ -1,427 +0,0 @@ -[app] - -# (str) Title of your application -title = Plane Fighting - -# (str) Package name -package.name = plane_fighting - -# (str) Package domain (needed for android/ios packaging) -package.domain = ga.imwangzhiyu - -# (str) Source code where the main.py live -source.dir = . - -# (list) Source files to include (let empty to include all the files) -source.include_exts = py,png,ogg,wav,ttf,dat - -# (list) List of inclusions using pattern matching -source.include_patterns = font/*,sound/*,images/*,record.dat - -# (list) Source files to exclude (let empty to not exclude anything) -#source.exclude_exts = spec - -# (list) List of directory to exclude (let empty to not exclude anything) -#source.exclude_dirs = tests, bin, venv - -# (list) List of exclusions using pattern matching -# Do not prefix with './' -#source.exclude_patterns = license,images/*/*.jpg - -# (str) Application versioning (method 1) -version = 0.1 - -# (str) Application versioning (method 2) -# version.regex = __version__ = ['"](.*)['"] -# version.filename = %(source.dir)s/main.py - -# (list) Application requirements -# comma separated e.g. requirements = sqlite3,kivy -requirements = python3,pygame - -# (str) Custom source folders for requirements -# Sets custom source for any requirements with recipes -# requirements.source.kivy = ../../kivy - -# (str) Presplash of the application -#presplash.filename = %(source.dir)s/data/presplash.png - -# (str) Icon of the application -icon.filename = %(source.dir)s/images/icon.png - -# (str) Supported orientation (one of landscape, sensorLandscape, portrait or all) -orientation = portrait - -# (list) List of service to declare -#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY - -# -# OSX Specific -# - -# -# author = © Copyright Info - -# change the major version of python used by the app -osx.python_version = 3 - -# Kivy version to use -osx.kivy_version = 1.9.1 - -# -# Android specific -# - -# (bool) Indicate if the application should be fullscreen or not -fullscreen = 0 - -# (string) Presplash background color (for android toolchain) -# Supported formats are: #RRGGBB #AARRGGBB or one of the following names: -# red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray, -# darkgray, grey, lightgrey, darkgrey, aqua, fuchsia, lime, maroon, navy, -# olive, purple, silver, teal. -#android.presplash_color = #FFFFFF - -# (string) Presplash animation using Lottie format. -# see https://lottiefiles.com/ for examples and https://airbnb.design/lottie/ -# for general documentation. -# Lottie files can be created using various tools, like Adobe After Effect or Synfig. -#android.presplash_lottie = "path/to/lottie/file.json" - -# (str) Adaptive icon of the application (used if Android API level is 26+ at runtime) -#icon.adaptive_foreground.filename = %(source.dir)s/data/icon_fg.png -#icon.adaptive_background.filename = %(source.dir)s/data/icon_bg.png - -# (list) Permissions -#android.permissions = INTERNET - -# (list) features (adds uses-feature -tags to manifest) -#android.features = android.hardware.usb.host - -# (int) Target Android API, should be as high as possible. -#android.api = 27 - -# (int) Minimum API your APK / AAB will support. -#android.minapi = 21 - -# (int) Android SDK version to use -#android.sdk = 20 - -# (str) Android NDK version to use -#android.ndk = 19b - -# (int) Android NDK API to use. This is the minimum API your app will support, it should usually match android.minapi. -#android.ndk_api = 21 - -# (bool) Use --private data storage (True) or --dir public storage (False) -#android.private_storage = True - -# (str) Android NDK directory (if empty, it will be automatically downloaded.) -#android.ndk_path = - -# (str) Android SDK directory (if empty, it will be automatically downloaded.) -#android.sdk_path = - -# (str) ANT directory (if empty, it will be automatically downloaded.) -#android.ant_path = - -# (bool) If True, then skip trying to update the Android sdk -# This can be useful to avoid excess Internet downloads or save time -# when an update is due and you just want to test/build your package -# android.skip_update = False - -# (bool) If True, then automatically accept SDK license -# agreements. This is intended for automation only. If set to False, -# the default, you will be shown the license when first running -# buildozer. -# android.accept_sdk_license = False - -# (str) Android entry point, default is ok for Kivy-based app -#android.entrypoint = org.kivy.android.PythonActivity - -# (str) Full name including package path of the Java class that implements Android Activity -# use that parameter together with android.entrypoint to set custom Java class instead of PythonActivity -#android.activity_class_name = org.kivy.android.PythonActivity - -# (str) Extra xml to write directly inside the element of AndroidManifest.xml -# use that parameter to provide a filename from where to load your custom XML code -#android.extra_manifest_xml = ./src/android/extra_manifest.xml - -# (str) Extra xml to write directly inside the tag of AndroidManifest.xml -# use that parameter to provide a filename from where to load your custom XML arguments: -#android.extra_manifest_application_arguments = ./src/android/extra_manifest_application_arguments.xml - -# (str) Full name including package path of the Java class that implements Python Service -# use that parameter to set custom Java class instead of PythonService -#android.service_class_name = org.kivy.android.PythonService - -# (str) Android app theme, default is ok for Kivy-based app -# android.apptheme = "@android:style/Theme.NoTitleBar" - -# (list) Pattern to whitelist for the whole project -#android.whitelist = - -# (str) Path to a custom whitelist file -#android.whitelist_src = - -# (str) Path to a custom blacklist file -#android.blacklist_src = - -# (list) List of Java .jar files to add to the libs so that pyjnius can access -# their classes. Don't add jars that you do not need, since extra jars can slow -# down the build process. Allows wildcards matching, for example: -# OUYA-ODK/libs/*.jar -#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar - -# (list) List of Java files to add to the android project (can be java or a -# directory containing the files) -#android.add_src = - -# (list) Android AAR archives to add -#android.add_aars = - -# (list) Put these files or directories in the apk assets directory. -# Either form may be used, and assets need not be in 'source.include_exts'. -# 1) android.add_assets = source_asset_relative_path -# 2) android.add_assets = source_asset_path:destination_asset_relative_path -#android.add_assets = - -# (list) Gradle dependencies to add -#android.gradle_dependencies = - -# (bool) Enable AndroidX support. Enable when 'android.gradle_dependencies' -# contains an 'androidx' package, or any package from Kotlin source. -# android.enable_androidx requires android.api >= 28 -#android.enable_androidx = False - -# (list) add java compile options -# this can for example be necessary when importing certain java libraries using the 'android.gradle_dependencies' option -# see https://developer.android.com/studio/write/java8-support for further information -# android.add_compile_options = "sourceCompatibility = 1.8", "targetCompatibility = 1.8" - -# (list) Gradle repositories to add {can be necessary for some android.gradle_dependencies} -# please enclose in double quotes -# e.g. android.gradle_repositories = "maven { url 'https://kotlin.bintray.com/ktor' }" -#android.add_gradle_repositories = - -# (list) packaging options to add -# see https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html -# can be necessary to solve conflicts in gradle_dependencies -# please enclose in double quotes -# e.g. android.add_packaging_options = "exclude 'META-INF/common.kotlin_module'", "exclude 'META-INF/*.kotlin_module'" -#android.add_packaging_options = - -# (list) Java classes to add as activities to the manifest. -#android.add_activities = com.example.ExampleActivity - -# (str) OUYA Console category. Should be one of GAME or APP -# If you leave this blank, OUYA support will not be enabled -#android.ouya.category = GAME - -# (str) Filename of OUYA Console icon. It must be a 732x412 png image. -#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png - -# (str) XML file to include as an intent filters in tag -#android.manifest.intent_filters = - -# (str) launchMode to set for the main activity -#android.manifest.launch_mode = standard - -# (list) Android additional libraries to copy into libs/armeabi -#android.add_libs_armeabi = libs/android/*.so -#android.add_libs_armeabi_v7a = libs/android-v7/*.so -#android.add_libs_arm64_v8a = libs/android-v8/*.so -#android.add_libs_x86 = libs/android-x86/*.so -#android.add_libs_mips = libs/android-mips/*.so - -# (bool) Indicate whether the screen should stay on -# Don't forget to add the WAKE_LOCK permission if you set this to True -#android.wakelock = False - -# (list) Android application meta-data to set (key=value format) -#android.meta_data = - -# (list) Android library project to add (will be added in the -# project.properties automatically.) -#android.library_references = - -# (list) Android shared libraries which will be added to AndroidManifest.xml using tag -#android.uses_library = - -# (str) Android logcat filters to use -#android.logcat_filters = *:S python:D - -# (bool) Android logcat only display log for activity's pid -#android.logcat_pid_only = False - -# (str) Android additional adb arguments -#android.adb_args = -H host.docker.internal - -# (bool) Copy library instead of making a libpymodules.so -#android.copy_libs = 1 - -# (list) The Android archs to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64 -# In past, was `android.arch` as we weren't supporting builds for multiple archs at the same time. -android.archs = arm64-v8a, armeabi-v7a - -# (int) overrides automatic versionCode computation (used in build.gradle) -# this is not the same as app version and should only be edited if you know what you're doing -# android.numeric_version = 1 - -# (bool) enables Android auto backup feature (Android API >=23) -android.allow_backup = True - -# (str) XML file for custom backup rules (see official auto backup documentation) -# android.backup_rules = - -# (str) If you need to insert variables into your AndroidManifest.xml file, -# you can do so with the manifestPlaceholders property. -# This property takes a map of key-value pairs. (via a string) -# Usage example : android.manifest_placeholders = [myCustomUrl:\"org.kivy.customurl\"] -# android.manifest_placeholders = [:] - -# (bool) disables the compilation of py to pyc/pyo files when packaging -# android.no-compile-pyo = True - -# (str) The format used to package the app for release mode (aab or apk). -# android.release_artifact = aab - -# -# Python for android (p4a) specific -# - -# (str) python-for-android URL to use for checkout -#p4a.url = - -# (str) python-for-android fork to use in case if p4a.url is not specified, defaults to upstream (kivy) -#p4a.fork = kivy - -# (str) python-for-android branch to use, defaults to master -#p4a.branch = master - -# (str) python-for-android specific commit to use, defaults to HEAD, must be within p4a.branch -#p4a.commit = HEAD - -# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github) -#p4a.source_dir = - -# (str) The directory in which python-for-android should look for your own build recipes (if any) -#p4a.local_recipes = - -# (str) Filename to the hook for p4a -#p4a.hook = - -# (str) Bootstrap to use for android builds -# p4a.bootstrap = sdl2 - -# (int) port number to specify an explicit --port= p4a argument (eg for bootstrap flask) -#p4a.port = - -# Control passing the --use-setup-py vs --ignore-setup-py to p4a -# "in the future" --use-setup-py is going to be the default behaviour in p4a, right now it is not -# Setting this to false will pass --ignore-setup-py, true will pass --use-setup-py -# NOTE: this is general setuptools integration, having pyproject.toml is enough, no need to generate -# setup.py if you're using Poetry, but you need to add "toml" to source.include_exts. -#p4a.setup_py = false - -# (str) extra command line arguments to pass when invoking pythonforandroid.toolchain -#p4a.extra_args = - - -# -# iOS specific -# - -# (str) Path to a custom kivy-ios folder -#ios.kivy_ios_dir = ../kivy-ios -# Alternately, specify the URL and branch of a git checkout: -ios.kivy_ios_url = https://github.com/kivy/kivy-ios -ios.kivy_ios_branch = master - -# Another platform dependency: ios-deploy -# Uncomment to use a custom checkout -#ios.ios_deploy_dir = ../ios_deploy -# Or specify URL and branch -ios.ios_deploy_url = https://github.com/phonegap/ios-deploy -ios.ios_deploy_branch = 1.10.0 - -# (bool) Whether or not to sign the code -ios.codesign.allowed = false - -# (str) Name of the certificate to use for signing the debug version -# Get a list of available identities: buildozer ios list_identities -#ios.codesign.debug = "iPhone Developer: ()" - -# (str) The development team to use for signing the debug version -#ios.codesign.development_team.debug = - -# (str) Name of the certificate to use for signing the release version -#ios.codesign.release = %(ios.codesign.debug)s - -# (str) The development team to use for signing the release version -#ios.codesign.development_team.release = - -# (str) URL pointing to .ipa file to be installed -# This option should be defined along with `display_image_url` and `full_size_image_url` options. -#ios.manifest.app_url = - -# (str) URL pointing to an icon (57x57px) to be displayed during download -# This option should be defined along with `app_url` and `full_size_image_url` options. -#ios.manifest.display_image_url = - -# (str) URL pointing to a large icon (512x512px) to be used by iTunes -# This option should be defined along with `app_url` and `display_image_url` options. -#ios.manifest.full_size_image_url = - - -[buildozer] - -# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output)) -log_level = 2 - -# (int) Display warning if buildozer is run as root (0 = False, 1 = True) -warn_on_root = 1 - -# (str) Path to build artifact storage, absolute or relative to spec file -# build_dir = ./.buildozer - -# (str) Path to build output (i.e. .apk, .aab, .ipa) storage -# bin_dir = ./bin - -# ----------------------------------------------------------------------------- -# List as sections -# -# You can define all the "list" as [section:key]. -# Each line will be considered as a option to the list. -# Let's take [app] / source.exclude_patterns. -# Instead of doing: -# -#[app] -#source.exclude_patterns = license,data/audio/*.wav,data/images/original/* -# -# This can be translated into: -# -#[app:source.exclude_patterns] -#license -#data/audio/*.wav -#data/images/original/* -# - - -# ----------------------------------------------------------------------------- -# Profiles -# -# You can extend section / key with a profile -# For example, you want to deploy a demo version of your application without -# HD content. You could first change the title to add "(demo)" in the name -# and extend the excluded directories to remove the HD content. -# -#[app@demo] -#title = My Application (demo) -# -#[app:source.exclude_patterns@demo] -#images/hd/* -# -# Then, invoke the command line with the "demo" profile: -# -#buildozer --profile demo android debug diff --git a/Plane_Fighting/bullet.py b/Plane_Fighting/bullet.py deleted file mode 100644 index eeb6641..0000000 --- a/Plane_Fighting/bullet.py +++ /dev/null @@ -1,45 +0,0 @@ -import pygame,os - -abspath = os.getcwd() + "/" -class Bullet1(pygame.sprite.Sprite): - def __init__(self, position): - pygame.sprite.Sprite.__init__(self) - - self.image = pygame.image.load(abspath + "images/bullet1.png").convert_alpha() - self.rect = self.image.get_rect() - self.rect.left, self.rect.top = position - self.speed = 11 - self.active = False - self.mask = pygame.mask.from_surface(self.image) - - def move(self): - self.rect.top -= self.speed - - if self.rect.top < 0: - self.active = False - - def reset(self, position): - self.rect.left, self.rect.top = position - self.active = True - -class Bullet2(pygame.sprite.Sprite): - def __init__(self, position): - pygame.sprite.Sprite.__init__(self) - - self.image = pygame.image.load(abspath + "images/bullet2.png").convert_alpha() - self.rect = self.image.get_rect() - self.rect.left, self.rect.top = position - self.speed = 14#14 - self.active = False - self.mask = pygame.mask.from_surface(self.image) - - def move(self): - self.rect.top -= self.speed - - if self.rect.top < 0: - self.active = False - - def reset(self, position): - self.rect.left, self.rect.top = position - self.active = True - diff --git a/Plane_Fighting/enemy.py b/Plane_Fighting/enemy.py deleted file mode 100644 index 1ab4d9b..0000000 --- a/Plane_Fighting/enemy.py +++ /dev/null @@ -1,118 +0,0 @@ -import pygame,os -from random import * -abspath = os.getcwd() + "/" -class SmallEnemy(pygame.sprite.Sprite): - def __init__(self, bg_size): - pygame.sprite.Sprite.__init__(self) - - self.image = pygame.image.load(abspath + "images/enemy1.png").convert_alpha() - self.destroy_images = [] - self.destroy_images.extend([\ - pygame.image.load(abspath + "images/enemy1_down1.png").convert_alpha(), \ - pygame.image.load(abspath + "images/enemy1_down2.png").convert_alpha(), \ - pygame.image.load(abspath + "images/enemy1_down3.png").convert_alpha(), \ - pygame.image.load(abspath + "images/enemy1_down4.png").convert_alpha() \ - ]) - self.rect = self.image.get_rect() - self.width, self.height = bg_size[0], bg_size[1] - self.speed = 2 - self.active = True - self.rect.left, self.rect.top = \ - randint(0, self.width - self.rect.width), \ - randint(-5 * self.height, 0) - self.mask = pygame.mask.from_surface(self.image) - - def move(self): - if self.rect.top < self.height: - self.rect.top += self.speed - else: - self.reset() - - def reset(self): - self.active = True - self.rect.left, self.rect.top = \ - randint(0, self.width - self.rect.width), \ - randint(-5 * self.height, 0) - - -class MidEnemy(pygame.sprite.Sprite): - energy = 8 - - def __init__(self, bg_size): - pygame.sprite.Sprite.__init__(self) - - self.image = pygame.image.load(abspath + "images/enemy2.png").convert_alpha() - self.image_hit = pygame.image.load(abspath + "images/enemy2_hit.png").convert_alpha() - self.destroy_images = [] - self.destroy_images.extend([\ - pygame.image.load(abspath + "images/enemy2_down1.png").convert_alpha(), \ - pygame.image.load(abspath + "images/enemy2_down2.png").convert_alpha(), \ - pygame.image.load(abspath + "images/enemy2_down3.png").convert_alpha(), \ - pygame.image.load(abspath + "images/enemy2_down4.png").convert_alpha() \ - ]) - self.rect = self.image.get_rect() - self.width, self.height = bg_size[0], bg_size[1] - self.speed = 1 - self.active = True - self.rect.left, self.rect.top = \ - randint(0, self.width - self.rect.width), \ - randint(-10 * self.height, -self.height) - self.mask = pygame.mask.from_surface(self.image) - self.energy = MidEnemy.energy - self.hit = False - - def move(self): - if self.rect.top < self.height: - self.rect.top += self.speed - else: - self.reset() - - def reset(self): - self.active = True - self.energy = MidEnemy.energy - self.rect.left, self.rect.top = \ - randint(0, self.width - self.rect.width), \ - randint(-10 * self.height, -self.height) - - -class BigEnemy(pygame.sprite.Sprite): - energy = 20 - - def __init__(self, bg_size): - pygame.sprite.Sprite.__init__(self) - - self.image1 = pygame.image.load(abspath + "images/enemy3_n1.png").convert_alpha() - self.image2 = pygame.image.load(abspath + "images/enemy3_n2.png").convert_alpha() - self.image_hit = pygame.image.load(abspath + "images/enemy3_hit.png").convert_alpha() - self.destroy_images = [] - self.destroy_images.extend([\ - pygame.image.load(abspath + "images/enemy3_down1.png").convert_alpha(), \ - pygame.image.load(abspath + "images/enemy3_down2.png").convert_alpha(), \ - pygame.image.load(abspath + "images/enemy3_down3.png").convert_alpha(), \ - pygame.image.load(abspath + "images/enemy3_down4.png").convert_alpha(), \ - pygame.image.load(abspath + "images/enemy3_down5.png").convert_alpha(), \ - pygame.image.load(abspath + "images/enemy3_down6.png").convert_alpha() \ - ]) - self.rect = self.image1.get_rect() - self.width, self.height = bg_size[0], bg_size[1] - self.speed = 1 - self.active = True - self.rect.left, self.rect.top = \ - randint(0, self.width - self.rect.width), \ - randint(-15 * self.height, -5 * self.height) - self.mask = pygame.mask.from_surface(self.image1) - self.energy = BigEnemy.energy - self.hit = False - - def move(self): - if self.rect.top < self.height: - self.rect.top += self.speed - else: - self.reset() - - def reset(self): - self.active = True - self.energy = BigEnemy.energy - self.rect.left, self.rect.top = \ - randint(0, self.width - self.rect.width), \ - randint(-15 * self.height, -5 * self.height) diff --git a/Plane_Fighting/font/font-2.ttf b/Plane_Fighting/font/font-2.ttf deleted file mode 100644 index ed0f5bc..0000000 Binary files a/Plane_Fighting/font/font-2.ttf and /dev/null differ diff --git a/Plane_Fighting/font/font.ttf b/Plane_Fighting/font/font.ttf deleted file mode 100644 index b173da2..0000000 Binary files a/Plane_Fighting/font/font.ttf and /dev/null differ diff --git a/Plane_Fighting/images/again.png b/Plane_Fighting/images/again.png deleted file mode 100644 index cbcc54d..0000000 Binary files a/Plane_Fighting/images/again.png and /dev/null differ diff --git a/Plane_Fighting/images/background.png b/Plane_Fighting/images/background.png deleted file mode 100644 index 2197c0f..0000000 Binary files a/Plane_Fighting/images/background.png and /dev/null differ diff --git a/Plane_Fighting/images/bomb.png b/Plane_Fighting/images/bomb.png deleted file mode 100644 index 1c92d5b..0000000 Binary files a/Plane_Fighting/images/bomb.png and /dev/null differ diff --git a/Plane_Fighting/images/bomb_supply.png b/Plane_Fighting/images/bomb_supply.png deleted file mode 100644 index 07f242b..0000000 Binary files a/Plane_Fighting/images/bomb_supply.png and /dev/null differ diff --git a/Plane_Fighting/images/bullet1.png b/Plane_Fighting/images/bullet1.png deleted file mode 100644 index 9b575e3..0000000 Binary files a/Plane_Fighting/images/bullet1.png and /dev/null differ diff --git a/Plane_Fighting/images/bullet2.png b/Plane_Fighting/images/bullet2.png deleted file mode 100644 index 43e3246..0000000 Binary files a/Plane_Fighting/images/bullet2.png and /dev/null differ diff --git a/Plane_Fighting/images/bullet_supply.png b/Plane_Fighting/images/bullet_supply.png deleted file mode 100644 index 9c51e82..0000000 Binary files a/Plane_Fighting/images/bullet_supply.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy1.png b/Plane_Fighting/images/enemy1.png deleted file mode 100644 index 51cfce7..0000000 Binary files a/Plane_Fighting/images/enemy1.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy1_down1.png b/Plane_Fighting/images/enemy1_down1.png deleted file mode 100644 index 95e211b..0000000 Binary files a/Plane_Fighting/images/enemy1_down1.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy1_down2.png b/Plane_Fighting/images/enemy1_down2.png deleted file mode 100644 index 508b769..0000000 Binary files a/Plane_Fighting/images/enemy1_down2.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy1_down3.png b/Plane_Fighting/images/enemy1_down3.png deleted file mode 100644 index 3c4630c..0000000 Binary files a/Plane_Fighting/images/enemy1_down3.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy1_down4.png b/Plane_Fighting/images/enemy1_down4.png deleted file mode 100644 index e7aebbf..0000000 Binary files a/Plane_Fighting/images/enemy1_down4.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy2.png b/Plane_Fighting/images/enemy2.png deleted file mode 100644 index 7f7e68d..0000000 Binary files a/Plane_Fighting/images/enemy2.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy2_down1.png b/Plane_Fighting/images/enemy2_down1.png deleted file mode 100644 index f7c68de..0000000 Binary files a/Plane_Fighting/images/enemy2_down1.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy2_down2.png b/Plane_Fighting/images/enemy2_down2.png deleted file mode 100644 index 8a72aca..0000000 Binary files a/Plane_Fighting/images/enemy2_down2.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy2_down3.png b/Plane_Fighting/images/enemy2_down3.png deleted file mode 100644 index e510526..0000000 Binary files a/Plane_Fighting/images/enemy2_down3.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy2_down4.png b/Plane_Fighting/images/enemy2_down4.png deleted file mode 100644 index 2031b6c..0000000 Binary files a/Plane_Fighting/images/enemy2_down4.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy2_hit.png b/Plane_Fighting/images/enemy2_hit.png deleted file mode 100644 index 9f4d8c3..0000000 Binary files a/Plane_Fighting/images/enemy2_hit.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy3_down1.png b/Plane_Fighting/images/enemy3_down1.png deleted file mode 100644 index 3e7469c..0000000 Binary files a/Plane_Fighting/images/enemy3_down1.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy3_down2.png b/Plane_Fighting/images/enemy3_down2.png deleted file mode 100644 index 3e7469c..0000000 Binary files a/Plane_Fighting/images/enemy3_down2.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy3_down3.png b/Plane_Fighting/images/enemy3_down3.png deleted file mode 100644 index 3e7469c..0000000 Binary files a/Plane_Fighting/images/enemy3_down3.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy3_down4.png b/Plane_Fighting/images/enemy3_down4.png deleted file mode 100644 index 3e7469c..0000000 Binary files a/Plane_Fighting/images/enemy3_down4.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy3_down5.png b/Plane_Fighting/images/enemy3_down5.png deleted file mode 100644 index 1a6d711..0000000 Binary files a/Plane_Fighting/images/enemy3_down5.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy3_down6.png b/Plane_Fighting/images/enemy3_down6.png deleted file mode 100644 index 3e7469c..0000000 Binary files a/Plane_Fighting/images/enemy3_down6.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy3_hit.png b/Plane_Fighting/images/enemy3_hit.png deleted file mode 100644 index 3e7469c..0000000 Binary files a/Plane_Fighting/images/enemy3_hit.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy3_n1.png b/Plane_Fighting/images/enemy3_n1.png deleted file mode 100644 index 0e8bfc9..0000000 Binary files a/Plane_Fighting/images/enemy3_n1.png and /dev/null differ diff --git a/Plane_Fighting/images/enemy3_n2.png b/Plane_Fighting/images/enemy3_n2.png deleted file mode 100644 index 0e8bfc9..0000000 Binary files a/Plane_Fighting/images/enemy3_n2.png and /dev/null differ diff --git a/Plane_Fighting/images/gameover.png b/Plane_Fighting/images/gameover.png deleted file mode 100644 index 09d2df5..0000000 Binary files a/Plane_Fighting/images/gameover.png and /dev/null differ diff --git a/Plane_Fighting/images/icon.png b/Plane_Fighting/images/icon.png deleted file mode 100644 index 6059812..0000000 Binary files a/Plane_Fighting/images/icon.png and /dev/null differ diff --git a/Plane_Fighting/images/life.png b/Plane_Fighting/images/life.png deleted file mode 100644 index d759806..0000000 Binary files a/Plane_Fighting/images/life.png and /dev/null differ diff --git a/Plane_Fighting/images/loading.png b/Plane_Fighting/images/loading.png deleted file mode 100644 index 9b6d9c5..0000000 Binary files a/Plane_Fighting/images/loading.png and /dev/null differ diff --git a/Plane_Fighting/images/me1.png b/Plane_Fighting/images/me1.png deleted file mode 100644 index b28bf94..0000000 Binary files a/Plane_Fighting/images/me1.png and /dev/null differ diff --git a/Plane_Fighting/images/me2.png b/Plane_Fighting/images/me2.png deleted file mode 100644 index f971015..0000000 Binary files a/Plane_Fighting/images/me2.png and /dev/null differ diff --git a/Plane_Fighting/images/me_destroy_1.png b/Plane_Fighting/images/me_destroy_1.png deleted file mode 100644 index d46ad28..0000000 Binary files a/Plane_Fighting/images/me_destroy_1.png and /dev/null differ diff --git a/Plane_Fighting/images/me_destroy_2.png b/Plane_Fighting/images/me_destroy_2.png deleted file mode 100644 index a480bef..0000000 Binary files a/Plane_Fighting/images/me_destroy_2.png and /dev/null differ diff --git a/Plane_Fighting/images/me_destroy_3.png b/Plane_Fighting/images/me_destroy_3.png deleted file mode 100644 index e1908bd..0000000 Binary files a/Plane_Fighting/images/me_destroy_3.png and /dev/null differ diff --git a/Plane_Fighting/images/me_destroy_4.png b/Plane_Fighting/images/me_destroy_4.png deleted file mode 100644 index 446b4fb..0000000 Binary files a/Plane_Fighting/images/me_destroy_4.png and /dev/null differ diff --git a/Plane_Fighting/images/pause_nor.png b/Plane_Fighting/images/pause_nor.png deleted file mode 100644 index d2b9cc2..0000000 Binary files a/Plane_Fighting/images/pause_nor.png and /dev/null differ diff --git a/Plane_Fighting/images/pause_pressed.png b/Plane_Fighting/images/pause_pressed.png deleted file mode 100644 index 8df8d2d..0000000 Binary files a/Plane_Fighting/images/pause_pressed.png and /dev/null differ diff --git a/Plane_Fighting/images/resume_nor.png b/Plane_Fighting/images/resume_nor.png deleted file mode 100644 index 19a185e..0000000 Binary files a/Plane_Fighting/images/resume_nor.png and /dev/null differ diff --git a/Plane_Fighting/images/resume_pressed.png b/Plane_Fighting/images/resume_pressed.png deleted file mode 100644 index 3bfc993..0000000 Binary files a/Plane_Fighting/images/resume_pressed.png and /dev/null differ diff --git a/Plane_Fighting/main.py b/Plane_Fighting/main.py deleted file mode 100644 index 9716a85..0000000 --- a/Plane_Fighting/main.py +++ /dev/null @@ -1,603 +0,0 @@ -# main.py -import pygame -import sys -import traceback -import myplane -import enemy -import bullet -import supply -import time -import os - -abspath = os.getcwd() + "/" -from pygame.locals import * -from random import * -jj = 0 -pygame.init() -pygame.mixer.init() - -bg_size = width, height = 480, 700 -screen = pygame.display.set_mode(bg_size) -pygame.display.set_caption("Plane Fighting") -key_pressed = pygame.key.get_pressed() -background=pygame.image.load(abspath + "images/loading.png") #图片位置 -screen.blit(background,(0,0)) #对齐的坐标 -pygame.display.update() #显示内容 -pygame.mixer.music.load(abspath + "sound/game_music.ogg") -pygame.mixer.music.set_volume(0.1) -pygame.mixer.music.play(-1) -time.sleep(7.5) -background = pygame.image.load(abspath + "images/background.png").convert() -BLACK = (0, 0, 0) -WHITE = (255, 255, 255) -GREEN = (0, 255, 0) -RED = (255, 0, 0) - -# 载入游戏音乐 -bullet_sound = pygame.mixer.Sound(abspath + "sound/bullet.wav") -bullet_sound.set_volume(0.2) -bomb_sound = pygame.mixer.Sound(abspath + "sound/use_bomb.wav") -bomb_sound.set_volume(0.2) -supply_sound = pygame.mixer.Sound(abspath + "sound/supply.wav") -supply_sound.set_volume(0.2) -get_bomb_sound = pygame.mixer.Sound(abspath + "sound/get_bomb.wav") -get_bomb_sound.set_volume(0.2) -get_bullet_sound = pygame.mixer.Sound(abspath + "sound/get_bullet.wav") -get_bullet_sound.set_volume(0.2) -upgrade_sound = pygame.mixer.Sound(abspath + "sound/upgrade.wav") -upgrade_sound.set_volume(0.2) -enemy3_fly_sound = pygame.mixer.Sound(abspath + "sound/enemy3_flying.wav") -enemy3_fly_sound.set_volume(0.2) -enemy1_down_sound = pygame.mixer.Sound(abspath + "sound/enemy1_down.wav") -enemy1_down_sound.set_volume(0.2) -enemy2_down_sound = pygame.mixer.Sound(abspath + "sound/enemy2_down.wav") -enemy2_down_sound.set_volume(0.2) -enemy3_down_sound = pygame.mixer.Sound(abspath + "sound/enemy3_down.wav") -enemy3_down_sound.set_volume(0.5) -me_down_sound = pygame.mixer.Sound(abspath + "sound/me_down.wav") - - - -def add_small_enemies(group1, group2, num): - for i in range(num): - e1 = enemy.SmallEnemy(bg_size) - group1.add(e1) - group2.add(e1) - -def add_mid_enemies(group1, group2, num): - for i in range(num): - e2 = enemy.MidEnemy(bg_size) - group1.add(e2) - group2.add(e2) - -def add_big_enemies(group1, group2, num): - for i in range(num): - e3 = enemy.BigEnemy(bg_size) - group1.add(e3) - group2.add(e3) - -def inc_speed(target, inc): - for each in target: - each.speed += inc - -def main(): - # Me - me = myplane.MyPlane(bg_size) - - enemies = pygame.sprite.Group() - - - # Enemy Level 1 - small_enemies = pygame.sprite.Group() - add_small_enemies(small_enemies, enemies, 15) - - # Enemy Level 2 - mid_enemies = pygame.sprite.Group() - add_mid_enemies(mid_enemies, enemies, 4) - - # Enemy Level 3 - big_enemies = pygame.sprite.Group() - add_big_enemies(big_enemies, enemies, 2) - - # Common Bull - bullet1 = [] - bullet1_index = 0 - BULLET1_NUM = 4 - for i in range(BULLET1_NUM): - bullet1.append(bullet.Bullet1((me.rect.centerx-3, me.rect.centery))) - - # Super Bull - bullet2 = [] - bullet2_index = 0 - BULLET2_NUM = 8 - for i in range(BULLET2_NUM//2): - bullet2.append(bullet.Bullet2((me.rect.centerx-33, me.rect.centery))) - bullet2.append(bullet.Bullet2((me.rect.centerx+30, me.rect.centery))) - - clock = pygame.time.Clock() - - # 中弹图片索引 - e1_destroy_index = 0 - e2_destroy_index = 0 - e3_destroy_index = 0 - me_destroy_index = 0 - - # 统计得分 - score = 0 - score_font = pygame.font.Font(abspath + "font/font.ttf", 36) - - # 标志是否暂停游戏 - paused = False - pause_nor_image = pygame.image.load(abspath + "images/pause_nor.png").convert_alpha() - pause_pressed_image = pygame.image.load(abspath + "images/pause_pressed.png").convert_alpha() - resume_nor_image = pygame.image.load(abspath + "images/resume_nor.png").convert_alpha() - resume_pressed_image = pygame.image.load(abspath + "images/resume_pressed.png").convert_alpha() - paused_rect = pause_nor_image.get_rect() - paused_rect.left, paused_rect.top = width - paused_rect.width - 10, 10 - paused_image = pause_nor_image - - # 设置难度级别 - level = 1 - - # 全屏炸弹 - bomb_image = pygame.image.load(abspath + "images/bomb.png").convert_alpha() - bomb_rect = bomb_image.get_rect() - bomb_font = pygame.font.Font(abspath + "font/font.ttf", 48) - bomb_num = 3 - - # 每30秒发放一个补给包 - bullet_supply = supply.Bullet_Supply(bg_size) - bomb_supply = supply.Bomb_Supply(bg_size) - SUPPLY_TIME = USEREVENT - pygame.time.set_timer(SUPPLY_TIME, 30 * 1000) - - # 超级子弹定时器 - DOUBLE_BULLET_TIME = USEREVENT + 1 - - # 标志是否使用超级子弹 - is_double_bullet = False - - # 解除我方无敌状态定时器 - INVINCIBLE_TIME = USEREVENT + 3 - - - # 生命数量 - life_num = 3 - life_image = pygame.image.load(abspath + "images/life.png").convert_alpha() - life_rect = life_image.get_rect() - - # 用于阻止重复打开记录文件 - recorded = False - - # 游戏结束画面 - gameover_font = pygame.font.Font(abspath + "font/font.ttf", 48) - again_image = pygame.image.load(abspath + "images/again.png").convert_alpha() - again_rect = again_image.get_rect() - gameover_image = pygame.image.load(abspath + "images/gameover.png").convert_alpha() - gameover_rect = gameover_image.get_rect() - - # 用于切换图片 - switch_image = True - - # 用于延迟 - delay = 100 - - running = True - - while running: - for event in pygame.event.get(): - if event.type == QUIT: - pygame.quit() - sys.exit() - - elif event.type == MOUSEBUTTONDOWN: - if event.button == 1 and paused_rect.collidepoint(event.pos): - paused = not paused - if paused: - pygame.time.set_timer(SUPPLY_TIME, 0) - pygame.mixer.music.pause() - pygame.mixer.pause() - else: - pygame.time.set_timer(SUPPLY_TIME, 30 * 1000) - pygame.mixer.music.unpause() - pygame.mixer.unpause() - - elif event.type == MOUSEMOTION: - if paused_rect.collidepoint(event.pos): - if paused: - paused_image = resume_pressed_image - else: - paused_image = pause_pressed_image - else: - if paused: - paused_image = resume_nor_image - else: - paused_image = pause_nor_image - - elif event.type == KEYDOWN: - if event.key == K_SPACE: - if bomb_num: - bomb_num -= 1 - bomb_sound.play() - for each in enemies: - if each.rect.bottom > 0: - each.active = False - - elif event.type == SUPPLY_TIME: - supply_sound.play() - if choice([True, False]): - bomb_supply.reset() - else: - bullet_supply.reset() - - elif event.type == DOUBLE_BULLET_TIME: - is_double_bullet = False - pygame.time.set_timer(DOUBLE_BULLET_TIME, 0) - - elif event.type == INVINCIBLE_TIME: - me.invincible = False - pygame.time.set_timer(INVINCIBLE_TIME, 0) - - - # 根据用户的得分增加难度 - if level == 1 and score > 50000: - level = 2 - upgrade_sound.play() - # 增加3架小型敌机、2架中型敌机和1架大型敌机 - add_small_enemies(small_enemies, enemies, 3) - add_mid_enemies(mid_enemies, enemies, 2) - add_big_enemies(big_enemies, enemies, 1) - # 提升小型敌机的速度 - inc_speed(small_enemies, 1) - elif level == 2 and score > 300000: - level = 3 - upgrade_sound.play() - # 增加5架小型敌机、3架中型敌机和2架大型敌机 - add_small_enemies(small_enemies, enemies, 5) - add_mid_enemies(mid_enemies, enemies, 3) - add_big_enemies(big_enemies, enemies, 2) - # 提升小型敌机的速度 - inc_speed(small_enemies, 1) - inc_speed(mid_enemies, 1) - elif level == 3 and score > 600000: - level = 4 - upgrade_sound.play() - # 增加5架小型敌机、3架中型敌机和2架大型敌机 - add_small_enemies(small_enemies, enemies, 5) - add_mid_enemies(mid_enemies, enemies, 3) - add_big_enemies(big_enemies, enemies, 2) - # 提升小型敌机的速度 - inc_speed(small_enemies, 1) - inc_speed(mid_enemies, 1) - elif level == 4 and score > 1000000: - level = 5 - upgrade_sound.play() - # 增加5架小型敌机、3架中型敌机和2架大型敌机 - add_small_enemies(small_enemies, enemies, 300) - - # 提升小型敌机的速度 - inc_speed(small_enemies, 1) - inc_speed(mid_enemies, 1) - - - screen.blit(background, (0, 0)) - - if life_num and not paused: - # 检测用户的键盘操作 - key_pressed = pygame.key.get_pressed() - - if key_pressed[K_w] or key_pressed[K_UP]: - me.moveUp() - elif key_pressed[K_s] or key_pressed[K_DOWN]: - me.moveDown() - elif key_pressed[K_a] or key_pressed[K_LEFT]: - me.moveLeft() - elif key_pressed[K_d] or key_pressed[K_RIGHT]: - me.moveRight() - elif key_pressed[K_F1]:#100核弹 - bomb_num = 100 - elif key_pressed[K_F2]:#不使用双子弹 - is_double_bullet = True - elif key_pressed[K_F3]:#使用双子弹 - is_double_bullet = False - elif key_pressed[K_F4]:#生命+1 - life_num += 1 - elif key_pressed[K_F5]:#小+1 - add_small_enemies(small_enemies, enemies, 100) - elif key_pressed[K_F6]:#中+1 - add_mid_enemies(mid_enemies, enemies, 100) - elif key_pressed[K_F7]:#大+1 - add_big_enemies(big_enemies, enemies, 100) - elif key_pressed[K_F8]: - level = 4 - score = 1000000 - - - - - # 绘制全屏炸弹补给并检测是否获得 - if bomb_supply.active: - bomb_supply.move() - screen.blit(bomb_supply.image, bomb_supply.rect) - if pygame.sprite.collide_mask(bomb_supply, me): - get_bomb_sound.play() - if bomb_num < 3: - bomb_num += 1 - bomb_supply.active = False - - # 绘制超级子弹补给并检测是否获得 - if bullet_supply.active: - bullet_supply.move() - screen.blit(bullet_supply.image, bullet_supply.rect) - if pygame.sprite.collide_mask(bullet_supply, me): - get_bullet_sound.play() - is_double_bullet = True - pygame.time.set_timer(DOUBLE_BULLET_TIME, 18 * 1000) - bullet_supply.active = False - - # 发射子弹 - if not(delay % 10): - bullet_sound.play() - if is_double_bullet: - bullets = bullet2 - bullets[bullet2_index].reset((me.rect.centerx-33, me.rect.centery)) - bullets[bullet2_index+1].reset((me.rect.centerx+30, me.rect.centery)) - bullet2_index = (bullet2_index + 2) % BULLET2_NUM - else: - bullets = bullet1 - bullets[bullet1_index].reset(me.rect.midtop) - bullet1_index = (bullet1_index + 1) % BULLET1_NUM - - - # 检测子弹是否击中敌机 - for b in bullets: - if b.active: - b.move() - screen.blit(b.image, b.rect) - enemy_hit = pygame.sprite.spritecollide(b, enemies, False, pygame.sprite.collide_mask) - if enemy_hit: - b.active = False - for e in enemy_hit: - if e in mid_enemies or e in big_enemies: - e.hit = True - e.energy -= 1 - if e.energy == 0: - e.active = False - else: - e.active = False - - # 绘制大型敌机 - for each in big_enemies: - if each.active: - each.move() - if each.hit: - screen.blit(each.image_hit, each.rect) - each.hit = False - else: - if switch_image: - screen.blit(each.image1, each.rect) - else: - screen.blit(each.image2, each.rect) - - # 绘制血槽 - pygame.draw.line(screen, BLACK, \ - (each.rect.left, each.rect.top - 5), \ - (each.rect.right, each.rect.top - 5), \ - 2) - # 当生命大于20%显示绿色,否则显示红色 - energy_remain = each.energy / enemy.BigEnemy.energy - if energy_remain > 0.2: - energy_color = GREEN - else: - energy_color = RED - pygame.draw.line(screen, energy_color, \ - (each.rect.left, each.rect.top - 5), \ - (each.rect.left + each.rect.width * energy_remain, \ - each.rect.top - 5), 2) - - # 即将出现在画面中,播放音效 - if each.rect.bottom == -50: - enemy3_fly_sound.play(-1) - else: - # 毁灭 - if not(delay % 3): - if e3_destroy_index == 0: - enemy3_down_sound.play() - screen.blit(each.destroy_images[e3_destroy_index], each.rect) - e3_destroy_index = (e3_destroy_index + 1) % 6 - if e3_destroy_index == 0: - enemy3_fly_sound.stop() - score += 10000 - each.reset() - - # 绘制中型敌机: - for each in mid_enemies: - if each.active: - each.move() - - if each.hit: - screen.blit(each.image_hit, each.rect) - each.hit = False - else: - screen.blit(each.image, each.rect) - - # 绘制血槽 - pygame.draw.line(screen, BLACK, \ - (each.rect.left, each.rect.top - 5), \ - (each.rect.right, each.rect.top - 5), \ - 2) - # 当生命大于20%显示绿色,否则显示红色 - lu = (0, 230, 0) - qiancheng = (115, 165, 0) - shencheng = (165, 115, 0) - hong = (230, 0, 0) - energy_remain = each.energy / enemy.MidEnemy.energy - if energy_remain > 0.75: - energy_color = lu - elif energy_remain > 0.50: - energy_color = qiancheng - elif energy_remain > 0.25: - energy_color = shencheng - else: - energy_color = hong - pygame.draw.line(screen, energy_color, \ - (each.rect.left, each.rect.top - 5), \ - (each.rect.left + each.rect.width * energy_remain, \ - each.rect.top - 5), 2) - else: - # 毁灭 - if not(delay % 3): - if e2_destroy_index == 0: - enemy2_down_sound.play() - screen.blit(each.destroy_images[e2_destroy_index], each.rect) - e2_destroy_index = (e2_destroy_index + 1) % 4 - if e2_destroy_index == 0: - score += 6000 - each.reset() - - # 绘制小型敌机: - for each in small_enemies: - if each.active: - each.move() - screen.blit(each.image, each.rect) - else: - # 毁灭 - if not(delay % 3): - if e1_destroy_index == 0: - enemy1_down_sound.play() - score += 1000 - each.reset() - screen.blit(each.destroy_images[e1_destroy_index], each.rect) - e1_destroy_index = (e1_destroy_index + 1) % 4 - - # 检测我方飞机是否被撞 - enemies_down = pygame.sprite.spritecollide(me, enemies, False, pygame.sprite.collide_mask) - if enemies_down and not me.invincible: - me.active = False - for e in enemies_down: - e.active = False - - # 绘制我方飞机 - if me.active: - if switch_image: - screen.blit(me.image1, me.rect) - else: - screen.blit(me.image2, me.rect) - else: - # 毁灭 - if not(delay % 3): - if me_destroy_index == 0: - me_down_sound.play() - screen.blit(me.destroy_images[me_destroy_index], me.rect) - me_destroy_index = (me_destroy_index + 1) % 4 - if me_destroy_index == 0: - life_num -= 1 - me.reset() - pygame.time.set_timer(INVINCIBLE_TIME, 3 * 1000) - - # 绘制全屏炸弹数量 - bomb_text = bomb_font.render("× %d" % bomb_num, True, WHITE) - text_rect = bomb_text.get_rect() - screen.blit(bomb_image, (10, height - 10 - bomb_rect.height)) - screen.blit(bomb_text, (20 + bomb_rect.width, height - 5 - text_rect.height)) - - # 绘制剩余生命数量 - if life_num: - for i in range(life_num): - screen.blit(life_image, \ - (width-10-(i+1)*life_rect.width, \ - height-10-life_rect.height)) - - # 绘制得分 - score_text = score_font.render("Score : %s" % str(score), True, WHITE) - screen.blit(score_text, (10, 5)) - - # 绘制游戏结束画面 - elif life_num == 0: - # 背景音乐停止 - pygame.mixer.music.stop() - - # 停止全部音效 - pygame.mixer.stop() - - # 停止发放补给 - pygame.time.set_timer(SUPPLY_TIME, 0) - - if not recorded: - recorded = True - # 读取历史最高得分 - with open("record.dat", "r") as f: - record_score = int(f.read()) - - # 如果玩家得分高于历史最高得分,则存档 - if score > record_score: - with open("record.dat", "w") as f: - f.write(str(score)) - - # 绘制结束画面 - record_score_text = score_font.render("Best : %d" % record_score, True, (255, 255, 255)) - screen.blit(record_score_text, (50, 50)) - - gameover_text1 = gameover_font.render("Your Score", True, (255, 255, 255)) - gameover_text1_rect = gameover_text1.get_rect() - gameover_text1_rect.left, gameover_text1_rect.top = \ - (width - gameover_text1_rect.width) // 2, height // 3 - screen.blit(gameover_text1, gameover_text1_rect) - - gameover_text2 = gameover_font.render(str(score), True, (255, 255, 255)) - gameover_text2_rect = gameover_text2.get_rect() - gameover_text2_rect.left, gameover_text2_rect.top = \ - (width - gameover_text2_rect.width) // 2, \ - gameover_text1_rect.bottom + 10 - screen.blit(gameover_text2, gameover_text2_rect) - - again_rect.left, again_rect.top = \ - (width - again_rect.width) // 2, \ - gameover_text2_rect.bottom + 50 - screen.blit(again_image, again_rect) - - gameover_rect.left, gameover_rect.top = \ - (width - again_rect.width) // 2, \ - again_rect.bottom + 10 - screen.blit(gameover_image, gameover_rect) - - # 检测用户的鼠标操作 - # 如果用户按下鼠标左键 - if pygame.mouse.get_pressed()[0]: - # 获取鼠标坐标 - pos = pygame.mouse.get_pos() - # 如果用户点击“重新开始” - if again_rect.left < pos[0] < again_rect.right and \ - again_rect.top < pos[1] < again_rect.bottom: - # 调用main函数,重新开始游戏 - main() - # 如果用户点击“结束游戏” - elif gameover_rect.left < pos[0] < gameover_rect.right and \ - gameover_rect.top < pos[1] < gameover_rect.bottom: - # 退出游戏 - pygame.quit() - sys.exit() - - # 绘制暂停按钮 - screen.blit(paused_image, paused_rect) - - # 切换图片 - if not(delay % 5): - switch_image = not switch_image - - delay -= 1 - if not delay: - delay = 100 - - pygame.display.flip() - clock.tick(60) - -if __name__ == "__main__": - try: - main() - except SystemExit: - pass - except: - traceback.print_exc() - pygame.quit() - input() diff --git a/Plane_Fighting/myplane.py b/Plane_Fighting/myplane.py deleted file mode 100644 index f28bffc..0000000 --- a/Plane_Fighting/myplane.py +++ /dev/null @@ -1,55 +0,0 @@ -import pygame,os -abspath = os.getcwd() + "/" -class MyPlane(pygame.sprite.Sprite): - def __init__(self, bg_size): - pygame.sprite.Sprite.__init__(self) - - self.image1 = pygame.image.load(abspath + "images/me1.png").convert_alpha() - self.image2 = pygame.image.load(abspath + "images/me2.png").convert_alpha() - self.destroy_images = [] - self.destroy_images.extend([\ - pygame.image.load(abspath + "images/me_destroy_1.png").convert_alpha(), \ - pygame.image.load(abspath + "images/me_destroy_2.png").convert_alpha(), \ - pygame.image.load(abspath + "images/me_destroy_3.png").convert_alpha(), \ - pygame.image.load(abspath + "images/me_destroy_4.png").convert_alpha() \ - ]) - self.rect = self.image1.get_rect() - self.width, self.height = bg_size[0], bg_size[1] - self.rect.left, self.rect.top = \ - (self.width - self.rect.width) // 2, \ - self.height - self.rect.height - 60 - self.speed = 10 - self.active = True - self.invincible = False - self.mask = pygame.mask.from_surface(self.image1) - - def moveUp(self): - if self.rect.top > 0: - self.rect.top -= self.speed - else: - self.rect.top = 0 - - def moveDown(self): - if self.rect.bottom < self.height - 60: - self.rect.top += self.speed - else: - self.rect.bottom = self.height - 60 - - def moveLeft(self): - if self.rect.left > 0: - self.rect.left -= self.speed - else: - self.rect.left = 0 - - def moveRight(self): - if self.rect.right < self.width: - self.rect.left += self.speed - else: - self.rect.right = self.width - - def reset(self): - self.rect.left, self.rect.top = \ - (self.width - self.rect.width) // 2, \ - self.height - self.rect.height - 60 - self.active = True - self.invincible = True diff --git a/Plane_Fighting/pyinstaller.spec b/Plane_Fighting/pyinstaller.spec deleted file mode 100644 index 2d2c17f..0000000 --- a/Plane_Fighting/pyinstaller.spec +++ /dev/null @@ -1,40 +0,0 @@ -# -*- mode: python ; coding: utf-8 -*- - - -block_cipher = None - - -a = Analysis(['main.py','bullet.py','enemy.py','myplane.py','supply.py'], - pathex=[], - binaries=[("font", "images", "sound")] - datas=["record.dat"], - hiddenimports=[], - hookspath=[], - hooksconfig={}, - runtime_hooks=[], - excludes=[], - win_no_prefer_redirects=False, - win_private_assemblies=False, - cipher=block_cipher, - noarchive=False) -pyz = PYZ(a.pure, a.zipped_data, - cipher=block_cipher) - -exe = EXE(pyz, - a.scripts, - a.binaries, - a.zipfiles, - a.datas, - [], - name='Plane Fighting', - debug=False, - bootloader_ignore_signals=False, - strip=False, - upx=True, - upx_exclude=[], - runtime_tmpdir=None, - console=False, - disable_windowed_traceback=False, - target_arch=None, - codesign_identity=None, - entitlements_file=None ) diff --git a/Plane_Fighting/record.dat b/Plane_Fighting/record.dat deleted file mode 100644 index 573541a..0000000 --- a/Plane_Fighting/record.dat +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Plane_Fighting/sound/bullet.wav b/Plane_Fighting/sound/bullet.wav deleted file mode 100644 index cb97090..0000000 Binary files a/Plane_Fighting/sound/bullet.wav and /dev/null differ diff --git a/Plane_Fighting/sound/button.wav b/Plane_Fighting/sound/button.wav deleted file mode 100644 index f7b246f..0000000 Binary files a/Plane_Fighting/sound/button.wav and /dev/null differ diff --git a/Plane_Fighting/sound/enemy1_down.wav b/Plane_Fighting/sound/enemy1_down.wav deleted file mode 100644 index 2baa2d2..0000000 Binary files a/Plane_Fighting/sound/enemy1_down.wav and /dev/null differ diff --git a/Plane_Fighting/sound/enemy2_down.wav b/Plane_Fighting/sound/enemy2_down.wav deleted file mode 100644 index b72fa43..0000000 Binary files a/Plane_Fighting/sound/enemy2_down.wav and /dev/null differ diff --git a/Plane_Fighting/sound/enemy3_down.wav b/Plane_Fighting/sound/enemy3_down.wav deleted file mode 100644 index f7c59fb..0000000 Binary files a/Plane_Fighting/sound/enemy3_down.wav and /dev/null differ diff --git a/Plane_Fighting/sound/enemy3_flying.wav b/Plane_Fighting/sound/enemy3_flying.wav deleted file mode 100644 index 6c57d7d..0000000 Binary files a/Plane_Fighting/sound/enemy3_flying.wav and /dev/null differ diff --git a/Plane_Fighting/sound/game_music.ogg b/Plane_Fighting/sound/game_music.ogg deleted file mode 100644 index 97b59d2..0000000 Binary files a/Plane_Fighting/sound/game_music.ogg and /dev/null differ diff --git a/Plane_Fighting/sound/get_bomb.wav b/Plane_Fighting/sound/get_bomb.wav deleted file mode 100644 index 541933f..0000000 Binary files a/Plane_Fighting/sound/get_bomb.wav and /dev/null differ diff --git a/Plane_Fighting/sound/get_bullet.wav b/Plane_Fighting/sound/get_bullet.wav deleted file mode 100644 index 39e4844..0000000 Binary files a/Plane_Fighting/sound/get_bullet.wav and /dev/null differ diff --git a/Plane_Fighting/sound/loading_game.ogg b/Plane_Fighting/sound/loading_game.ogg deleted file mode 100644 index 97b59d2..0000000 Binary files a/Plane_Fighting/sound/loading_game.ogg and /dev/null differ diff --git a/Plane_Fighting/sound/me_down.wav b/Plane_Fighting/sound/me_down.wav deleted file mode 100644 index 8ecab0f..0000000 Binary files a/Plane_Fighting/sound/me_down.wav and /dev/null differ diff --git a/Plane_Fighting/sound/supply.wav b/Plane_Fighting/sound/supply.wav deleted file mode 100644 index a184de9..0000000 Binary files a/Plane_Fighting/sound/supply.wav and /dev/null differ diff --git a/Plane_Fighting/sound/upgrade.wav b/Plane_Fighting/sound/upgrade.wav deleted file mode 100644 index b856b32..0000000 Binary files a/Plane_Fighting/sound/upgrade.wav and /dev/null differ diff --git a/Plane_Fighting/sound/use_bomb.wav b/Plane_Fighting/sound/use_bomb.wav deleted file mode 100644 index 4c60777..0000000 Binary files a/Plane_Fighting/sound/use_bomb.wav and /dev/null differ diff --git a/Plane_Fighting/supply.py b/Plane_Fighting/supply.py deleted file mode 100644 index 70d7986..0000000 --- a/Plane_Fighting/supply.py +++ /dev/null @@ -1,51 +0,0 @@ -import pygame,os -from random import * - -abspath = os.getcwd() + "/" -class Bullet_Supply(pygame.sprite.Sprite): - def __init__(self, bg_size): - pygame.sprite.Sprite.__init__(self) - - self.image = pygame.image.load(abspath + "images/bullet_supply.png").convert_alpha() - self.rect = self.image.get_rect() - self.width, self.height = bg_size[0], bg_size[1] - self.rect.left, self.rect.bottom = \ - randint(0, self.width - self.rect.width), -100 - self.speed = 5 - self.active = False - self.mask = pygame.mask.from_surface(self.image) - - def move(self): - if self.rect.top < self.height: - self.rect.top += self.speed - else: - self.active = False - - def reset(self): - self.active = True - self.rect.left, self.rect.bottom = \ - randint(0, self.width - self.rect.width), -100 - -class Bomb_Supply(pygame.sprite.Sprite): - def __init__(self, bg_size): - pygame.sprite.Sprite.__init__(self) - - self.image = pygame.image.load(abspath + "images/bomb_supply.png").convert_alpha() - self.rect = self.image.get_rect() - self.width, self.height = bg_size[0], bg_size[1] - self.rect.left, self.rect.bottom = \ - randint(0, self.width - self.rect.width), -100 - self.speed = 5 - self.active = False - self.mask = pygame.mask.from_surface(self.image) - - def move(self): - if self.rect.top < self.height: - self.rect.top += self.speed - else: - self.active = False - - def reset(self): - self.active = True - self.rect.left, self.rect.bottom = \ - randint(0, self.width - self.rect.width), -100