你的项目简介
FGAme的Python项目详细描述
fgame是python 3的一个基于物理的游戏引擎。其目的是避免样板 如此简单以至于连孩子都能玩它(并学会如何编程 带着它!)。检查此pong实现:
from FGAme import * # A 10px margin to keep things on the screen world.add.margin(10) # Create a ball in the middle of the screen. We also add some random speed ball = world.add.circle(20, pos=pos.middle, color='red') ball.vel = vel.random() # Create both players as AABBs (axis aligned bounding boxes). Infinite # masses prevent them from moving when hit by the ball p1 = world.add.aabb(shape=(20, 120), pos=(30, 300), mass='inf') p2 = world.add.aabb(shape=(20, 120), pos=(30, 300), mass='inf') # Connect long press events with the correct functions on('long-press', 'w').do(p1.move, 0, 5) on('long-press', 's').do(p1.move, 0, -5) on('long-press', 'up').do(p2.move, 0, 5) on('long-press', 'down').do(p2.move, 0, -5) # Start main loop run()
fgame当前需要运行pygame。我们计划把它作为后端 不可知论,在未来它将支持SDL2,Kivy,Qt和其他