public override void Render(GameTime gameTime, SpriteBatch batch, Camera cam) { batch.Draw(this.SpriteTexture, this.Pos, this.SpriteRect, Color.White, this.Orient, new Vector2(0f, 0f), 2.0f, SpriteEffects.None, this.depth); batch.Draw(this.SpriteTexture, this.Pos- cam.ScreenToWorld(new Vector2(this.SpriteRect.Width, 0.0f)), this.SpriteRect, Color.White, this.Orient, new Vector2(0f, 0f), 2.0f, SpriteEffects.None, this.depth); }
private void PollInput(Camera cam) { TouchCollection tc = TouchPanel.GetState(); foreach (TouchLocation tl in tc) { if (tl.State == TouchLocationState.Moved || tl.State == TouchLocationState.Pressed) { Vector2 touchPos = cam.ScreenToWorld(tl.Position); //converted to camera pos SteerToward(touchPos, 0.1f); Thrust(); } } }
private void FindNewTarget(Camera cam) { Random random = new Random(); this.target = cam.ScreenToWorld(new Vector2((float)random.NextDouble() * 800.0f, (float)random.NextDouble() * 480.0f)); }