Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10017


Ignore:
Timestamp:
Apr 3, 2014, 2:35:54 PM (10 years ago)
Author:
fvultier
Message:

Steuerung funktioniert

Location:
code/branches/pickupsFS14
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickupsFS14/data/levels/Jump.oxw

    r10005 r10017  
    1111
    1212<?lua
    13   include("templates/spaceshipAssff2.oxt")
    14   include("templates/spaceshipPirate.oxt")
    15   include("templates/spaceshipInvader.oxt")
    16   include("templates/enemyInvader.oxt")
    17   include("overlays/InvaderHUD.oxo")
     13  -- include("templates/spaceshipAssff2.oxt")
     14  -- include("templates/spaceshipPirate.oxt")
     15  include("templates/spaceshipJump.oxt")
     16  -- include("templates/enemyInvader.oxt")
     17  -- include("overlays/InvaderHUD.oxo")
    1818?>
     19
    1920
    2021<Level gametype = Jump>
     
    3536    />
    3637 
     38    <Planet
     39      position="0, 0, -2000"
     40      scale="1000"
     41      collisionType="dynamic"
     42      linearDamping="0.8"
     43      angularDamping="0"
     44      mass="10000000"
     45      pitch="0"
     46      mesh="planets/muunilinst.mesh"
     47      atmosphere="atmosphere1"
     48      rotationaxis="1,0,0"
     49      rotationrate="1.0"
     50      atmospheresize="80.0f"
     51      imagesize="1024.0f"
     52      collisiondamage = 2
     53      enablecollisiondamage = true
     54    >
     55
     56    </Planet>
     57
     58
    3759
    3860    <!-- <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/> -->
     
    4163
    4264
    43     <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=JumpShip pawndesign=spaceshipinvader />
    44 <!--
    45     <DistanceTrigger name="start" position="-200,0,0" target="Pawn" distance=10 stayActive="true" delay=0 />
     65    <SpawnPoint team=0 position="0,0,0" lookat="0,0,-1" spawnclass=JumpShip pawndesign=spaceshipjump />
     66
     67   
    4668
    4769
     
    5072   
    5173    <?lua
    52       for i = 1, 300, 1 do
     74      for i = 1, 200, 1 do
    5375        j = math.random()
    5476    ?>
    5577
    5678    <MovableEntity
    57       position = "<?lua print(math.random()* 40000 + 1000) ?>,-1000,<?lua print(math.random() * 4000 - 2000) ?>"
     79      position = "<?lua print(math.random(-300,300)) ?>,<?lua print(math.random(-250,10000)) ?>,-300>"
    5880      collisionType = dynamic
    5981      linearDamping = 0.8
    6082      angularDamping = 0
    61       scale = "<?lua print(j * 150)?>"
     83      scale = "10"
    6284      collisiondamage = 0
    63       enablecollisiondamage = true
     85      enablecollisiondamage = no
     86
    6487    >
    6588      <attached>
    6689        <Model mass="<?lua print(j * 1000) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
    6790      </attached>
    68       <collisionShapes>
    69         <SphereCollisionShape radius="<?lua print(j * 350) ?>" />
    70       </collisionShapes>
     91
    7192    </MovableEntity>
    7293
     
    7596    ?>
    7697
    77   -->
     98 
    7899   
    79100  </Scene>
    80101</Level>
    81 
  • code/branches/pickupsFS14/src/Orxonox.cc

    r8858 r10017  
    2727 *
    2828 */
     29
     30
    2931
    3032/**
  • code/branches/pickupsFS14/src/modules/jump/CMakeLists.txt

    r10005 r10017  
    44  JumpCenterPoint.cc
    55  JumpShip.cc
     6  JumpPlatform.cc
    67END_BUILD_UNIT
    78)
  • code/branches/pickupsFS14/src/modules/jump/Jump.cc

    r10005 r10017  
    4646#include "JumpCenterPoint.h"
    4747#include "JumpShip.h"
     48#include "JumpPlatform.h"
    4849/*
    4950#include "JumpEnemy.h"
  • code/branches/pickupsFS14/src/modules/jump/JumpCenterPoint.cc

    r10005 r10017  
    7070        }
    7171    }
     72
     73
    7274}
  • code/branches/pickupsFS14/src/modules/jump/JumpShip.cc

    r10005 r10017  
    4949        //isFireing = false;
    5050        //damping = 10;
    51         left = false;
    52         right = false;
    53 
     51        leftPressed = false;
     52        rightPressed = false;
     53        upPressed = false;
     54        downPressed = false;
     55
     56        yScreenPosition = 0;
     57        yVelocity = 0;
    5458    }
    5559
    5660    void JumpShip::tick(float dt)
    5761    {
    58 
    59         Vector3 pos = getPosition();
     62        Vector3 movement(0,0,0);
     63        Vector3 shipPosition = getPosition();
    6064
    6165        /*
     
    9599        if (isFireing)
    96100            ControllableEntity::fire(0);
    97 
     101                */
    98102        // Camera
    99         WeakPtr<Camera> camera = this->getCamera();
    100         if (camera != NULL)
    101         {
    102             camera->setPosition(Vector3(-pos.z, -posforeward, 0));
    103             camera->setOrientation(Vector3::UNIT_Z, Degree(90));
    104         }
    105 
    106 
    107 
     103
     104
     105
     106
     107            /*
    108108        // bring back on track!
    109109        if(pos.y != 0)
     
    121121        */
    122122
    123         if (left == true)
    124         {
    125                 pos += Vector3(100 + pos.y, 0, 0) * dt;
    126                 left = false;
    127         }
    128         else if (right == true)
    129         {
    130                 right = false;
    131         }
    132 
    133         setPosition(pos);
    134 
     123        // Berechne Bewegung anhand der Eingabe
     124        if (leftPressed == true)
     125        {
     126                movement -= Vector3(xVelocity, 0, 0);
     127                leftPressed = false;
     128        }
     129        else if (rightPressed == true)
     130        {
     131                movement += Vector3(xVelocity, 0, 0);
     132                rightPressed = false;
     133        }
     134
     135        if (upPressed == true)
     136        {
     137                //movement += Vector3(0, xVelocity, 0);
     138                yVelocity = ySpeedAfterJump;
     139                upPressed = false;
     140        }
     141        else if (downPressed == true)
     142        {
     143                movement -= Vector3(0, 0, 0);
     144                downPressed = false;
     145        }
     146
     147        movement += Vector3(0, yVelocity, 0);
     148        yVelocity -= yAcceleration;
     149
     150        // Skalierung der Bewegung je nach vergangener Zeit
     151        movement *= dt;
     152
     153        // Verschiebe das Schiff um den berechneten Vektor movement und verhindere Verlassen des Bildschrims
     154        shipPosition.x = clamp(shipPosition.x + movement.x, -xBoundary, xBoundary);
     155                shipPosition.y += movement.y;
     156
     157        setPosition(shipPosition);
     158
     159        // Bildschirmposition kann nur nach oben verschoben werden
     160        if (shipPosition.y > yScreenPosition)
     161        {
     162                yScreenPosition = shipPosition.y;
     163        }
     164
     165        // Kameraposition nachfuehren
     166        if (camera == NULL)
     167        {
     168                camera = getCamera();
     169        }
     170        if (camera != NULL)
     171        {
     172
     173            camera->setPosition(Vector3(-shipPosition.x, yScreenPosition-shipPosition.y, 100));
     174            //camera->setOrientation(Vector3::UNIT_Z, Degree(180));
     175        }
    135176
    136177        SUPER(JumpShip, tick, dt);
     
    146187    void JumpShip::moveFrontBack(const Vector2& value)
    147188    {
     189        if (value.y < 0)
     190        {
     191                downPressed = true;
     192        }
     193        else if (value.y > 0)
     194        {
     195                upPressed = true;
     196        }
    148197        //lastTimeLeft = 0;
    149198        //desiredVelocity.x = -value.x * speed;
     
    152201    void JumpShip::moveRightLeft(const Vector2& value)
    153202    {
    154         if (value.y < 0)
    155         {
    156                 left = true;
    157         }
    158         else if (value.y > 0)
    159         {
    160                 right = true;
     203        if (value.x < 0)
     204        {
     205                leftPressed = true;
     206        }
     207        else if (value.x > 0)
     208        {
     209                rightPressed = true;
    161210        }
    162211        //lastTimeFront = 0;
  • code/branches/pickupsFS14/src/modules/jump/JumpShip.h

    r10005 r10017  
    5656            // Starts or stops fireing
    5757            virtual void boost(bool bBoost);
    58 
     58*/
    5959            //no rotation!
    6060            virtual void rotateYaw(const Vector2& value){};
    6161            virtual void rotatePitch(const Vector2& value){};
    6262            //return to main menu if game has ended.
    63             virtual void rotateRoll(const Vector2& value){if (getGame()) if (getGame()->bEndGame) getGame()->end();};
     63            virtual void rotateRoll(const Vector2& value){};
    6464
    65             virtual void updateLevel();
     65            /*virtual void updateLevel();
    6666
    6767            virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
     
    7272            WeakPtr<Jump> getGame();
    7373            WeakPtr<Jump> game;
    74             //Camera* camera;
     74            WeakPtr<Camera> camera;
     75            const float xVelocity = 150.0f;
     76            const float xBoundary = 200.0f;
     77
     78
    7579            //bool isFireing;
    7680            //float speed;
     
    9094            } velocity, desiredVelocity;*/
    9195
    92             bool left;
    93             bool right;
     96            bool leftPressed;
     97            bool rightPressed;
     98            bool upPressed;
     99            bool downPressed;
    94100
    95 
    96 
     101            float yScreenPosition;
     102            float yVelocity;
     103            const float yAcceleration = 10.0f;
     104            const float ySpeedAfterJump = 300.0f;
    97105    };
    98106}
Note: See TracChangeset for help on using the changeset viewer.