
python游戏编程
文章平均质量分 86
lonely_gfolf
这个作者很懒,什么都没留下…
展开
-
环绕行星轨道
import sys, random, math, pygamefrom pygame.locals import *class Point(object): def __init__(self, x, y): self.__x = x self.__y = y def getx(self): return self.__x def ...原创 2018-04-22 22:34:46 · 250 阅读 · 0 评论 -
python游戏编程入门
import pygameimport sysfrom pygame.locals import *pygame.init()screen = pygame.display.set_mode((600,500))white = 255,255,255blue = 0,0,200myfont = pygame.font.Font(None, 60)textImage = myfont...原创 2018-04-19 22:52:09 · 20633 阅读 · 0 评论 -
Trivia游戏
import sys, pygame from pygame.locals import * #游戏逻辑代码在Trivia类中#所有游戏的逻辑都在该类中实现class Trivia(object): def __init__(self, filename): self.data = [] self.current = 0 self...原创 2018-04-20 16:30:26 · 1623 阅读 · 1 评论 -
Bomb Catcher游戏
# -*- coding: utf-8 -*-"""Created on Tue Jun 30 23:42:49 2015@author: liuchang"""import pygame,sys,randomfrom pygame.locals import *pygame.init()color= 255,255,0#绘制圆心的位置positionx=300pos...原创 2018-04-20 21:28:42 · 647 阅读 · 0 评论 -
Analog Clock
# coding=utf8import sys, pygame, math, randomfrom pygame.locals import *from datetime import datetime, date, time def print_text(font, x, y, text, color=(255,255,255)): imgtext = font.rende...原创 2018-04-20 22:37:24 · 623 阅读 · 0 评论 -
用精灵实现动画
import pygamefrom pygame.locals import *class MySprite(pygame.sprite.Sprite):#image图像,rect位置 def __init__(self, target): pygame.sprite.Sprite.__init__(self) self.target_surface ...原创 2018-04-26 22:24:05 · 979 阅读 · 0 评论 -
tensorflow保存python文件
原创 2018-04-26 23:06:12 · 312 阅读 · 0 评论 -
精灵冲突检测
#遇见两种bug,一个是导入MyLibrary 必须是python文件#第二个是由于MyLibrary缺少函数,导致元素对象没有collideimport itertools, sys, time, random, math, pygamefrom pygame.locals import *from MyLibrary import *def calc_velocity(direct...原创 2018-04-27 12:47:24 · 520 阅读 · 0 评论