我有四个不同的文件:main,vector,entity和physics.我不会发布所有代码,只发布导入,因为我认为这就是错误所在.(如果你愿意,我可以发布更多)
主要:
import time
from entity import Ent
from vector import Vect
#the rest just creates an entity and prints the result of movement
Run Code Online (Sandbox Code Playgroud)
实体:
from vector import Vect
from physics import Physics
class Ent:
#holds vector information and id
def tick(self, dt):
#this is where physics changes the velocity and position vectors
Run Code Online (Sandbox Code Playgroud)
向量:
from math import *
class Vect:
#holds i, j, k, and does vector math
Run Code Online (Sandbox Code Playgroud)
物理:
from entity import Ent
class Physics:
#physics class gets an entity …
Run Code Online (Sandbox Code Playgroud)