public override void Update(GameTime gameTime) { if (!Alive) { return; } // movement previousPlayerPosition = playerPosition; yVelocity += accelerator; playerPosition.Y += yVelocity; totalDistance++; if (totalDistance >= 100) { Distance++; totalDistance = 0; } // intersections IntersectionLine.PointA = playerPosition; IntersectionLine.PointB = new Vector2(playerPosition.X - 7, previousPlayerPosition.Y); NotifyAllObservers(); // trail trail.AddVertex(playerPosition.ToPoint()); // remove non drawable points if (trail.VerticesCount > 1) { if (trail[0].X < 0 && trail[1].X < 0) { trail.RemoveVertexAt(0); } } // move trail for (int i = 0; i < trail.VerticesCount; i++) { trail[i] += new Point(-7, 0); } base.Update(gameTime); }
public void Reload() { wall.ClearAllVertices(); wall.AddVertex(defaultStartPosition); wall.AddVertex(new Point(Resolution.GameSize.X, defaultStartPosition.Y)); }