TriggerObject::TriggerObject(Mesh* mesh, TRIGGEROBJECTS objectName, Vector3 Pos, Vector3 scale, float angle, bool active, SoundManager &sfx_mano, Player* player) { /* set object */ Set("checking", mesh, NULL, false, false); translateObject(Pos.x, Pos.y, Pos.z); scaleObject(scale.x, scale.y, scale.z); type = objectName; this->active = active; //render /* set boundbox */ collideBound.Set(Pos, scale, Collision::BOX); this->player = player; isTriggered = true; //trigger triggerTimer = 0; initialPos = Pos; speed = 10.f; arrowCooldown = 1.f; my_sfx_man = &sfx_mano; triggerTimer = 0.f; duration = 0.f; }
GameObject::GameObject(Mesh* mesh, Vector3 Pos, Vector3 scale, bool active) { /* set object */ Set("", mesh, NULL, false, false); translateObject(Pos.x, Pos.y, Pos.z); scaleObject(scale.x, scale.y, scale.z); this->active = active; //render /* set boundbox */ collideBound.Set(Pos, scale, Collision::BOX); }
Player::Player(Mesh* mesh, Vector3 Pos, Vector3 scale, float angle, float Speed, bool active, SoundManager &sfx_mano) { PLAYER_SPEED = 4; score = 0; health = 100; stamina = 100; damage = 10; throwingCoin = false; /* set object */ Set("sdfdf", mesh, NULL, false, false); translateObject(Pos.x, Pos.y, Pos.z); scaleObject(scale.x, scale.y, scale.z); /* set angle */ angleZ = angle; /* set physics */ info.setSpeed(Speed); info.setDir(Vector2(1, 0)); //should be based on angle info.setTimer(0); /* set boundbox */ collideBound.Set(Pos, scale, Collision::BOX); invisible = false; jumpSpeed = 0; setType(GO_PLAYER); // Sound setup my_sfx_man = &sfx_mano; deceleration = 15; vel = 0; LeftOrRight = false; UpOrDown = false; checkLR = false; checkUD = false; /* drop rate */ dropRate = 0.1; dropTimer = dropRate; /* Store all non-invisibility sprites */ //Player sprites Sprite_invisibility_texture_file_path = "Image//Sprites//Hero2_invisible.tga"; storeSpriteAnimation("black guard", 21, 13, "Image//Sprites//Hero2.tga"); processSpriteAnimation(Player::UP, 0.5f, 0, 8, 8, 8, 1); processSpriteAnimation(Player::DOWN, 0.5f, 0, 10, 8, 10, 1); processSpriteAnimation(Player::LEFT, 0.5f, 0, 9, 8, 9, 1); processSpriteAnimation(Player::RIGHT, 0.5f, 0, 11, 8, 11, 1); processSpriteAnimation(Player::ATTACKUP, 0.5f, 0, 4, 7, 4, 1); processSpriteAnimation(Player::ATTACKDOWN, 0.5f, 0, 6, 7, 6, 1); processSpriteAnimation(Player::ATTACKLEFT, 0.5f, 0, 5, 7, 5, 1); processSpriteAnimation(Player::ATTACKRIGHT, 0.5f, 0, 7, 7, 7, 1); /* Set coin list */ for(int i = 0; i < 20; ++i) { Coin* coin; coin = new Coin(Geometry::meshList[Geometry::GEO_COIN], false); coinList.push_back(coin); } throwTime = 7.f; throwTimer = throwTime; }