示例#1
0
文件: sprite.py 项目: morganq/udpgame
	def interpolateState(self, prev, next, mh):
		ml = 1 - mh
		newState = NetEntity.interpolateState(self, prev, next, mh)
		
		newState["position"] = next["position"] * mh + prev["position"] * ml
		newState["velocity"] = next["velocity"] * mh + prev["velocity"] * ml

		return newState
示例#2
0
文件: sprite.py 项目: morganq/udpgame
	def __init__(self, position):
		NetEntity.__init__(self)
		#Physics stuff
		self.position = position
		self.velocity = Vector2(0, 0)
		self.acceleration = Vector2(0, 0)

		#Image stuff
		self.animations = {}
		self.currentAnimation = None
		self.flipHorizontal = False
		self.offset = Vector2(0, 0)
		self.visible = True
		
		#layering
		self.layerIndex = 0
		
		#rotation
		self.angle = 0
示例#3
0
文件: sprite.py 项目: morganq/udpgame
	def recordState(self):
		st = NetEntity.recordState(self)
		st["position"] = self.position
		st["velocity"] = self.velocity
		return st
示例#4
0
文件: sprite.py 项目: morganq/udpgame
	def update(self, dt):
		NetEntity.update(self, dt)
		self.velocity += self.acceleration * dt
		self.position += self.velocity * dt
		if self.currentAnimation:
			self.currentAnimation.update(dt)