- 博客(9)
- 资源 (8)
- 收藏
- 关注
原创 python大鱼吃小鱼
代码如下 # 游戏编程:按照以下游戏编写一个乌龟类和鱼类,并尝试编写游戏。 # 假设游戏场景(x,y)为0<=x<=10,0<=y<=10 # 游戏生成1只乌龟和10只鱼 # 他们的移动方向均随机 # 乌龟的最大移动速度为2,它可以随机选择1还是2移动,鱼儿的最大移动能力是1 # 当移动到最大边界时,自动反方向移动 # 乌龟初始化体力为100(上限) # 乌龟每移动一次,体力消耗1 # 当乌龟和鱼坐标重叠,乌龟吃掉鱼,乌龟体力增加20 # 鱼不考虑体力 # 当乌龟体力为0或者鱼儿的.
2021-07-18 12:37:00
999
转载 Python小游戏大鱼吃小鱼
假设游戏场景为范围(x,y)为0<=x<=10,0<=y<=10: 1.游戏生成1只乌龟和10条鱼,它们的移动方向均随机 2.乌龟的最大移动能力是2(可以随机选择1还是2移动),鱼儿的最大移动能力是1 3.当移动到场景边缘,自动向反方向移动 4.乌龟初始化体力为100(上限) 5.乌龟每移动一次,体力消耗1 6.当乌龟和鱼坐标重叠,乌龟吃掉鱼,乌龟体力增加20 7.鱼暂时不计算体力 8.当乌龟体力值为0或者鱼儿的数量为0游戏结束 一、定义大鱼(乌龟)类 class
2021-07-18 12:33:52
1233
原创 python 八卦图
想必大家一定看过太上老君的八卦图吧,今天他来了。 代码如下 import turtle window = turtle.Screen() bage = turtle.Turtle() radius = 100 bage.width(3) bage.color("black", "black") bage.begin_fill() bage.circle(radius/2, 180) bage.circle(radius, 180) bage.left(180) bage.circle
2021-07-18 11:04:28
2683
原创 python 魔法阵
想必很多朋友都在动漫里看过魔法阵,今天他来了 以下为代码 import turtle as t def tcyuan(x, y, r): t.fillcolor("black") t.begin_fill() t.seth(0) y = y - r t.penup() t.goto(x, y) t.pendown() t.circle(r) t.end_fill() def yuan(x, y, r): t.seth(0) y = y-r t.penup() ..
2021-07-18 10:02:04
2767
1
原创 python 暗淡的樱花书
今天给大家分享一个用python花的樱花树 以下为代码 from turtle import * from random import * from math import * def tree(n, l): pd() t = cos(radians(heading() + 45)) / 8 + 0.25 pencolor(t, t, t) pensize(n / 4) forward(l) if n > 0: b = random() * 15 + 10 c = rando
2021-07-18 09:47:39
149
原创 Python 音乐播放器
今天给大家分享的是一个音乐播放器 下面为完整代码(音乐自备) import tkinter from tkinter import Button from tkinter import Label from tkinter import Entry from tkinter import Scale from tkinter import Label, PhotoImage from PIL import Image, ImageTk from tkinter import message
2021-07-18 09:39:41
748
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅