Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11600 for code


Ignore:
Timestamp:
Nov 27, 2017, 3:29:03 PM (7 years ago)
Author:
merholzl
Message:

XML Ports and cleanUp

Location:
code/branches/FlappyOrx_HS17
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FlappyOrx_HS17/data/levels/FlappyOrx.oxw

    r11596 r11600  
    55 screenshot = "orxonoxArcade.png"
    66/>
    7 
     7<FlappyOrx
     8      spawnDistance=50
     9      Speed = 700 />
    810<?lua
     11  include("includes/notifications.oxi")
    912  include("templates/lodInformation.oxt")
    1013  include("templates/spaceshipFlappyOrx.oxt")
     
    3740    <FlappyOrxCenterPoint name=flappyorxcenter />
    3841   
     42   
     43
    3944    <?lua
    4045      for i = 1, 5, 1 do
  • code/branches/FlappyOrx_HS17/data/levels/templates/spaceshipFlappyOrx.oxt

    r11596 r11600  
    2222    enablecollisiondamage = true
    2323
    24     speed = 100
     24   
    2525    UpwardThrust = 200
    26     gravity = 500
     26    Gravity = 700
    2727  >
    2828    <engines>
     
    3737      <SphereCollisionShape position="-1.8    ,0 ,  -11" radius="15" />
    3838      <SphereCollisionShape position="-0.8   ,0 ,  0" radius="16" />
    39       <SphereCollisionShape position="0   ,0 ,  11" radius="12.5" />
     39      <!-- <SphereCollisionShape position="0   ,0 ,  11" radius="12.5" /> -->
    4040    </collisionShapes>
    4141 
  • code/branches/FlappyOrx_HS17/data/overlays/FlappyOrxHUD.oxo

    r11596 r11600  
     1
     2
    13<Template name="FlappyOrxHUD">
    24  <OverlayGroup name="FlappyOrxHUD" scale = "1, 1">
  • code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc

    r11598 r11600  
    3737#include "core/command/Executor.h"
    3838#include "core/config/ConfigValueIncludes.h"
    39 
     39#include "core/XMLPort.h"
    4040#include "gamestates/GSLevel.h"
    4141#include "chat/ChatManager.h"
     
    6363        bIsDead = true;
    6464        firstGame = true;                   //needed for the HUD
    65 
    66         spawnDistance=200;                  //distance between tubes
     65        speed = 0;
     66        spawnDistance=300;                  //distance between tubes
    6767        tubeOffsetX=500;                    //tube offset (so that we can't see them spawn)
    6868
     
    7070        setHUDTemplate("FlappyOrxHUD");
    7171    }
    72 
     72   
     73    void FlappyOrx::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     74        {   
     75            SUPER(FlappyOrx, XMLPort, xmlelement, mode);
     76            XMLPortParam(FlappyOrx, "spawnDistance", setspawnDistance, getspawnDistance, xmlelement, mode);
     77            XMLPortParam(FlappyOrx, "Speed", setSpeed, getSpeed, xmlelement, mode);
     78        }
    7379
    7480    void FlappyOrx::updatePlayerPos(int x){
     
    95101    void FlappyOrx::levelUp(){
    96102        point++;
    97         spawnDistance = 300-3*point;            //smaller spawn Distance
    98         getPlayer()->setSpeed(100+.5*point);    //increase speed
     103        spawnDistance = spawnDistance-3*point;            //smaller spawn Distance
     104        getPlayer()->setSpeed(this->speed+.5*point);    //increase speed
    99105    }
    100106
  • code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h

    r11598 r11600  
    6767            virtual void death();
    6868            virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command
     69            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     70           
     71            void setspawnDistance( int spawnDistance)
     72                {this->spawnDistance = spawnDistance; }
     73            int getspawnDistance()
     74                { return this->spawnDistance; } 
     75            inline void setSpeed( float speed ){   
     76                orxout()<< speed<< endl;
     77                this->speed = speed; }
     78            inline float getSpeed( )
     79                { return this->speed; }
    6980
    7081            void updatePlayerPos(int x);
     
    7485           
    7586            void setCenterpoint(FlappyOrxCenterPoint* center);
    76 
     87           
    7788            int getPoints(){return this->point;}
    7889           
     
    92103            int spawnDistance;
    93104            int tubeOffsetX;
     105            float speed = 100;
    94106           
    95107        private:
  • code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc

    r11596 r11600  
    5858    }
    5959
    60    
    6160    void FlappyOrxShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    6261        {   
    6362            SUPER(FlappyOrxShip, XMLPort, xmlelement, mode);
    64             XMLPortParam(FlappyOrxShip, "speed", setSpeed, getSpeed, xmlelement, mode);
     63            XMLPortParam(FlappyOrxShip, "Speed", setSpeed, getSpeed, xmlelement, mode);
    6564            XMLPortParam(FlappyOrxShip, "UpwardThrust", setUpwardThrust, getUpwardThrust, xmlelement, mode);
    66             XMLPortParam(FlappyOrxShip, "gravity", setGravity, getGravity, xmlelement, mode);
     65            XMLPortParam(FlappyOrxShip, "Gravity", setGravity, getGravity, xmlelement, mode);
    6766    }
    6867
     
    117116    }
    118117
    119     void FlappyOrxShip::updateLevel()
    120     {
    121         if (getGame())
    122             getGame()->levelUp();
    123     }
    124 
    125118    int FlappyOrxShip::timeUntilRespawn(){
    126119        return 2-time(0)+deathTime;
     
    137130    }
    138131
    139     void FlappyOrxShip::rotateRoll(const Vector2& value)
    140     {
    141         if (getGame())
    142             if (getGame()->bEndGame)
    143                 getGame()->end();
    144     }
     132    // void FlappyOrxShip::rotateRoll(const Vector2& value)
     133    // {
     134    //     if (getGame())
     135    //         if (getGame()->bEndGame)
     136    //             getGame()->end();
     137    // }
    145138
    146139    FlappyOrx* FlappyOrxShip::getGame()
  • code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.h

    r11595 r11600  
    4949            virtual void tick(float dt) override;
    5050
    51             // overwrite for 2d movement
    52             virtual void moveFrontBack(const Vector2& value) override;
    53             virtual void moveRightLeft(const Vector2& value) override;
    54 
     51           
    5552            // Starts or stops fireing
    5653            virtual void boost(bool bBoost) override;
     
    6057            virtual void rotatePitch(const Vector2& value) override{};
    6158            //return to main menu if game has ended.
    62             virtual void rotateRoll(const Vector2& value) override;
    63             inline void setSpeed( float speed )
    64                 { orxout() << "speed set: " << speed << endl; this->speed = speed; }
     59            //virtual void rotateRoll(const Vector2& value) override;
     60           
     61            inline void setSpeed( float speed ){   
     62                orxout()<< speed<< endl;
     63                this->speed = speed; }
    6564            inline float getSpeed( )
    6665                { return this->speed; }
     
    7372            inline float getUpwardThrust()
    7473                { return this->UpwardThrust; }
    75             virtual void updateLevel();
     74   
    7675            virtual int timeUntilRespawn();
    7776           
Note: See TracChangeset for help on using the changeset viewer.