Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9854


Ignore:
Timestamp:
Dec 2, 2013, 3:53:08 PM (10 years ago)
Author:
zifloria
Message:

yeaHHH

Location:
code/branches/invaders
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/invaders/data/levels/templates/enemyInvader.oxt

    r9828 r9854  
    77   explosionchunks        = 4
    88
    9    health            = 1
    10    maxhealth         = 1
    11    initialhealth     = 1
     9   health            = 100
     10   maxhealth         = 100
     11   initialhealth     = 100
    1212
    1313   shieldhealth        = 35
     
    4646    </engines>
    4747    <attached>
    48       <Model position="0,0,0" yaw=90 pitch=0 roll=0 scale=8 mesh="escortShip.mesh" />
    49       <Model position="0,0,0" yaw=180 pitch=90 roll=0 scale=8 mesh="escortWeapon.mesh" />
     48      <Model position="0,0,0" yaw=180 pitch=270 roll=0 scale=2 mesh="swallow_mat.mesh" />
     49      <Model position="0,0,0" yaw=180 pitch=270 roll=0 scale=2 mesh="escortWeapon.mesh" />
    5050<!--Model mesh="cube.mesh" mass=10 position="0,0,3" scale3D="10,4,8" />
     51
     52swallow_mat.mesh
     53"ghost.mesh"
     54
    5155<Model mesh="cube.mesh" mass=10 position="12.6,-2,3" scale3D="2.8,2.8,11" />
    5256<Model mesh="cube.mesh" mass=10 position="-12.6,-2,3" scale3D="2.8,2.8,11" />
  • code/branches/invaders/data/overlays/InvaderHUD.oxo

    r9829 r9854  
    6868     showpoints     = true
    6969    />
     70
     71
     72    <OverlayText
     73     position  = "0.4, 0.1"
     74     pickpoint = "0.0, 0.0"
     75     font      = "ShareTechMono"
     76     textsize  = 0.04
     77     colour    = "1.0, 1.0, 1.0, 1.0"
     78     align     = "left"
     79     caption   = "X"
     80    />
     81    <InvaderHUDinfo
     82     position  = "0.42, 0.1"
     83     pickpoint = "0.0, 0.0"
     84     font      = "ShareTechMono"
     85     textsize  = 0.04
     86     colour    = "1.0, 1.0, 1.0, 1.0"
     87     align     = "left"
     88
     89     showMultiplier = true
     90    />
    7091  </OverlayGroup>
    7192</Template>
  • code/branches/invaders/src/modules/invader/Invader.cc

    r9837 r9854  
    8787            return;
    8888
    89         for (int i = 0; i < level; i++)
     89        srand(player->getPosition().x + player->getPosition().y);
     90        for (int i = 0; i < level * 2; i++)
    9091        {
    91             SmartPtr<InvaderEnemy> newPawn = new InvaderEnemy(this->center_->getContext());
     92            WeakPtr<InvaderEnemy> newPawn = new InvaderEnemy(this->center_->getContext());
    9293            newPawn->addTemplate("enemyinvader");
    93             newPawn->setPosition(player->getPosition() + Vector3(500 + 100 * i, 0, 0));
     94            newPawn->setPlayer(player);
     95            newPawn->level = level;
     96            newPawn->setPosition(player->getPosition() + Vector3(500 + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200));
    9497        }
    9598    }
  • code/branches/invaders/src/modules/invader/Invader.h

    r9837 r9854  
    6666            int getLevel(){return this->level;}
    6767            int getPoints(){return this->point;}
     68            int getMultiplier(){return this->multiplier;}
    6869
    6970            void costLife(){lives--; if (lives <= 0) end();};
  • code/branches/invaders/src/modules/invader/InvaderEnemy.cc

    r9837 r9854  
    4444        RegisterObject(InvaderEnemy);
    4545        enableCollisionCallback();
     46        lifetime = 0;
    4647    }
    4748
    4849    void InvaderEnemy::tick(float dt)
    4950    {
    50         setVelocity(Vector3(500 ,0, 0));
     51        lifetime += dt;
     52        if (lifetime > 5000)
     53        {
     54            removeHealth(2000);
     55        }
     56        if (player != NULL)
     57        {
     58            float newZ = player->getPosition().z - getPosition().z;
     59            if (newZ < 0)
     60                newZ = (-100 < newZ)?-100:newZ;
     61            else
     62                newZ = (100 > newZ)?100:newZ;
     63            setVelocity(Vector3(1000 - level * 100 , 0, newZ));
     64        }
    5165        SUPER(InvaderEnemy, tick, dt);
    5266    }
     
    5468    inline bool InvaderEnemy::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    5569    {
    56         setVelocity(Vector3(900,0,0));
     70        setVelocity(Vector3(1000,0,0));
    5771        removeHealth(2000);
    5872        return false;
  • code/branches/invaders/src/modules/invader/InvaderEnemy.h

    r9829 r9854  
    5050            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    5151            virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator);
     52            virtual void setPlayer(WeakPtr<InvaderShip> player){this->player = player;}
    5253
     54            int level;
    5355        private:
    5456            WeakPtr<Invader> getGame();
    5557            WeakPtr<Invader> game;
     58            WeakPtr<InvaderShip> player;
    5659            Camera* camera;
    5760            bool isFireing;
    5861            float speed, damping;
    5962            float lastTimeFront, lastTimeLeft;
     63            float lifetime;
    6064            struct Velocity
    6165            {
  • code/branches/invaders/src/modules/invader/InvaderHUDinfo.cc

    r9828 r9854  
    4444        this->bShowLevel_ = false;
    4545        this->bShowPoints_ = false;
     46        this->bShowMultiplier_ = false;
    4647    }
    4748
     
    5758        XMLPortParam(InvaderHUDinfo, "showPoints",     setShowPoints,     getShowPoints,     xmlelement, mode).defaultValues(false);
    5859        XMLPortParam(InvaderHUDinfo, "showLevel",     setShowLevel,     getShowLevel,     xmlelement, mode).defaultValues(false);
     60        XMLPortParam(InvaderHUDinfo, "showMultiplier",     setShowMultiplier,     getShowMultiplier,     xmlelement, mode).defaultValues(false);
    5961    }
    6062
     
    8082                this->setCaption(points);
    8183            }
     84            else if(this->bShowMultiplier_)
     85            {
     86                const std::string& Multiplier = multi_cast<std::string>(this->InvaderGame->getMultiplier());
     87                this->setCaption(Multiplier);
     88            }
    8289        }
    8390    }
  • code/branches/invaders/src/modules/invader/InvaderHUDinfo.h

    r9828 r9854  
    6060                { return this->bShowPoints_; }
    6161
     62            inline void setShowMultiplier(bool value)
     63                { this->bShowMultiplier_ = value; }
     64            inline bool getShowMultiplier() const
     65                { return this->bShowMultiplier_; }
     66
     67
    6268        private:
    6369            Invader* InvaderGame;
     
    6571            bool bShowLevel_;
    6672            bool bShowPoints_;
     73            bool bShowMultiplier_;
    6774    };
    6875}
Note: See TracChangeset for help on using the changeset viewer.