用户:
陆奕博Max查看:25 回复:9 评论:25 创建时间:2020-05-08T14:57:49
发的太晚了
有人说 我发的 太 简单,那么让你们来看看,你们看不看得懂?(5/11公布答案)
import arcade
SCREEN_HEIGHT=900
SCREEN_WIDTH=600
SCREEN_TITLE='惜缘工作室教程贴'
看到这里,你是不是就有点懵?别急,更😵の在下面~
def setup(self):
set_background_color(color.WHITE)
self.bx = 100
self.by = 130
self.bg_list=('images/road.png','images/喵.png')
self.current_scene=0
self.change_bg()
self.balloons=[]
def on_draw(self):
start_render()
self.bg.draw()
self.mydraw()
for balloon in self.balloons:
balloon.draw()
def change_bg(self):
self.bg=Sprite(self.bg_list[self.current_scene])
self.bg.center_x = 400
self.bg.center_y = 300
def on_update(self, delta_time):
self.bx+=1
for balloon in self.balloons:
balloon.center_y+=5
if self.bx>SCREEN_WIDTH and self.current_scene==0:
self.bx=100
self.current_scene=1
self.change_bg()
self.create_balloon()
if self.bx > SCREEN_WIDTH and self.current_scene == 1:
self.bx = 100
self.current_scene = 0
self.change_bg()
self.balloons=[]
def mydraw(self):
draw_rectangle_filled(self.bx, self.by+70, 100, 80, color.RED)
draw_rectangle_filled(self.bx, self.by+70, 40, 40, color.GRAY)
draw_rectangle_filled(self.bx, self.by, 200, 60, color.RED)
draw_circle_filled(self.bx-50, self.by-30, 30, color.BLACK)
draw_circle_filled(self.bx+50, self.by-30, 30, color.BLACK)
def create_balloon(self):
balloon_list = ('images/balloon01.png','images/balloon02.png', 'images/balloon03.png', 'images/balloon04.png', 'images/balloon05.png')
num=50
for i in range(num):
balloon=Sprite(random.choice(balloon_list))
balloon.center_x=random.randint(0,SCREEN_WIDTH)
balloon.center_y=-random.randint(300,600)
self.balloons.append(balloon)
if __name__ == '__main__':
game = MyDraw(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
run()
哈哈哈,懵了吧?再说简单?我可是老生!你们运行一下?
哦对了,前面还要加一个:
class MyDraw(arcade.Window):#include<stdio.h>
int main(void) {
float pi = 0;int i = 1;float num = 1;while(num >= 0.0005) {pi += num;num*=i/(2*i+1):i++;}pi *= 2;printf("pi is %f\n",pi);return 0;}
懒得分开来点赞0
评论