private Rectangle boundingBoxToRectangle(I_WorldObject obj) { Rectangle AABB = new Rectangle((int)obj.getPosition().X, (int)obj.getPosition().Y, obj.getTexture().Width, obj.getTexture().Height); return(AABB); }
public void Draw(I_WorldObject obj) { if (trackMe.getPosition().X >= WorldData.GetInstance().ScreenWidth / 2) { //Vector2 objPosInCameraSpace = obj.getPosition() - new Vector2((trackMe.getPosition()).X, 0); Vector2 objPosInCameraSpace = obj.getPosition() - new Vector2((trackMe.getPosition()).X - (WorldData.GetInstance().ScreenWidth / 2), 0); objPosInScreenSpace = objPosInCameraSpace; tracking = true; } else { tracking = false; Vector2 objPosInCameraSpace = obj.getPosition(); objPosInScreenSpace = objPosInCameraSpace; } if (obj.getName() != "coin") { mSpriteBatch.Draw(obj.getTexture(), objPosInScreenSpace, null, obj.getColor(), obj.getRotation(), obj.getTextureOrigin(), 1.0f, SpriteEffects.None, 0); } else if (obj.getName() == "coin") { Rectangle srcRect = new Rectangle((int)obj.getFrame() * obj.getFrameWidth(), 0, obj.getFrameWidth(), obj.getTexture().Height); mSpriteBatch.Draw(obj.getTexture(), objPosInScreenSpace, srcRect, Color.White, obj.getRotation(), Vector2.Zero, obj.getScale(), SpriteEffects.None, 0); } }
private Rectangle boundingBoxToRectangle(I_WorldObject obj) { Rectangle AABB; if (obj.getName().CompareTo("coin") == 0) { AABB = new Rectangle((int)obj.getPosition().X, (int)obj.getPosition().Y, 20, obj.getTexture().Height); } else { AABB = new Rectangle((int)obj.getPosition().X, (int)obj.getPosition().Y, obj.getTexture().Width, obj.getTexture().Height); } return(AABB); }
public void DrawText(I_WorldObject text) { Vector2 objPosInCameraSpace = text.getPosition(); objPosInScreenSpace = objPosInCameraSpace; string texttowrite = parseText(text.getName()); mSpriteBatch.DrawString(font, texttowrite, objPosInScreenSpace, Color.Black, text.getRotation(), text.getTextureOrigin(), 1.0f, SpriteEffects.None, 0); }
public Camera(SpriteBatch sb, I_WorldObject trackMe) { mSpriteBatch = sb; Position = trackMe.getPosition(); Rotation = 0.0f; Zoom = 1.0f; this.trackMe = trackMe; tracking = false; }
public void Update(GameTime gameTime) { this.Position = trackMe.getPosition(); }