In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Pygame implementation of ball avoidance example code how to write, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Foreword:
In the Python class this semester, there is really a lot to write code.
Experiment 1 of the course is a backgammon, but the code is sent.
As for the quality of the code, I changed it directly according to the structure divided by myself.
Complain here (the code really sent out is terrible)
I changed it for almost 4 hours and then I don't want to add any more functions.
Write it yourself this time. Then write something like that.
Structural division
I divided it into
Run entrance
Setting Settin
Main master logic
Utils warehouse
In fact, what I want to do is to set it all on the page, but be lazy ~ (I'm going to get a grade point at the end of the term)
Start posting code directly.
Run.pyimport sysfrom main import mainbanner = "" _ _ _ | _ | if _ name__ = ='_ main__': print (banner) print ("Author: HengYi") print ("[*] simple: enter 1") print ("[*] normal: enter 2") print ("[*] difficult: enter 3") try: num = int (input ( "Please select difficulty:") if num in [1 two, 3]: main (num) else: print ("unable to handle ~") sys.exit () except Exception as e: raise Exception ("unable to handle ~") setting.pyWIDTH = 900 # wide HEIGHT = 600 # high SCORE = 0 # fractional TIME = 0 # time FIRST_STEP = 10 # arrival time SECOND_STEP = 20 # time to reach the third level FPS = 60 # refresh rate BG_COLOR = (255) 239,213) # background color utils.py#-*-coding: utf-8-*-import pygamefrom setting import FIRST_STEP, SECOND_STEP, BG_COLOR, WIDTH, HEIGHT# Note: generate corresponding balls according to difficulty # Time: 8:35 on 2021-12-17 # Author: HengYidef ballNum (ladderNum, time): index = 0 if FIRST_STEP
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.