Beispiel #1
0
	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
Beispiel #2
0
	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
Beispiel #3
0
	def recordState(self):
		st = NetEntity.recordState(self)
		st["position"] = self.position
		st["velocity"] = self.velocity
		return st
Beispiel #4
0
	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)