public Projectile(string _filename) : base(_filename) { SetAlive(true); CollisionManager.AddObject(this); m_ObjectTag = 1; }
//gameobject constructor public GameObject(string fileName) { m_LocalTransform = new Matrix3(true); m_GlobalTransform = new Matrix3(true); m_Image = LoadImage(fileName); m_Texture = LoadTextureFromImage(m_Image); CollisionManager.AddObject(this); }
public Tank(string _fileName, float _startingPosX, float _startingPosY) : base(_fileName) { SetAlive(true); //starting position m_LocalTransform.m7 = _startingPosX; m_LocalTransform.m8 = _startingPosY; m_ObjectTag = 1; CollisionManager.AddObject(this); }
//Radius for collision public GameObject(string fileName) { //load image and convert to texture m_Image = LoadImage(fileName); m_tTexture = LoadTextureFromImage(m_Image); m_mLocalTransformation.Identity(); m_mLocalTransformation.Identity(); //starting pos //m_mLocalTransformation.m7 = 100; //m_mLocalTransformation.m8 = 200; CollisionManager.AddObject(this); }
//----------------------------------- public GameObject(string filename) { m_LocalTransForm.Identity(); m_GlobalTransForm.Identity(); m_sprite = LoadImage(filename); m_texture = LoadTextureFromImage(m_sprite); m_min.x = -(m_texture.width * 0.5f); m_min.y = -(m_texture.height * 0.5f); m_max.x = (m_texture.width * 0.5f); m_max.y = (m_texture.height * 0.5f); CollisionManager.AddObject(this); }
public Wall(string _fileName, float _startingPosX, float _startingPosY, float _height, float _width) : base(_fileName) { m_Position = GetGlobalPosition(); SetAlive(true); m_EnabledCollision = true; m_ObjectTag = 2; //starting position m_LocalTransform.m7 = _startingPosX; m_LocalTransform.m8 = _startingPosY; m_Height = _height; m_Width = _width; //rec = new Rectangle {x = _startingPosX, y = _startingPosY, height = _height, width = _width}; CollisionManager.AddObject(this); }
public GameObject(string Filename) { //load image and convert to texture m_Image = LoadImage(Filename); m_Texture = LoadTextureFromImage(m_Image); m_v2Min.x = -(m_Texture.width * 0.5f); m_v2Min.y = -(m_Texture.height * 0.5f); //Set the Min of the objects x-axis and y-axis m_v2Max.x = (m_Texture.width * 0.5f); m_v2Max.y = (m_Texture.height * 0.5f); //Sets the Identity matrix to the LocalTransform and GlobalTransform m_LocalTransform.Identity(); m_GlobalTransform.Identity(); CollisionManager.AddObject(this); }
public override void Update(float _deltatime) { m_MousePosition = GetMousePosition().ToVector2(); currentGlobalPos = GetGlobalPosition(); targetDirection = m_MousePosition - currentGlobalPos; targetDirection.Normalise(); float rotation = 0.0f; if (IsKeyDown(KeyboardKey.KEY_RIGHT)) { rotation += m_TurretTurnSpeed * _deltatime; } if (IsKeyDown(KeyboardKey.KEY_LEFT)) { rotation -= m_TurretTurnSpeed * _deltatime; } if (IsKeyPressed(KeyboardKey.KEY_SPACE)) { FireGun(); CollisionManager.AddObject(m_Bullet); } Matrix3 rotationMatrix = new Matrix3(); rotationMatrix.SetRotateZ(rotation); m_LocalTransform = m_LocalTransform * rotationMatrix; m_Bullet.Update(_deltatime); m_Bullet.UpdateTransforms(); m_Bullet.SetRotation(rotation); base.Update(_deltatime); }