Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10074


Ignore:
Timestamp:
May 22, 2014, 3:05:46 PM (10 years ago)
Author:
fvultier
Message:

new items added. improved level generator.

Location:
code/branches/pickupsFS14
Files:
10 added
27 edited

Legend:

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

    r10051 r10074  
    33 description = "Jump in space!"
    44 tags = "minigame"
    5  screenshot = "pong.png"
     5 screenshot = "jump.png"
    66/>
    77
     
    2121</Template>
    2222
    23 
     23<Template name=figureLeftHand defaults=0>
     24  <Model position="4.0,0.0,5.0" mesh="FigureLeftHand.mesh" scale=1 pitch=90>
     25  </Model>
     26</Template>
     27
     28<Template name=figureRightHand defaults=0>
     29  <Model position="-4.0,0.0,5.0" mesh="FigureRightHand.mesh" scale=1 pitch=90>
     30  </Model>
     31</Template>
    2432
    2533<Template name=jumpFigureTemplate>
    26   <JumpFigure camerapositiontemplate=jumpfigurecameras mouseFactor="100.0">
    27     <attached>
    28       <Model position="0,0,0" mesh="sphere.mesh" scale=4 />
    29     </attached>
    30   <!--
    31       <controller>
    32         <HumanController />
    33       </controller>   
    34     -->
     34  <JumpFigure camerapositiontemplate=jumpfigurecameras mouseFactor="100.0" modelLefthand=figureLeftHand  modelRighthand=figureRightHand rocketPos=10.0 propellerPos=10.0 bootsPos=-5.2 jumpSpeed=250.0 handMinAngle=-20 handMaxAngle=75 handSpeed=250 rocketSpeed=250.0 propellerSpeed=150.0>
     35    <attached>
     36      <Model position="0,0,0" mesh="Figure.mesh" scale=1 pitch=90/>
     37    </attached>
    3538  </JumpFigure>
    3639</Template>
     
    3942  <JumpProjectile>
    4043    <attached>
    41       <Model mesh="Projectile.mesh" scale=1.2  pitch=90/>
     44      <Model mesh="Projectile.mesh" scale=1  pitch=90/>
    4245      <ParticleEmitter scale=1 pitch=0 roll=0 position="0, 0, 0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
    4346    </attached>
     
    4649
    4750<Template name=jumpPlatformStaticTemplate>
    48   <JumpPlatformStatic>
    49     <attached>
    50       <Model mesh="Platform01.mesh" scale=1.2  pitch=90/>
     51  <JumpPlatformStatic height=3 width=19>
     52    <attached>
     53      <Model mesh="Platform01.mesh" scale=1  pitch=90/>
     54      <Backlight scale=0.2 colour="0.9, 0.4, 0.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
    5155    </attached>
    5256  </JumpPlatformStatic>
     
    5458
    5559<Template name=jumpPlatformHMoveTemplate>
    56   <JumpPlatformHMove>
    57     <attached>
    58       <Model mesh="Platform02.mesh" scale=1.2  pitch=90/>
     60  <JumpPlatformHMove height=3 width=19>
     61    <attached>
     62      <Model mesh="Platform02.mesh" scale=1  pitch=90/>
    5963      <Backlight scale=0.2 colour="0.1, 0.1, 1.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
    6064    </attached>
     
    6367
    6468<Template name=jumpPlatformVMoveTemplate>
    65   <JumpPlatformVMove>
    66     <attached>
    67       <Model mesh="Platform03.mesh" scale=1.2  pitch=90/>
    68       <Backlight scale=0.2 colour="1.0, 1.0, 1.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
     69  <JumpPlatformVMove height=3 width=19>
     70    <attached>
     71      <Model mesh="Platform03.mesh" scale=1  pitch=90/>
     72      <Backlight scale=0.2 colour="1.0, 0.1, 1.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
    6973    </attached>
    7074  </JumpPlatformVMove>
     
    7276
    7377<Template name=jumpPlatformDisappearTemplate>
    74   <JumpPlatformDisappear>
    75     <attached>
    76       <Model mesh="Platform04.mesh" scale=1.2  pitch=90/>
    77       <Backlight scale=0.2 colour="0.0, 0.0, 1.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
    78             <Backlight scale=0.2 colour="0.0, 1.0, 0.1" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />       
     78  <JumpPlatformDisappear height=3 width=19>
     79    <attached>
     80      <Model mesh="Platform04.mesh" scale=1  pitch=90/>
     81      <Backlight scale=0.2 colour="0.1, 1.0, 0.1" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
    7982    </attached>
    8083  </JumpPlatformDisappear>
     
    8285
    8386<Template name=jumpPlatformTimerTemplate>
    84   <JumpPlatformTimer effectPath="Orxonox/BigExplosion1part2" effectStartTime="0.4">
    85     <attached>
    86       <Model mesh="Platform05.mesh" scale=1.2  pitch=90/>
     87  <JumpPlatformTimer height=3 width=19 effectPath="Orxonox/BigExplosion1part2" effectStartTime="0.4">
     88    <attached>
     89      <Model mesh="Platform05.mesh" scale=1  pitch=90/>
     90      <ParticleEmitter scaled3D="5.0, 1.0, 2.0" pitch=0 roll=0 position="-4, 0, -2.0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
    8791      <ParticleEmitter scaled3D="5.0, 1.0, 2.0" pitch=0 roll=0 position="0, 0, -2.0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
    88 
    89       <!-- <ParticleSpawner name=hiteffect position="0,0,0" source="Orxonox/sparks2" lifetime=0.01 autostart=0 mainstate=spawn /> -->
     92      <ParticleEmitter scaled3D="5.0, 1.0, 2.0" pitch=0 roll=0 position="4, 0, -2.0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />     
    9093    </attached>
    9194  </JumpPlatformTimer>
     
    9396
    9497<Template name=jumpPlatformFakeTemplate>
    95   <JumpPlatformFake>
    96     <attached>
    97       <Model mesh="Platform06.mesh" scale=1.2  pitch=90/>
     98  <JumpPlatformFake height=3 width=19>
     99    <attached>
     100      <Model mesh="Platform06.mesh" scale=1  pitch=90/>
    98101      <ParticleEmitter scale3D="0.2,0.2,0.2" pitch=0 roll=0 position="0, 0, -2.5" source="Orxonox/sparks" lifetime=1.0 loop=1 startdelay=0.0 />
    99102    </attached>
     
    101104</Template>
    102105
    103 <Template name=jumpPlatformEnemy1Template>
    104   <JumpEnemy>
    105     <attached>
    106       <Model mesh="cube.mesh" scale3D="10.0, 4.0, 4.0"  pitch=90/>
    107     </attached>
    108   </JumpEnemy>
    109 </Template>
    110 
     106<Template name=jumpEnemy1Template>
     107  <JumpEnemy height=7 width=18>
     108    <attached>
     109      <Model mesh="Enemy1.mesh" scale=1  pitch=90/>
     110      <FadingBillboard active=true scale=0.09 position="0, 0, 10" colour="0.2, 1.0, 0.65, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
     111      <Backlight scale=0.33 name=bltest position="0, 0, -10" colour="0.6, 0.8, 0.75, 0.7" width=25 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />           
     112    </attached>
     113  </JumpEnemy>
     114</Template>
     115
     116<Template name=jumpEnemy2Template>
     117  <JumpEnemy height=8 width=20>
     118    <attached>
     119      <Model mesh="Enemy2.mesh" scale=1  pitch=90/>
     120      <MovableEntity position="-17, 0, 4" rotationaxis="0, 1, 0" rotationrate=500 >
     121        <attached>
     122          <Model mesh="Enemy2Wing.mesh" scale=1 pitch=90/>
     123        </attached>
     124      </MovableEntity>     
     125      <MovableEntity position="17, 0, 4" rotationaxis="0, 1, 0" rotationrate=500 >
     126        <attached>
     127          <Model mesh="Enemy2Wing.mesh" scale=1 pitch=90/>
     128        </attached>
     129      </MovableEntity>
     130      <ParticleEmitter scale3D="1.0,1.0,1.0" pitch=0 roll=0 position="-1, 0, -3" source="Orxonox/laser" lifetime=1.0 loop=1 startdelay=0.0 />
     131    </attached>
     132  </JumpEnemy>
     133</Template>
     134
     135<Template name=jumpEnemy3Template>
     136  <JumpEnemy height=8.2 width=11.2>
     137    <attached>
     138      <Model mesh="Enemy3.mesh" scale=1  pitch=90/>
     139      <Backlight scale3D="0.1, 0.1, 1.0" position="0, -11, -4" colour="1.0, 0.0, 0.9, 1.0" width=1 length=1 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1"/>
     140      <Backlight scale3D="0.1, 0.1, 1.0" position="6.32, 5.5, -4" colour="1.0, 0.0, 0.9, 1.0" width=1 length=1 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1"/>
     141      <Backlight scale3D="0.1, 0.1, 1.0" position="-6.32, 5.5, -4" colour="1.0, 0.0, 0.9, 1.0" width=1 length=1 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1"/>           
     142    </attached>
     143  </JumpEnemy>
     144</Template>
     145
     146<Template name=jumpEnemy4Template>
     147  <JumpEnemy height=7.5 width=21.5 rotationaxis="0, 0, 1" rotationrate=40 >
     148    <attached>
     149      <Model mesh="Enemy4.mesh" scale=1  pitch=90/>
     150    </attached>
     151  </JumpEnemy>
     152</Template>
     153
     154<Template name=jumpSpringTemplate>
     155  <JumpSpring height=6 width=9.25>
     156    <attached>
     157      <Model mesh="Spring.mesh" scale=1  rotationaxis="0, 0, 1" pitch=90 position="0.0, 0.0, 0.0"/>
     158    </attached>
     159  </JumpSpring>
     160</Template>
     161
     162<Template name=jumpRocketTemplate>
     163  <JumpRocket height=8.5 width=13.5>
     164    <attached>
     165      <Model mesh="Rocket.mesh" scale=1  pitch=90 position="0.0, 0.0, 1.0"/>
     166    </attached>
     167  </JumpRocket>
     168</Template>
     169
     170<Template name=jumpPropellerTemplate>
     171  <JumpPropeller height=4 width=15.5>
     172    <attached>
     173      <Model mesh="Propeller.mesh" scale=1  pitch=90 position="0.0, 0.0, 1.0"/>
     174    </attached>
     175  </JumpPropeller>
     176</Template>
     177
     178<Template name=jumpBootsTemplate>
     179  <JumpBoots height=5.2 width=3.5>
     180    <attached>
     181      <Model mesh="Boots.mesh" scale=1  pitch=90 position="0.0, 0.0, 1.0"/>
     182    </attached>
     183  </JumpBoots>
     184</Template>
     185
     186<Template name=jumpShieldTemplate>
     187  <JumpShield height=1.55 width=15.5>
     188    <attached>
     189      <Model mesh="Shield.mesh" scale=1 pitch=90 position="0.0, 0.0, 1.0"/>
     190    </attached>
     191  </JumpShield>
     192</Template>
    111193
    112194<Level gametype = "Jump">
     
    129211          name=jumpcenter
    130212          dimension="120,80"
    131           sectionLength="100"
    132           platformLength="12"
     213          sectionLength="150"
     214          platformSpeed="20"
     215          cameraOffset="10"
    133216
    134217          platformStaticTemplate=jumpPlatformStaticTemplate
     
    137220          platformDisappearTemplate=jumpPlatformDisappearTemplate
    138221          platformTimerTemplate=jumpPlatformTimerTemplate
    139           platformFakeTemplate=jumpPlatformFakeTemplate
    140           enemy1Template=jumpPlatformEnemy1Template
     222          platformFakeTemplate=jumpPlatformFakeTemplate         
    141223          figureTemplate=jumpFigureTemplate
    142           projectileTemplate=jumpProjectileTemplate>
     224          projectileTemplate=jumpProjectileTemplate
     225          springTemplate=jumpSpringTemplate
     226          rocketTemplate=jumpRocketTemplate
     227          propellerTemplate=jumpPropellerTemplate
     228          bootsTemplate=jumpBootsTemplate
     229          shieldTemplate=jumpShieldTemplate
     230          enemy1Template=jumpEnemy1Template
     231          enemy2Template=jumpEnemy2Template
     232          enemy3Template=jumpEnemy3Template
     233          enemy4Template=jumpEnemy4Template
     234          >
    143235
    144236          <attached>
     
    150242            <Model position="0,0,-1000" mesh="Platform05.mesh" scale="1" />
    151243            <Model position="0,0,-1000" mesh="Platform06.mesh" scale="1" />
    152 
    153244            <Model position="0,0,-1000" mesh="Projectile.mesh" scale="1" />
    154 
    155             <!--                   
    156             <Model position="0,0,60" mesh="cube.mesh" scale3D="105,1,1" />
    157             <Model position="0,0,-60" mesh="cube.mesh" scale3D="105,1,1" />           
    158            
    159             <ParticleSpawner name=scoreeffect_right position="120,0, 45" source="Orxonox/sparks2" lifetime=0.1 autostart=0 />
    160             <ParticleSpawner name=scoreeffect_right position="120,0, 30" source="Orxonox/BigExplosion1part2" lifetime=3.0 autostart=0 />
    161             <ParticleSpawner name=scoreeffect_right position="120,0, 15" source="Orxonox/sparks2" lifetime=0.1 autostart=0 />
    162             <ParticleSpawner name=scoreeffect_right position="120,0,  0" source="Orxonox/BigExplosion1part2" lifetime=0.1 autostart=0 />
    163             <ParticleSpawner name=scoreeffect_right position="120,0,-15" source="Orxonox/sparks2" lifetime=0.1 autostart=0 />
    164             <ParticleSpawner name=scoreeffect_right position="120,0,-30" source="Orxonox/BigExplosion1part2" lifetime=3.0 autostart=0 />
    165             <ParticleSpawner name=scoreeffect_right position="120,0,-45" source="Orxonox/sparks2" lifetime=0.1 autostart=0 />
    166 
    167             <ParticleSpawner name=scoreeffect_left position="-120,0, 45" source="Orxonox/sparks2" lifetime=0.1 autostart=0 />
    168             <ParticleSpawner name=scoreeffect_left position="-120,0, 30" source="Orxonox/BigExplosion1part2" lifetime=3.0 autostart=0 />
    169             <ParticleSpawner name=scoreeffect_left position="-120,0, 15" source="Orxonox/sparks2" lifetime=0.1 autostart=0 />
    170             <ParticleSpawner name=scoreeffect_left position="-120,0,  0" source="Orxonox/BigExplosion1part2" lifetime=0.1 autostart=0 />
    171             <ParticleSpawner name=scoreeffect_left position="-120,0,-15" source="Orxonox/sparks2" lifetime=0.1 autostart=0 />
    172             <ParticleSpawner name=scoreeffect_left position="-120,0,-30" source="Orxonox/BigExplosion1part2" lifetime=3.0 autostart=0 />
    173             <ParticleSpawner name=scoreeffect_left position="-120,0,-45" source="Orxonox/sparks2" lifetime=0.1 autostart=0 />
    174            
    175             <?lua
    176               for i = 1, 15, 1 do
    177             ?>
    178               <ParticleSpawner name=scoreeffect_center position="<?lua print(math.random() * 200 - 100) ?>,0,<?lua print(math.random() * 120 - 60) ?>" source="Orxonox/sparks2" lifetime=0.02 autostart=0 startdelay=<?lua print(math.random() * 0.7) ?> />
    179             <?lua end ?>
    180             -->
     245            <Model position="0,0,-1000" mesh="Figure.mesh" scale="1" />
     246            <Model position="0,0,-1000" mesh="Enemy1.mesh" scale="1" />
     247            <Model position="0,0,-1000" mesh="Enemy2.mesh" scale="1" />
     248            <Model position="0,0,-1000" mesh="Enemy3.mesh" scale="1" />
     249            <Model position="0,0,-1000" mesh="Enemy4.mesh" scale="1" />
     250            <Model position="0,0,-1000" mesh="Spring.mesh" scale="1" />
     251            <Model position="0,0,-1000" mesh="Rocket.mesh" scale="1" />
    181252          </attached>
    182253        </JumpCenterpoint>
     
    217288    </EventDispatcher>
    218289
    219     <?lua
    220       dofile("includes/CuboidSpaceStation.lua")
    221     ?>
    222 
    223     <StaticEntity pitch=15>
    224       <attached>
    225         <MovableEntity rotationrate="-4.15786" rotationaxis="0,0,1">
    226           <attached>
    227             <StaticEntity position="-2500,0,0" yaw=90 pitch=90>
    228               <attached>
    229                 <?lua
    230                   createSpaceStationPar(0,2,1,2,1,4,1,50)
    231                 ?>
    232               </attached>
    233             </StaticEntity>
    234           </attached>
    235         </MovableEntity>
    236       </attached>
    237     </StaticEntity>
    238 
    239     <StaticEntity position="0,1200,-200" yaw=50 pitch=60 roll=45>
    240       <attached>
    241         <Model scale=10 mesh="Carrier.mesh" />
    242         <Model position="0,30,20" scale=10 mesh="pirate.mesh" roll="180" />
    243         <Model position="-80,-30,20" scale=10 mesh="pirate.mesh" roll="180" />
    244       </attached>
    245     </StaticEntity>
    246 
    247     <StaticEntity pitch=70>
    248       <attached>
    249         <MovableEntity rotationaxis="0,0,1" rotationrate=8.5974>
    250           <attached>
    251             <StaticEntity yaw=-90 pitch=0 roll=90 position="800,0,0">
    252               <attached>
    253                 <Model position="0,0,0" scale=10 mesh="satellite.mesh" />
    254                 <MovableEntity position="-4,0,20" velocity="0,0,0" rotationaxis="0,0,1" rotationrate=50>
    255                   <attached>
    256                     <Model position="0,0,0" scale=10 mesh="satellitedish.mesh"/>
    257                   </attached>
    258                 </MovableEntity>
    259                 <!--
    260                 <ParticleEmitter pitch=-135 roll=30 position="-14, 3.5,-2.5" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
    261                 <ParticleEmitter pitch=135 roll=30 position="-14, 3.5,-9" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
    262                 <ParticleEmitter pitch=-45 roll=30 position="-14,-3.5,-2.5" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
    263                 <ParticleEmitter pitch=45 roll=30 position="-14,-3.5,-9" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
    264               -->
    265               </attached>
    266             </StaticEntity>
    267           </attached>
    268         </MovableEntity>
    269       </attached>
    270     </StaticEntity>
    271290  </Scene>
    272291</Level>
  • code/branches/pickupsFS14/data/overlays/jumpHUD.oxo

    r10051 r10074  
    88     colour    = "1.0, 1.0, 1.0, 1.0"
    99     align     = "center"
     10     showScore = true
     11     showMessages = false
    1012    />
    1113
    12     <!--
    13     <OverlayText
    14      position  = "0.505, 0.05"
     14    <JumpScore
     15     position  = "0.5, 0.5"
    1516     pickpoint = "0.0, 0.0"
    1617     font      = "ShareTechMono"
    17      textsize  = 0.06
    18      colour    = "1.0, 1.0, 1.0, 1.0"
     18     textsize  = 0.2
     19     colour    = "1.0, 0.0, 0.0, 1.0"
    1920     align     = "center"
    20 
    21      caption   = ":"
    22     />
    23     -->
     21     gameOverText = "GAME OVER"
     22     showScore = false
     23     showMessages = true
     24    />   
    2425
    2526  </OverlayGroup>
  • code/branches/pickupsFS14/src/modules/invader/InvaderWeapon.cc

    r9961 r10074  
    5757    }
    5858
    59     InvaderWeapon::~InvaderWeapon(){}
     59    InvaderWeapon::~InvaderWeapon()
     60    {
     61
     62    }
    6063
    6164    void InvaderWeapon::shot()
  • code/branches/pickupsFS14/src/modules/jump/CMakeLists.txt

    r10050 r10074  
    1313  JumpFigure.cc
    1414  JumpItem.cc
     15  JumpSpring.cc
     16  JumpRocket.cc
     17  JumpShield.cc
     18  JumpPropeller.cc
     19  JumpBoots.cc
    1520  JumpCenterpoint.cc
    1621  JumpScore.cc
     
    2429    orxonox
    2530    overlays
     31    weapons
    2632  SOURCE_FILES ${JUMP_SRC_FILES}
    2733)
  • code/branches/pickupsFS14/src/modules/jump/Jump.cc

    r10050 r10074  
    5353#include "JumpEnemy.h"
    5454#include "JumpFigure.h"
     55#include "JumpItem.h"
     56#include "JumpSpring.h"
     57#include "JumpRocket.h"
     58#include "JumpPropeller.h"
     59#include "JumpBoots.h"
     60#include "JumpShield.h"
    5561
    5662#include "infos/PlayerInfo.h"
     
    7278        RegisterObject(Jump);
    7379
    74         this->center_ = 0;
    75         this->figure_ = 0;
    76         this->camera = 0;
    77         this->fakeAdded_ = false;
    78 
    79         this->setHUDTemplate("JumpHUD");
    80 
    81         // Pre-set the timer, but don't start it yet.
    82         this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&Jump::startBall, this)));
    83         this->starttimer_.stopTimer();
    84 
    85         this->scoreLimit_ = 10;
    86         this->setConfigValues();
     80        center_ = 0;
     81        figure_ = 0;
     82        camera = 0;
     83
     84        setHUDTemplate("JumpHUD");
     85
     86        scoreLimit_ = 10;
     87        setConfigValues();
    8788    }
    8889
     
    9394    Jump::~Jump()
    9495    {
    95         if (this->isInitialized())
     96        if (isInitialized())
    9697        {
    97             this->cleanup();
     98            cleanup();
    9899        }
    99100    }
     
    102103    {
    103104        SUPER(Jump, tick, dt);
    104 
    105105        if (figure_ != NULL)
    106106        {
     
    108108                Vector3 figureVelocity = figure_->getVelocity();
    109109
    110                 if (figurePosition.z > totalScreenShift)
     110                float boundary = totalScreenShift+center_->getCameraOffset();
     111
     112                if (figurePosition.z > boundary)
    111113                {
    112                         screenShiftSinceLastUpdate += figurePosition.z - totalScreenShift;
    113                         totalScreenShift = figurePosition.z;
     114                        screenShiftSinceLastUpdate += figurePosition.z - boundary;
     115                        totalScreenShift = figurePosition.z - center_->getCameraOffset();
    114116
    115117                // Falls noetig neue Platformen im neuen Bereich einfuegen
     
    117119                {
    118120                        screenShiftSinceLastUpdate -= center_->getSectionLength();
    119                     addSection();
     121                        if (sectionNumber_ > 2 && sectionNumber_%4 == 0 && rand()%2 == 0)
     122                        {
     123                                if (addAdventure(adventureNumber_) == false)
     124                                                {
     125                                        addSection();
     126                                                }
     127                                else
     128                                {
     129                                        ++ adventureNumber_;
     130                                }
     131                        }
     132                        else
     133                        {
     134                                addSection();
     135                        }
    120136                }
    121137                }
    122138
    123139                // Spiel verloren wegen Ansturz?
    124                 if (figurePosition.z < totalScreenShift - center_->getFieldDimension().y && figureVelocity.z < 0)
     140                if (figurePosition.z < totalScreenShift - center_->getFieldDimension().y + platformHeight_ && figureVelocity.z < 0)
    125141                {
    126142                        end();
     
    128144
    129145                // Schiessen
     146
    130147                if (figure_->fireSignal)
    131148                {
    132149                        figure_->fireSignal = false;
    133                         addProjectile(figurePosition.x, figurePosition.z, 0.0, 150.0);
     150                        addProjectile(figurePosition.x, figurePosition.z + figure_->getPropellerPos());
    134151                }
    135152
    136153
    137                 if (this->camera != NULL)
     154                if (camera != NULL)
    138155                        {
    139156                                Vector3 cameraPosition = Vector3(0, totalScreenShift, 0);
     
    248265                }
    249266
    250 
    251 
     267                // Gegner, die zu weit unten oder abgeschossen sind entfernen
     268                ObjectList<JumpEnemy>::iterator beginEnemy = ObjectList<JumpEnemy>::begin();
     269                ObjectList<JumpEnemy>::iterator endEnemy = ObjectList<JumpEnemy>::end();
     270                ObjectList<JumpEnemy>::iterator itEnemy = beginEnemy;
     271                Vector3 enemyPosition;
     272
     273                while (itEnemy != endEnemy)
     274                {
     275                        enemyPosition = itEnemy->getPosition();
     276                        if (enemyPosition.z < totalScreenShift - center_->getFieldDimension().y || itEnemy->dead_ == true)
     277                        {
     278                                ObjectList<JumpEnemy>::iterator temp = itEnemy;
     279                                ++ itEnemy;
     280                                center_->detach(*temp);
     281                                temp->destroy();
     282                        }
     283                        else
     284                        {
     285                                ++ itEnemy;
     286                        }
     287                }
     288
     289                // Items, die zu weit unten sind entfernen
     290                ObjectList<JumpItem>::iterator beginItem = ObjectList<JumpItem>::begin();
     291                ObjectList<JumpItem>::iterator endItem = ObjectList<JumpItem>::end();
     292                ObjectList<JumpItem>::iterator itItem = beginItem;
     293                Vector3 itemPosition;
     294
     295                while (itItem != endItem)
     296                {
     297                        itemPosition = itItem->getPosition();
     298
     299                        WorldEntity* parent = itItem->getParent();
     300
     301                        if (itItem->attachedToFigure_ == false && itemPosition.z < totalScreenShift - center_->getFieldDimension().y && parent == center_)
     302                        {
     303                                ObjectList<JumpItem>::iterator temp = itItem;
     304                                ++ itItem;
     305                                center_->detach(*temp);
     306                                temp->destroy();
     307                        }
     308                        else
     309                        {
     310                                ++ itItem;
     311                        }
     312                }
    252313    }
    253314
     
    263324    void Jump::cleanup()
    264325    {
    265                 if (this->figure_ != NULL)
     326                if (figure_ != NULL)
    266327                {
    267328                        //this->figure_->destroy();
    268329                        //this->figure_ = 0;
    269330                }
    270                 this->camera = 0;
    271     }
    272 
    273     /**
    274     @brief
    275         Starts the Jump minigame.
    276     */
     331                camera = 0;
     332    }
     333
    277334    void Jump::start()
    278335    {
    279         if (this->center_ != NULL) // There needs to be a JumpCenterpoint, i.e. the area the game takes place.
     336        if (center_ != NULL) // There needs to be a JumpCenterpoint, i.e. the area the game takes place.
    280337        {
    281 
    282 
    283             // Attach the ball to the centerpoint and set the parameters as specified in the centerpoint, the ball is attached to.
    284             /*this->center_->attach(this->ball_);
    285             this->ball_->setPosition(0, 0, 0);
    286             this->ball_->setFieldDimension(this->center_->getFieldDimension());
    287 
    288             // Set the bats for the ball.
    289             this->ball_->setFigure(this->figure_);
    290             */
    291 
    292             // If one of the bats is missing, create it. Apply the template for the bats as specified in the centerpoint.
    293                         if (this->figure_ == NULL)
    294                         {
    295                                 this->figure_ = new JumpFigure(this->center_->getContext());
    296                                 this->figure_->addTemplate(this->center_->getFigureTemplate());
    297                         }
    298 
    299             // Attach the bats to the centerpoint and set the parameters as specified in the centerpoint, the bats are attached to.
    300             this->center_->attach(this->figure_);
    301             this->figure_->setPosition(-this->center_->getFieldDimension().x / 2, 0, 0);
    302             this->figure_->setFieldDimension(this->center_->getFieldDimension());
     338                        if (figure_ == NULL)
     339                        {
     340                                figure_ = new JumpFigure(center_->getContext());
     341                                figure_->addTemplate(center_->getFigureTemplate());
     342                                figure_->InitializeAnimation(center_->getContext());
     343                        }
     344
     345            center_->attach(figure_);
     346            figure_->setPosition(0, 0, 0);
     347            figure_->setFieldDimension(center_->getFieldDimension());
    303348        }
    304349        else // If no centerpoint was specified, an error is thrown and the level is exited.
     
    309354        }
    310355
    311         // Start the timer. After it has expired the ball is started.
    312         this->starttimer_.startTimer();
    313 
    314356        // Set variable to temporarily force the player to spawn.
    315         bool temp = this->bForceSpawn_;
    316         this->bForceSpawn_ = true;
     357        bool temp = bForceSpawn_;
     358        bForceSpawn_ = true;
    317359
    318360        // Call start for the parent class.
     
    320362
    321363        // Reset the variable.
    322         this->bForceSpawn_ = temp;
    323 
    324         if (this->figure_ != NULL)
     364        bForceSpawn_ = temp;
     365
     366        if (figure_ != NULL)
    325367        {
    326                 this->camera = this->figure_->getCamera();
     368                camera = figure_->getCamera();
    327369        }
    328370
    329371        totalScreenShift = 0.0;
    330372        screenShiftSinceLastUpdate = 0.0;
    331         sectionNumber = 0;
     373        sectionNumber_ = 0;
     374        adventureNumber_ = 0;
    332375
    333376        addStartSection();
     
    347390        // Call end for the parent class.
    348391        Deathmatch::end();
    349     }
    350 
    351     /**
    352     @brief
    353         Spawns players, and fills the rest up with bots.
    354     */
    355     void Jump::spawnPlayersIfRequested()
    356     {
    357 
    358         // first spawn human players to assign always the left bat to the player in singleplayer
    359         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    360             if (it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
    361                 this->spawnPlayer(it->first);
    362         // now spawn bots
    363         /*
    364         for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
    365             if (!it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
    366                 this->spawnPlayer(it->first);
    367         */
    368392    }
    369393
     
    384408            this->players_[player].state_ = PlayerState::Alive;
    385409        }
    386         // If both bats are taken.
    387         else
    388         {
    389             return;
    390         }
    391 
    392410    }
    393411
     
    398416    void Jump::playerScored(PlayerInfo* player, int score)
    399417    {
    400         /*
    401         Deathmatch::playerScored(player, score);
    402         if (this->center_ != NULL) // If there is a centerpoint.
    403         {
    404             // Fire an event for the player that has scored, to be able to react to it in the level, e.g. by displaying fireworks.
    405             if (player == this->getRightPlayer())
    406                 this->center_->fireEvent(FireEventName(JumpCenterpoint, right));
    407             else if (player == this->getLeftPlayer())
    408                 this->center_->fireEvent(FireEventName(JumpCenterpoint, left));
    409 
    410             // Also announce, that the player has scored.
    411             if (player != NULL)
    412                 this->gtinfo_->sendAnnounceMessage(player->getName() + " scored");
    413         }
    414 
    415         // If there is a ball present, reset its position, velocity and acceleration.
    416         if (this->ball_ != NULL)
    417         {
    418             this->ball_->setPosition(Vector3::ZERO);
    419             this->ball_->setVelocity(Vector3::ZERO);
    420             this->ball_->setAcceleration(Vector3::ZERO);
    421             this->ball_->setSpeed(0);
    422         }
    423 
    424         // If there are bats reset them to the middle position.
    425         if (this->figure_[0] != NULL && this->figure_[1] != NULL)
    426         {
    427             this->figure_[0]->setPosition(-this->center_->getFieldDimension().x / 2, 0, 0);
    428             this->figure_[1]->setPosition( this->center_->getFieldDimension().x / 2, 0, 0);
    429         }
    430 
    431         // If a player gets enough points, he won the game -> end of game
    432         PlayerInfo* winningPlayer = NULL;
    433         if (this->getLeftPlayer() && this->getScore(this->getLeftPlayer()) >= scoreLimit_)
    434             winningPlayer = this->getLeftPlayer();
    435         else if (this->getRightPlayer() && this->getScore(this->getRightPlayer()) >= scoreLimit_)
    436             winningPlayer = getLeftPlayerthis->getRightPlayer();
    437 
    438         if (winningPlayer)
    439         {
    440              ChatManager::message(winningPlayer->getName() + " has won!");
    441              this->end();
    442         }
    443 
    444         // Restart the timer to start the ball.
    445         this->starttimer_.startTimer();
    446 
    447         */
     418
    448419    }
    449420
     
    481452                newPlatform->addTemplate(platformTemplate);
    482453                newPlatform->setPosition(Vector3(xPosition, 0.0, zPosition));
    483                 newPlatform->setFieldDimension(center_->getFieldDimension());
    484454                newPlatform->setFigure(this->figure_);
    485455                center_->attach(newPlatform);
     
    487457    }
    488458
    489     void Jump::addPlatformStatic(float xPosition, float zPosition)
    490     {
    491                 if (fakeAdded_ == false && rand()%5 == 0)
    492                 {
    493                         addPlatformFake(xPosition, zPosition);
    494                 }
    495                 else
    496                 {
    497                 JumpPlatformStatic* newPlatform = new JumpPlatformStatic(center_->getContext());
    498                         addPlatform(newPlatform, center_->getPlatformStaticTemplate(), xPosition, zPosition);
    499                 }
    500     }
    501 
    502     void Jump::addPlatformHMove(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float speed)
     459    JumpPlatformStatic* Jump::addPlatformStatic(float xPosition, float zPosition)
     460    {
     461                JumpPlatformStatic* newPlatform = new JumpPlatformStatic(center_->getContext());
     462                addPlatform(newPlatform, center_->getPlatformStaticTemplate(), xPosition, zPosition);
     463
     464                return newPlatform;
     465    }
     466
     467    JumpPlatformHMove* Jump::addPlatformHMove(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float speed)
    503468    {
    504469        JumpPlatformHMove* newPlatform = new JumpPlatformHMove(center_->getContext());
    505470                newPlatform->setProperties(leftBoundary, rightBoundary, speed);
    506471                addPlatform(newPlatform, center_->getPlatformHMoveTemplate(), xPosition, zPosition);
    507     }
    508 
    509     void Jump::addPlatformVMove(float xPosition, float zPosition, float lowerBoundary, float upperBoundary, float speed)
     472
     473                return newPlatform;
     474    }
     475
     476    JumpPlatformVMove* Jump::addPlatformVMove(float xPosition, float zPosition, float lowerBoundary, float upperBoundary, float speed)
    510477    {
    511478        JumpPlatformVMove* newPlatform = new JumpPlatformVMove(center_->getContext());
    512479                newPlatform->setProperties(lowerBoundary, upperBoundary, speed);
    513480                addPlatform(newPlatform, center_->getPlatformVMoveTemplate(), xPosition, zPosition);
    514     }
    515 
    516     void Jump::addPlatformDisappear(float xPosition, float zPosition)
     481
     482                return newPlatform;
     483    }
     484
     485    JumpPlatformDisappear* Jump::addPlatformDisappear(float xPosition, float zPosition)
    517486    {
    518487                JumpPlatformDisappear* newPlatform = new JumpPlatformDisappear(center_->getContext());
    519488                newPlatform->setProperties(true);
    520489                addPlatform(newPlatform, center_->getPlatformDisappearTemplate(), xPosition, zPosition);
    521     }
    522 
    523     void Jump::addPlatformTimer(float xPosition, float zPosition, float time, float variance)
     490
     491                return newPlatform;
     492    }
     493
     494    JumpPlatformTimer* Jump::addPlatformTimer(float xPosition, float zPosition, float time, float variance)
    524495    {
    525496                float additionalTime = (float)(rand()%100)/(100*variance) - variance/2;
     
    528499                newPlatform->setProperties(time + additionalTime);
    529500                addPlatform(newPlatform, center_->getPlatformTimerTemplate(), xPosition, zPosition);
    530     }
    531 
    532     void Jump::addPlatformFake(float xPosition, float zPosition)
    533     {
    534         fakeAdded_ = true;
    535 
     501
     502                return newPlatform;
     503    }
     504
     505    JumpPlatformFake* Jump::addPlatformFake(float xPosition, float zPosition)
     506    {
    536507                JumpPlatformFake* newPlatform = new JumpPlatformFake(center_->getContext());
    537508                addPlatform(newPlatform, center_->getPlatformFakeTemplate(), xPosition, zPosition);
    538509                newPlatform->setAngularVelocity(Vector3(0, 0, 2.0));
    539     }
    540 
    541 
    542     void Jump::addProjectile(float xPosition, float zPosition, float xVelocity, float zVelocity)
     510
     511                return newPlatform;
     512    }
     513
     514
     515    void Jump::addProjectile(float xPosition, float zPosition)
    543516    {
    544517        JumpProjectile* newProjectile = new JumpProjectile(center_->getContext());
     
    547520                newProjectile->addTemplate(center_->getProjectileTemplate());
    548521                newProjectile->setPosition(Vector3(xPosition, 0.0, zPosition));
    549                 newProjectile->setVelocity(Vector3(xVelocity, 0.0, zVelocity));
    550522                newProjectile->setFieldDimension(center_->getFieldDimension());
    551523                newProjectile->setFigure(this->figure_);
     
    554526    }
    555527
    556     void Jump::addEnemy1(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
     528    void Jump::addSpring(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
     529    {
     530        JumpSpring* newSpring = new JumpSpring(center_->getContext());
     531        if (newSpring != NULL && center_ != NULL)
     532                {
     533                newSpring->addTemplate(center_->getSpringTemplate());
     534                newSpring->setPosition(Vector3(xPosition, 0.0, zPosition));
     535                newSpring->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
     536                newSpring->setFigure(figure_);
     537                center_->attach(newSpring);
     538                }
     539    }
     540
     541    void Jump::addSpring(JumpPlatform* platform)
     542    {
     543        JumpSpring* newSpring = new JumpSpring(center_->getContext());
     544        if (newSpring != NULL && center_ != NULL)
     545                {
     546                newSpring->addTemplate(center_->getSpringTemplate());
     547                newSpring->setPosition(Vector3(0.0, 0.0, 0.0));
     548                newSpring->setProperties(-10.0, 10.0, -10.0, 10.0, 0.0, 0.0);
     549                newSpring->setFigure(figure_);
     550                platform->attach(newSpring);
     551                }
     552    }
     553
     554    void Jump::addRocket(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
     555    {
     556        JumpRocket* newRocket = new JumpRocket(center_->getContext());
     557        if (newRocket != NULL && center_ != NULL)
     558                {
     559                newRocket->addTemplate(center_->getRocketTemplate());
     560                newRocket->setPosition(Vector3(xPosition, 0.0, zPosition));
     561                newRocket->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
     562                newRocket->setFigure(figure_);
     563                center_->attach(newRocket);
     564                }
     565    }
     566
     567    void Jump::addRocket(JumpPlatform* platform)
     568    {
     569        JumpRocket* newRocket = new JumpRocket(center_->getContext());
     570        if (newRocket != NULL && center_ != NULL)
     571                {
     572                newRocket->addTemplate(center_->getRocketTemplate());
     573                newRocket->setPosition(Vector3(0.0, 0.0, 0.0));
     574                newRocket->setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
     575                newRocket->setFigure(figure_);
     576                platform->attach(newRocket);
     577                }
     578    }
     579
     580    void Jump::addPropeller(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
     581    {
     582        JumpPropeller* newPropeller = new JumpPropeller(center_->getContext());
     583        if (newPropeller != NULL && center_ != NULL)
     584                {
     585                newPropeller->addTemplate(center_->getPropellerTemplate());
     586                newPropeller->setPosition(Vector3(xPosition, 0.0, zPosition));
     587                newPropeller->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
     588                newPropeller->setFigure(figure_);
     589                center_->attach(newPropeller);
     590                }
     591    }
     592
     593    void Jump::addPropeller(JumpPlatform* platform)
     594    {
     595        JumpPropeller* newPropeller = new JumpPropeller(center_->getContext());
     596        if (newPropeller != NULL && center_ != NULL)
     597                {
     598                newPropeller->addTemplate(center_->getPropellerTemplate());
     599                newPropeller->setPosition(Vector3(0.0, 0.0, 0.0));
     600                newPropeller->setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
     601                newPropeller->setFigure(figure_);
     602                platform->attach(newPropeller);
     603                }
     604    }
     605
     606    void Jump::addBoots(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
     607    {
     608        JumpBoots* newBoots = new JumpBoots(center_->getContext());
     609        if (newBoots != NULL && center_ != NULL)
     610                {
     611                newBoots->addTemplate(center_->getBootsTemplate());
     612                newBoots->setPosition(Vector3(xPosition, 0.0, zPosition));
     613                newBoots->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
     614                newBoots->setFigure(figure_);
     615                center_->attach(newBoots);
     616                }
     617    }
     618
     619    void Jump::addBoots(JumpPlatform* platform)
     620    {
     621        JumpBoots* newBoots = new JumpBoots(center_->getContext());
     622        if (newBoots != NULL && center_ != NULL)
     623                {
     624                newBoots->addTemplate(center_->getBootsTemplate());
     625                newBoots->setPosition(Vector3(0.0, 0.0, 0.0));
     626                newBoots->setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
     627                newBoots->setFigure(figure_);
     628                platform->attach(newBoots);
     629                }
     630    }
     631
     632    void Jump::addShield(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
     633    {
     634        JumpShield* newShield = new JumpShield(center_->getContext());
     635        if (newShield != NULL && center_ != NULL)
     636                {
     637                newShield->addTemplate(center_->getShieldTemplate());
     638                newShield->setPosition(Vector3(xPosition, 0.0, zPosition));
     639                newShield->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
     640                newShield->setFigure(figure_);
     641                center_->attach(newShield);
     642                }
     643    }
     644
     645    void Jump::addShield(JumpPlatform* platform)
     646    {
     647        JumpShield* newShield = new JumpShield(center_->getContext());
     648        if (newShield != NULL && center_ != NULL)
     649                {
     650                newShield->addTemplate(center_->getShieldTemplate());
     651                newShield->setPosition(Vector3(0.0, 0.0, 0.0));
     652                newShield->setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
     653                newShield->setFigure(figure_);
     654                platform->attach(newShield);
     655                }
     656    }
     657
     658    void Jump::addEnemy(int type, float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
    557659    {
    558660        JumpEnemy* newEnemy = new JumpEnemy(center_->getContext());
    559661        if (newEnemy != NULL && center_ != NULL)
    560662                {
    561                 newEnemy->addTemplate(center_->getEnemy1Template());
     663                switch (type)
     664                {
     665                case 1:
     666                        newEnemy->addTemplate(center_->getEnemy1Template());
     667                        break;
     668                case 2:
     669                        newEnemy->addTemplate(center_->getEnemy2Template());
     670                        break;
     671                case 3:
     672                        newEnemy->addTemplate(center_->getEnemy3Template());
     673                        break;
     674                case 4:
     675                        newEnemy->addTemplate(center_->getEnemy4Template());
     676                        break;
     677                default:
     678                        return;
     679                }
     680
    562681                newEnemy->setPosition(Vector3(xPosition, 0.0, zPosition));
    563682                newEnemy->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
     
    573692
    574693                float sectionLength = center_->getSectionLength();
    575                 float platformLength = center_->getPlatformLength();
    576 
    577                 for (float xPosition = -center_->getFieldDimension().x; xPosition <= center_->getFieldDimension().x; xPosition += platformLength)
     694
     695                newPlatform = new JumpPlatformStatic(center_->getContext());
     696                addPlatform(newPlatform, center_->getPlatformStaticTemplate(), 0.0, -0.05*sectionLength);
     697
     698                platformWidth_ = newPlatform->getWidth();
     699                platformHeight_ = newPlatform->getHeight();
     700
     701                for (float xPosition = platformWidth_; xPosition <= center_->getFieldDimension().x; xPosition += platformWidth_)
    578702                {
    579703                        newPlatform = new JumpPlatformStatic(center_->getContext());
    580704                        addPlatform(newPlatform, center_->getPlatformStaticTemplate(), xPosition, -0.05*sectionLength);
     705                        newPlatform = new JumpPlatformStatic(center_->getContext());
     706                        addPlatform(newPlatform, center_->getPlatformStaticTemplate(), -xPosition, -0.05*sectionLength);
    581707                }
    582708    }
     
    586712        float fieldWidth = center_->getFieldDimension().x;
    587713        float sectionLength = center_->getSectionLength();
    588         float platformLength = center_->getPlatformLength();
    589 
    590         float sectionBegin = sectionNumber * sectionLength;
    591         float sectionEnd = (1.0 + sectionNumber) * sectionLength;
    592 
    593                 int randPos1 = rand()%10;
    594                 int randPos2 = rand()%10;
    595                 int randPos3 = rand()%10;
    596                 int randPos4 = rand()%10;
    597 
    598                 if (rand()%5 == 0)
    599                 {
    600                         addEnemy1(randomXPosition(), sectionBegin + sectionLength/10, -fieldWidth, fieldWidth, sectionBegin + sectionLength/10, sectionBegin + sectionLength/10, 5.0, 0.0);
    601                 }
    602 
    603         switch (rand()%12)
     714        float sectionBegin = sectionNumber_ * sectionLength;
     715        float sectionEnd = (1 + sectionNumber_) * sectionLength;
     716
     717        int numI = 6;
     718        int numJ = 4;
     719
     720        enum PlatformType
     721        {
     722                PLATFORM_EMPTY, PLATFORM_STATIC, PLATFORM_HMOVE, PLATFORM_VMOVE, PLATFORM_DISAPPEAR, PLATFORM_TIMER, PLATFORM_FAKE
     723        };
     724
     725        enum ItemType
     726        {
     727                ITEM_NOTHING, ITEM_SPRING, ITEM_PROPELLER, ITEM_ROCKET, ITEM_BOOTS, ITEM_SHIELD
     728        };
     729
     730        struct PlatformMatrix
     731        {
     732                PlatformType type;
     733            bool done;
     734        } matrix[numI][numJ];
     735
     736
     737                for (int i = 0; i < numI; ++i)
     738                {
     739                        for (int j = 0; j < numJ; ++j)
     740                        {
     741                                matrix[i][j].type = PLATFORM_EMPTY;
     742                                matrix[i][j].done = false;
     743                        }
     744                }
     745                PlatformType platformtype1;
     746                PlatformType platformtype2;
     747                ItemType itemType = ITEM_NOTHING;
     748
     749            if (rand()%2 == 0)
     750            {
     751                itemType = ITEM_SPRING;
     752            }
     753            else if (rand()%2 == 0 && sectionNumber_ > 3)
     754                switch(rand()%4)
    604755                {
    605756                case 0:
    606                         // Doppelt statisch
    607                         for (int i = 0; i < 10; ++i)
    608                         {
    609                                 for (int j = 0; j < 2; ++j)
    610                                 {
    611                                         addPlatformStatic(randomXPosition(2, j), sectionBegin + i*sectionLength/10);
    612                                 }
    613                         }
     757                        itemType = ITEM_PROPELLER;
    614758                        break;
    615759                case 1:
    616                         // Dreifach statisch
    617                         for (int i = 0; i < 10; ++i)
    618                         {
    619                                 for (int j = 0; j < 3; ++j)
    620                                 {
    621                                         addPlatformStatic(randomXPosition(3, j), sectionBegin + i*sectionLength/10);
    622                                 }
    623                         }
     760                        itemType = ITEM_ROCKET;
    624761                        break;
    625762                case 2:
    626                         // statisch mit 1 horizontal
    627                         for (int i = 0; i < 10; ++i)
    628                         {
    629                                 if (i == randPos1)
    630                                 {
    631                                         addPlatformHMove(randomXPosition(), sectionBegin + i*sectionLength/10, -fieldWidth, fieldWidth, 30.0);
    632                                 }
    633                                 else
    634                                 {
    635                                         addPlatformStatic(randomXPosition(), sectionBegin + i*sectionLength/10);
    636                                 }
    637                         }
     763                        itemType = ITEM_BOOTS;
    638764                        break;
    639765                case 3:
    640                         // statisch mit 2 horizontal
    641                         for (int i = 0; i < 10; ++i)
    642                         {
    643                                 if (i == randPos1 || i == randPos2)
     766                        itemType = ITEM_SHIELD;
     767                        break;
     768                default:
     769                        break;
     770                }
     771
     772                switch((sectionNumber_ > 28) ? rand()%29 : rand()%(sectionNumber_+1))
     773            {
     774            case 0:
     775                platformtype1 = PLATFORM_STATIC;
     776                platformtype2 = PLATFORM_STATIC;
     777                break;
     778            case 1:
     779                platformtype1 = PLATFORM_STATIC;
     780                platformtype2 = PLATFORM_STATIC;
     781                break;
     782            case 2:
     783              platformtype1 = PLATFORM_STATIC;
     784              platformtype2 = PLATFORM_HMOVE;
     785              break;
     786            case 3:
     787              platformtype1 = PLATFORM_STATIC;
     788              platformtype2 = PLATFORM_DISAPPEAR;
     789              break;
     790            case 4:
     791              platformtype1 = PLATFORM_STATIC;
     792              platformtype2 = PLATFORM_VMOVE;
     793              break;
     794            case 5:
     795              platformtype1 = PLATFORM_STATIC;
     796              platformtype2 = PLATFORM_TIMER;
     797              break;
     798            case 6:
     799              platformtype1 = PLATFORM_HMOVE;
     800              platformtype2 = PLATFORM_STATIC;
     801              break;
     802            case 7:
     803              platformtype1 = PLATFORM_HMOVE;
     804              platformtype2 = PLATFORM_HMOVE;
     805              break;
     806            case 8:
     807              platformtype1 = PLATFORM_HMOVE;
     808              platformtype2 = PLATFORM_HMOVE;
     809              break;
     810            case 9:
     811              platformtype1 = PLATFORM_HMOVE;
     812              platformtype2 = PLATFORM_DISAPPEAR;
     813              break;
     814            case 10:
     815              platformtype1 = PLATFORM_HMOVE;
     816              platformtype2 = PLATFORM_VMOVE;
     817              break;
     818            case 11:
     819              platformtype1 = PLATFORM_HMOVE;
     820              platformtype2 = PLATFORM_TIMER;
     821              break;
     822            case 12:
     823              platformtype1 = PLATFORM_DISAPPEAR;
     824              platformtype2 = PLATFORM_STATIC;
     825              break;
     826            case 13:
     827              platformtype1 = PLATFORM_DISAPPEAR;
     828              platformtype2 = PLATFORM_HMOVE;
     829              break;
     830            case 14:
     831              platformtype1 = PLATFORM_DISAPPEAR;
     832              platformtype2 = PLATFORM_DISAPPEAR;
     833              break;
     834            case 15:
     835              platformtype1 = PLATFORM_DISAPPEAR;
     836              platformtype2 = PLATFORM_DISAPPEAR;
     837              break;
     838            case 16:
     839              platformtype1 = PLATFORM_DISAPPEAR;
     840              platformtype2 = PLATFORM_VMOVE;
     841              break;
     842            case 17:
     843              platformtype1 = PLATFORM_DISAPPEAR;
     844              platformtype2 = PLATFORM_TIMER;
     845              break;
     846            case 18:
     847              platformtype1 = PLATFORM_VMOVE;
     848              platformtype2 = PLATFORM_STATIC;
     849              break;
     850            case 19:
     851              platformtype1 = PLATFORM_VMOVE;
     852              platformtype2 = PLATFORM_HMOVE;
     853              break;
     854            case 20:
     855              platformtype1 = PLATFORM_VMOVE;
     856              platformtype2 = PLATFORM_DISAPPEAR;
     857              break;
     858            case 21:
     859              platformtype1 = PLATFORM_VMOVE;
     860              platformtype2 = PLATFORM_VMOVE;
     861              break;
     862            case 22:
     863              platformtype1 = PLATFORM_VMOVE;
     864              platformtype2 = PLATFORM_VMOVE;
     865              break;
     866            case 23:
     867              platformtype1 = PLATFORM_VMOVE;
     868              platformtype2 = PLATFORM_TIMER;
     869              break;
     870            case 24:
     871              platformtype1 = PLATFORM_TIMER;
     872              platformtype2 = PLATFORM_STATIC;
     873              break;
     874            case 25:
     875              platformtype1 = PLATFORM_TIMER;
     876              platformtype2 = PLATFORM_HMOVE;
     877              break;
     878            case 26:
     879              platformtype1 = PLATFORM_TIMER;
     880              platformtype2 = PLATFORM_DISAPPEAR;
     881              break;
     882            case 27:
     883                platformtype1 = PLATFORM_TIMER;
     884                platformtype2 = PLATFORM_VMOVE;
     885                break;
     886            case 28:
     887                platformtype1 = PLATFORM_TIMER;
     888                platformtype2 = PLATFORM_TIMER;
     889                break;
     890            default:
     891                platformtype1 = PLATFORM_TIMER;
     892                platformtype2 = PLATFORM_TIMER;
     893                break;
     894            }
     895
     896            // Fill Matrix with selected platform types
     897            for (int i = 0; i < numI; ++ i)
     898            {
     899                          for (int j = 0; j < numJ; ++ j)
     900                          {
     901                                        if (rand()%(sectionNumber_+1) == 0)
     902                                        {
     903                                            matrix[i][j].type = platformtype1;
     904                                        }
     905                                        else
     906                                        {
     907                                                matrix[i][j].type = platformtype2;
     908                                        }
     909                                        matrix[i][j].done = false;
     910                          }
     911            }
     912
     913            // Delete some platforms or replace them with fake platforms
     914            if (platformtype1 == platformtype2 && sectionNumber_ > 10)
     915            {
     916                int j = rand()%numJ;
     917                        if (rand()%2 == 0)
     918                        {
     919                                for (int i = 0; i <= j; ++ i)
    644920                                {
    645                                         addPlatformHMove(randomXPosition(), sectionBegin + i*sectionLength/10, -fieldWidth, fieldWidth, 30.0);
     921                                    matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    646922                                }
    647                                 else
     923                        }
     924                        else
     925                        {
     926                            for (int i = 0; i <= j; ++ i)
    648927                                {
    649                                         addPlatformStatic(randomXPosition(), sectionBegin + i*sectionLength/10);
     928                                      matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
    650929                                }
    651930                        }
     931            }
     932
     933            std::vector<JumpPlatform*> platformList;
     934
     935            for (int i = 0; i < numI; ++ i)
     936            {
     937                for (int j = 0; j < numJ; ++ j)
     938                {
     939                    if (matrix[i][j].done == false)
     940                    {
     941                        float xPosition = 0.0;
     942                        float zPosition = 0.0;
     943                                float leftBoundary = 0.0;
     944                                float rightBoundary = 0.0;
     945                                float lowerBoundary = 0.0;
     946                                float upperBoundary = 0.0;
     947                                float xVelocity = 0.0;
     948                                float zVelocity = 0.0;
     949
     950                        switch(matrix[i][j].type)
     951                                    {
     952                                    case PLATFORM_EMPTY:
     953                                            matrix[i][j].done = true;
     954                                            break;
     955                                    case PLATFORM_STATIC:
     956                                                xPosition = randomXPosition(numJ, j);
     957                                                zPosition = sectionBegin + i*sectionLength/numI;
     958                                                platformList.push_back(addPlatformStatic(xPosition, zPosition));
     959                                                matrix[i][j].done = true;
     960                                        break;
     961                                    case PLATFORM_FAKE:
     962                                                xPosition = randomXPosition(numJ, j);
     963                                                zPosition = sectionBegin + i*sectionLength/numI;
     964                                                platformList.push_back(addPlatformFake(xPosition, zPosition));
     965                                            matrix[i][j].done = true;
     966                                        break;
     967                                    case PLATFORM_TIMER:
     968                                                xPosition = randomXPosition(numJ, j);
     969                                                zPosition = sectionBegin + i*sectionLength/numI;
     970                                                platformList.push_back(addPlatformTimer(xPosition, zPosition, 10.0, 1.5));
     971                                            matrix[i][j].done = true;
     972                                        break;
     973                                    case PLATFORM_DISAPPEAR:
     974                                                xPosition = randomXPosition(numJ, j);
     975                                                zPosition = sectionBegin + i*sectionLength/numI;
     976                                                platformList.push_back(addPlatformDisappear(xPosition, zPosition));
     977                                            matrix[i][j].done = true;
     978                                        break;
     979                                    case PLATFORM_HMOVE:
     980                                        xVelocity = randomSpeed();
     981                                            if (j <= numJ-3 && matrix[i][j+1].type == PLATFORM_HMOVE && matrix[i][j+2].type == PLATFORM_HMOVE && rand()%2 == 0)
     982                                            {
     983                                                leftBoundary = randomXPositionLeft(numJ, j);
     984                                                rightBoundary = randomXPositionRight(numJ, j+2);
     985                                                xPosition = randomPosition(leftBoundary, rightBoundary);
     986                                                        zPosition = sectionBegin + i*sectionLength/numI;
     987                                                        platformList.push_back(addPlatformHMove(xPosition, zPosition, leftBoundary, rightBoundary, xVelocity));
     988                                                matrix[i][j].done = true;
     989                                                matrix[i][j+1].done = true;
     990                                                matrix[i][j+2].done = true;
     991                                            }
     992                                            else if (j <= numJ-2 && matrix[i][j+1].type == PLATFORM_HMOVE && rand()%2 == 0)
     993                                            {
     994                                                leftBoundary = randomXPositionLeft(numJ, j);
     995                                                rightBoundary = randomXPositionRight(numJ, j+1);
     996                                                xPosition = randomPosition(leftBoundary, rightBoundary);
     997                                                        zPosition = sectionBegin + i*sectionLength/numI;
     998                                                        platformList.push_back(addPlatformHMove(xPosition, zPosition, leftBoundary, rightBoundary, xVelocity));
     999                                                matrix[i][j].done = true;
     1000                                                matrix[i][j+1].done = true;
     1001                                            }
     1002                                            else
     1003                                            {
     1004                                                leftBoundary = randomXPositionLeft(numJ, j);
     1005                                                rightBoundary = randomXPositionRight(numJ, j);
     1006                                                xPosition = randomPosition(leftBoundary, rightBoundary);
     1007                                                        zPosition = sectionBegin + i*sectionLength/numI;
     1008                                                        platformList.push_back(addPlatformHMove(xPosition, zPosition, leftBoundary, rightBoundary, xVelocity));
     1009                                                matrix[i][j].done = true;
     1010                                            }
     1011                                            break;
     1012                                    case PLATFORM_VMOVE:
     1013                                        zVelocity = randomSpeed();
     1014                                            if (i <= numI-3 && matrix[i+1][j].type == PLATFORM_VMOVE && matrix[i+2][j].type == PLATFORM_VMOVE && rand()%2 == 0)
     1015                                            {
     1016                                                lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
     1017                                                upperBoundary = randomZPositionUpper(numI, i+2, sectionBegin, sectionEnd);
     1018                                                zPosition = randomPosition(lowerBoundary, upperBoundary);
     1019                                                xPosition = randomXPosition(numJ, j);
     1020                                                platformList.push_back(addPlatformVMove(xPosition, zPosition, lowerBoundary, upperBoundary, zVelocity));
     1021                                                matrix[i][j].done = true;
     1022                                                matrix[i+1][j].done = true;
     1023                                                matrix[i+2][j].done = true;
     1024                                            }
     1025                                            else if (i <= numI-2 && matrix[i+1][j].type == PLATFORM_VMOVE && rand()%2 == 0)
     1026                                            {
     1027                                                lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
     1028                                                upperBoundary = randomZPositionUpper(numI, i+1, sectionBegin, sectionEnd);
     1029                                                zPosition = randomPosition(lowerBoundary, upperBoundary);
     1030                                                xPosition = randomXPosition(numJ, j);
     1031                                                platformList.push_back(addPlatformVMove(xPosition, zPosition, lowerBoundary, upperBoundary, zVelocity));
     1032                                                matrix[i][j].done = true;
     1033                                                matrix[i+1][j].done = true;
     1034                                            }
     1035                                            else
     1036                                            {
     1037                                                lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
     1038                                                upperBoundary = randomZPositionUpper(numI, i, sectionBegin, sectionEnd);
     1039                                                zPosition = randomPosition(lowerBoundary, upperBoundary);
     1040                                                xPosition = randomXPosition(numJ, j);
     1041                                                platformList.push_back(addPlatformVMove(xPosition, zPosition, lowerBoundary, upperBoundary, zVelocity));
     1042                                                matrix[i][j].done = true;
     1043                                            }
     1044                                            break;
     1045                                    default:
     1046                                        // ERROR
     1047                                        break;
     1048
     1049                        }
     1050
     1051                                        /*if (platformtype1 != PLATFORM_TIMER && platformtype2 != PLATFORM_TIMER)
     1052                                        {
     1053                                                switch (itemType)
     1054                                                {
     1055                                                case ITEM_SPRING:
     1056                                                        addSpring(xPosition, zPosition, leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
     1057                                                        itemType = ITEM_NOTHING;
     1058                                                        break;
     1059                                                case ITEM_ROCKET:
     1060                                                        addRocket(xPosition, zPosition, leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
     1061                                                        itemType = ITEM_NOTHING;
     1062                                                        break;
     1063                                                case ITEM_PROPELLER:
     1064                                                        addPropeller(xPosition, zPosition, leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
     1065                                                        itemType = ITEM_NOTHING;
     1066                                                        break;
     1067                                                case ITEM_BOOTS:
     1068                                                        addBoots(xPosition, zPosition, leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
     1069                                                        itemType = ITEM_NOTHING;
     1070                                                        break;
     1071                                                case ITEM_SHIELD:
     1072                                                        addShield(xPosition, zPosition, leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
     1073                                                        itemType = ITEM_NOTHING;
     1074                                                        break;
     1075                                                default:
     1076                                                        // ERROR
     1077                                                        break;
     1078                                                }
     1079                                        }*/
     1080                    }
     1081                }
     1082            }
     1083
     1084            //Add items
     1085        int numNewPlatforms = platformList.size();
     1086
     1087        if (numNewPlatforms > 0)
     1088        {
     1089                JumpPlatform* itemPlatform = platformList[rand()%numNewPlatforms];
     1090
     1091                        switch (ITEM_BOOTS)
     1092                        {
     1093                        case ITEM_SPRING:
     1094                                addSpring(itemPlatform);
     1095                                break;
     1096                        case ITEM_ROCKET:
     1097                                addRocket(itemPlatform);
     1098                                break;
     1099                        case ITEM_PROPELLER:
     1100                                addPropeller(itemPlatform);
     1101                                break;
     1102                        case ITEM_BOOTS:
     1103                                addBoots(itemPlatform);
     1104                                break;
     1105                        case ITEM_SHIELD:
     1106                                addShield(itemPlatform);
     1107                                break;
     1108                        default:
     1109                                break;
     1110                        }
     1111        }
     1112
     1113        if (sectionNumber_ >= 5 && rand()%3 == 0)
     1114        {
     1115                //  BEWEGUNG Verbessern, Grenzen anpassen !!!!!!!! Auch Vertikale Bewegung zulassen
     1116
     1117
     1118            switch(rand()%4)
     1119                {
     1120            case 0:
     1121                addEnemy(1, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth, fieldWidth, sectionBegin, sectionBegin + sectionLength, 5.0, 0.0);
     1122                break;
     1123            case 1:
     1124                addEnemy(2, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth, fieldWidth, sectionBegin, sectionBegin + sectionLength, 5.0, 0.0);
     1125                break;
     1126            case 2:
     1127                addEnemy(3, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth, fieldWidth, sectionBegin, sectionBegin + sectionLength, 5.0, 0.0);
     1128                break;
     1129            case 3:
     1130                addEnemy(4, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth, fieldWidth, sectionBegin, sectionBegin + sectionLength, 5.0, 0.0);
     1131                break;
     1132                }
     1133        }
     1134                ++ sectionNumber_;
     1135    }
     1136
     1137    bool Jump::addAdventure(int number)
     1138    {
     1139        float fieldWidth = center_->getFieldDimension().x;
     1140        float sectionLength = center_->getSectionLength();
     1141        float sectionBegin = sectionNumber_ * sectionLength;
     1142        sectionLength *= 2;
     1143
     1144        switch(number)
     1145        {
     1146        case 0:
     1147                        {
     1148                                int numI = 10;
     1149                                for (int i = 0; i < numI; ++ i)
     1150                                {
     1151                                        addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+i*sectionLength/numI);
     1152                                }
     1153                                break;
     1154                        }
     1155        case 1:
     1156                {
     1157                        int numI = 7;
     1158
     1159                        addPlatformStatic(0.0, sectionBegin);
     1160                        for (int i = 1; i < numI; ++ i)
     1161                        {
     1162                                addPlatformStatic((fieldWidth-platformWidth_/2)*i/numI, sectionBegin+i*sectionLength/numI);
     1163                                addPlatformStatic(-(fieldWidth-platformWidth_/2)*i/numI, sectionBegin+i*sectionLength/numI);
     1164                        }
    6521165                        break;
    653                 case 4:
    654                         // statisch mit 3 horizontal
    655                         for (int i = 0; i < 10; ++i)
    656                         {
    657                                 if (i == randPos1 || i == randPos2 || i == randPos3)
     1166                }
     1167        case 2:
     1168                        {
     1169                                int numI = 5;
     1170                                for (int i = 0; i < numI; ++ i)
    6581171                                {
    659                                         addPlatformHMove(randomXPosition(), sectionBegin + i*sectionLength/10, -fieldWidth, fieldWidth, 30.0);
     1172                                        addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin);
     1173                                        addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+sectionLength/5);
     1174                                        addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+sectionLength*2/5);
     1175                                        addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+sectionLength*3/5);
     1176                                        addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+sectionLength*4/5);
     1177                                        addEnemy(4, (2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+sectionLength/2, -fieldWidth, fieldWidth, sectionBegin, sectionBegin + sectionLength, 0.0, 0.0);
    6601178                                }
    661                                 else
    662                                 {
    663                                         addPlatformStatic(randomXPosition(), sectionBegin + i*sectionLength/10);
    664                                 }
    665                         }
    666                         break;
    667                 case 5:
    668                         // statisch mit 4 horizontal
    669                         for (int i = 0; i < 10; ++i)
    670                         {
    671                                 if (i == randPos1 || i == randPos2 || i == randPos3 || i == randPos4)
    672                                 {
    673                                         addPlatformHMove(randomXPosition(), sectionBegin + i*sectionLength/10, -fieldWidth, fieldWidth, 30.0);
    674                                 }
    675                                 else
    676                                 {
    677                                         addPlatformStatic(randomXPosition(), sectionBegin + i*sectionLength/10);
    678                                 }
    679                         }
    680                         break;
    681                         // Einfach horizontal
    682                 case 6:
    683                         for (int i = 0; i < 10; ++i)
    684                         {
    685                                 addPlatformHMove(randomXPosition(), sectionBegin + i*sectionLength/10, -fieldWidth, fieldWidth, 30.0);
    686                         }
    687                         break;
    688                         // Doppelt horizontal
    689                 case 7:
    690                         for (int i = 0; i < 10; ++i)
    691                         {
    692                                         float mediumPos = randomXPosition(3, 1);
    693                                         addPlatformHMove(randomXPosition(3, 0), sectionBegin + i*sectionLength/10, -fieldWidth, mediumPos - platformLength/2, 30.0);
    694                                         addPlatformHMove(randomXPosition(3, 2), sectionBegin + i*sectionLength/10, mediumPos+platformLength/2, fieldWidth, 30.0);
    695                         }
    696                         break;
    697                         // Einfach vertikal
    698                 case 8:
    699                         for (int i = 0; i < 7; ++i)
    700                         {
    701                                 addPlatformVMove(-fieldWidth + i*fieldWidth*2/10, randomYPosition(sectionBegin, sectionEnd), sectionBegin, sectionEnd, 20.0);
    702                         }
    703                         break;
    704                         // Doppelt vertikal
    705                 case 9:
    706                         for (int i = 0; i < 14; ++i)
    707                         {
    708                                 addPlatformVMove(-fieldWidth + i*fieldWidth*2/10, randomYPosition(sectionBegin, sectionEnd), sectionBegin, sectionEnd, 20.0);
    709                         }
    710                         break;
    711                         // Doppelt verschwindend
    712                 case 10:
    713                         for (int i = 0; i < 10; ++i)
    714                         {
    715                                 for (int j = 0; j < 2; ++j)
    716                                 {
    717                                         addPlatformDisappear(randomXPosition(2, j), randomYPosition(sectionBegin, sectionEnd));
    718                                 }
    719                         }
    720                         break;
    721                         // Doppelt Timer
    722                 case 11:
    723                         for (int i = 0; i < 10; ++i)
    724                         {
    725                                 for (int j = 0; j < 2; ++j)
    726                                 {
    727                                         addPlatformTimer(randomXPosition(2, j), randomYPosition(sectionBegin, sectionEnd), 6.0, 1.5);
    728                                 }
    729                         }
    730                         break;
    731                 }
    732                 orxout() << "new section added with number "<< sectionNumber << endl;
    733 
    734                 fakeAdded_ = false;
    735 
    736                 ++ sectionNumber;
     1179                                break;
     1180                        }
     1181        default:
     1182                return false;
     1183        }
     1184        sectionNumber_ +=2;
     1185        return true;
    7371186    }
    7381187
     
    7461195    float Jump::randomXPosition(int totalColumns, int culomn)
    7471196    {
    748         float fieldWidth = center_->getFieldDimension().x;
    749 
    750         float width = 2*fieldWidth/totalColumns;
    751         float leftBound = culomn*width-fieldWidth;
    752         float platformLength = center_->getPlatformLength();
    753 
    754         return (float)(rand()%(int)(width-platformLength)) + leftBound + platformLength/2;
    755     }
    756 
    757     float Jump::randomYPosition(float lowerBoundary, float upperBoundary)
    758     {
     1197        float fieldWidth = center_->getFieldDimension().x; //Width of the half field
     1198
     1199        float halfWidth = fieldWidth/totalColumns; //Width of a half column
     1200        float leftBound = culomn*halfWidth*2-fieldWidth; //Left beginning of the column
     1201        float rightBound = leftBound + 2*halfWidth;
     1202
     1203        return randomPosition(leftBound+platformWidth_/2, rightBound-platformWidth_/2);
     1204    }
     1205
     1206    float Jump::randomXPositionLeft(int totalColumns, int culomn)
     1207    {
     1208        float fieldWidth = center_->getFieldDimension().x; //Width of the half field
     1209
     1210        float halfWidth = fieldWidth/totalColumns; //Width of a half column
     1211        float leftBound = culomn*halfWidth*2-fieldWidth; //LeftBeginning of the column
     1212        float rightBound = leftBound + 2*halfWidth/3;
     1213
     1214        return randomPosition(leftBound+platformWidth_/2, rightBound-platformWidth_/2);
     1215    }
     1216
     1217    float Jump::randomXPositionRight(int totalColumns, int culomn)
     1218    {
     1219        float fieldWidth = center_->getFieldDimension().x; //Width of the half field
     1220
     1221        float halfWidth = fieldWidth/totalColumns; //Width of a half column
     1222        float rightBound = (culomn+1)*halfWidth*2-fieldWidth;
     1223        float leftBound = rightBound - 2*halfWidth/3;
     1224        return randomPosition(leftBound+platformWidth_/2, rightBound-platformWidth_/2);
     1225    }
     1226
     1227    float Jump::randomZPosition(int totalRows, int row, float sectionBegin, float SectionEnd)
     1228    {
     1229        float fieldHeight = SectionEnd - sectionBegin; //Heigt of the half field
     1230        float halfHeight = fieldHeight/totalRows; //Height of a half row
     1231        float lowerBound = row*halfHeight*2+sectionBegin; //Lower beginning of the row
     1232        float upperBound = lowerBound + 2*halfHeight;
     1233
     1234        return randomPosition(lowerBound+platformHeight_/2, upperBound-platformHeight_/2);
     1235    }
     1236
     1237    float Jump::randomZPositionLower(int totalRows, int row, float sectionBegin, float SectionEnd)
     1238    {
     1239        float fieldHeight = SectionEnd - sectionBegin; //Heigt of the half field
     1240        float rowHeight = fieldHeight/totalRows; //Height of a row
     1241        float lowerBound = row*rowHeight+sectionBegin; //Lower beginning of the row
     1242        float upperBound = lowerBound + rowHeight/3;
     1243
     1244        return randomPosition(lowerBound+platformHeight_/2, upperBound-platformHeight_/2);
     1245    }
     1246
     1247    float Jump::randomZPositionUpper(int totalRows, int row, float sectionBegin, float SectionEnd)
     1248    {
     1249        float fieldHeight = SectionEnd - sectionBegin; //Heigt of the half field
     1250        float rowHeight = fieldHeight/totalRows; //Height of a row
     1251        float lowerBound = (row+1)*rowHeight+sectionBegin; //Upper end of the row
     1252        float upperBound = lowerBound - rowHeight/3;
     1253
     1254        return randomPosition(lowerBound+platformHeight_/2, upperBound-platformHeight_/2);
     1255    }
     1256
     1257    float Jump::randomPosition(float lowerBoundary, float upperBoundary)
     1258    {
     1259        if (lowerBoundary >= upperBoundary)
     1260        {
     1261                return (lowerBoundary + upperBoundary)/2;
     1262        }
     1263
    7591264        return (float)(rand()%(int)(100*(upperBoundary - lowerBoundary)))/100 + lowerBoundary;
    7601265    }
    7611266
     1267    float Jump::randomSpeed()
     1268    {
     1269        float platformSpeed = center_->getPlatformSpeed();
     1270        return randomPosition(0.5*platformSpeed, 1.5*platformSpeed);
     1271    }
     1272
    7621273    int Jump::getScore(PlayerInfo* player) const
    7631274    {
    764         return sectionNumber - 2;
    765     }
    766 
     1275        return sectionNumber_ - 2;
     1276    }
     1277
     1278    bool Jump::getDead(PlayerInfo* player) const
     1279    {
     1280        return figure_->dead_;
     1281    }
    7671282}
  • code/branches/pickupsFS14/src/modules/jump/Jump.h

    r10050 r10074  
    8181
    8282            int getScore(PlayerInfo* player) const;
     83            bool getDead(PlayerInfo* player) const;
    8384
    8485            /**
     
    8788            */
    8889            void setCenterpoint(JumpCenterpoint* center)
    89                 { this->center_ = center; }
     90                { center_ = center; }
    9091            void setConfigValues(); //!< Makes scoreLimit configurable.
    9192
     
    9394
    9495        protected:
    95             virtual void spawnPlayersIfRequested(); //!< Spawns players, and fills the rest up with bots.
    96 
    9796            void startBall(); //!< Starts the ball with some default speed.
    9897            void cleanup(); //!< Cleans up the Gametype by destroying the ball and the bats.
     
    10099            virtual void addPlatform(JumpPlatform* newPlatform, std::string platformTemplate, float xPosition, float zPosition);
    101100
    102             virtual void addPlatformStatic(float xPosition, float zPosition);
    103             virtual void addPlatformHMove(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float speed);
    104             virtual void addPlatformVMove(float xPosition, float zPosition, float lowerBoundary, float upperBoundary, float speed);
    105             virtual void addPlatformDisappear(float xPosition, float zPosition);
    106             virtual void addPlatformTimer(float xPosition, float zPosition, float time, float variance);
    107             virtual void addPlatformFake(float xPosition, float zPosition);
    108             virtual void addProjectile(float xPosition, float zPosition, float xVelocity, float zVelocity);
    109             virtual void addEnemy1(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
     101            virtual JumpPlatformStatic* addPlatformStatic(float xPosition, float zPosition);
     102            virtual JumpPlatformHMove* addPlatformHMove(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float speed);
     103            virtual JumpPlatformVMove* addPlatformVMove(float xPosition, float zPosition, float lowerBoundary, float upperBoundary, float speed);
     104            virtual JumpPlatformDisappear* addPlatformDisappear(float xPosition, float zPosition);
     105            virtual JumpPlatformTimer* addPlatformTimer(float xPosition, float zPosition, float time, float variance);
     106            virtual JumpPlatformFake* addPlatformFake(float xPosition, float zPosition);
     107            virtual void addProjectile(float xPosition, float zPosition);
     108            virtual void addEnemy(int type, float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
     109            virtual void addSpring(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
     110            virtual void addSpring(JumpPlatform* platform);
     111            virtual void addRocket(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
     112            virtual void addRocket(JumpPlatform* platform);
     113            virtual void addPropeller(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
     114            virtual void addPropeller(JumpPlatform* platform);
     115            virtual void addBoots(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
     116            virtual void addBoots(JumpPlatform* platform);
     117            virtual void addShield(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
     118            virtual void addShield(JumpPlatform* platform);
    110119
    111120            virtual void addStartSection();
    112121            virtual void addSection();
     122            virtual bool addAdventure(int number);
    113123
    114124            virtual float randomXPosition();
    115125            virtual float randomXPosition(int totalColumns, int culomn);
    116             virtual float randomYPosition(float lowerBoundary, float upperBoundary);
     126            virtual float randomXPositionLeft(int totalColumns, int culomn);
     127            virtual float randomXPositionRight(int totalColumns, int culomn);
     128            virtual float randomZPosition(int totalRows, int row, float sectionBegin, float SectionEnd);
     129            virtual float randomZPositionLower(int totalRows, int row, float sectionBegin, float SectionEnd);
     130            virtual float randomZPositionUpper(int totalRows, int row, float sectionBegin, float SectionEnd);
     131
     132            virtual float randomPosition(float lowerBoundary, float upperBoundary);
     133            virtual float randomSpeed();
    117134
    118135            WeakPtr<JumpCenterpoint> center_; //!< The playing field.
    119136            WeakPtr<JumpFigure> figure_; //!< The two bats.
    120137            WeakPtr<Camera> camera;
    121             Timer starttimer_; //!< A timer to delay the start of the game.
    122138            int scoreLimit_; //!< If a player scored that much points, the game is ended.
    123139
    124140            float totalScreenShift;
    125141            float screenShiftSinceLastUpdate;
    126             int sectionNumber;
    127 
    128             bool fakeAdded_;
     142            int sectionNumber_;
     143            int adventureNumber_;
     144            float platformWidth_;
     145            float platformHeight_;
    129146    };
    130147}
  • code/branches/pickupsFS14/src/modules/jump/JumpCenterpoint.cc

    r10050 r10074  
    5555        height_ = 120;
    5656        sectionLength_ = 120;
     57        platformSpeed_ = 20.0;
    5758
    58         this->checkGametype();
     59        checkGametype();
    5960    }
    6061
     
    6970        XMLPortParam(JumpCenterpoint, "dimension", setFieldDimension, getFieldDimension, xmlelement, mode);
    7071        XMLPortParam(JumpCenterpoint, "sectionLength", setSectionLength, getSectionLength, xmlelement, mode);
    71         XMLPortParam(JumpCenterpoint, "platformLength", setPlatformLength, getPlatformLength, xmlelement, mode);
     72        XMLPortParam(JumpCenterpoint, "platformSpeed", setPlatformSpeed, getPlatformSpeed, xmlelement, mode);
     73        XMLPortParam(JumpCenterpoint, "cameraOffset", setCameraOffset, getCameraOffset, xmlelement, mode);
    7274        XMLPortParam(JumpCenterpoint, "platformStaticTemplate", setPlatformStaticTemplate, getPlatformStaticTemplate, xmlelement, mode);
    7375        XMLPortParam(JumpCenterpoint, "platformHMoveTemplate", setPlatformHMoveTemplate, getPlatformHMoveTemplate, xmlelement, mode);
     
    7880        XMLPortParam(JumpCenterpoint, "figureTemplate", setFigureTemplate, getFigureTemplate, xmlelement, mode);
    7981        XMLPortParam(JumpCenterpoint, "projectileTemplate", setProjectileTemplate, getProjectileTemplate, xmlelement, mode);
     82        XMLPortParam(JumpCenterpoint, "springTemplate", setSpringTemplate, getSpringTemplate, xmlelement, mode);
     83        XMLPortParam(JumpCenterpoint, "rocketTemplate", setRocketTemplate, getRocketTemplate, xmlelement, mode);
     84        XMLPortParam(JumpCenterpoint, "propellerTemplate", setPropellerTemplate, getPropellerTemplate, xmlelement, mode);
     85        XMLPortParam(JumpCenterpoint, "bootsTemplate", setBootsTemplate, getBootsTemplate, xmlelement, mode);
     86        XMLPortParam(JumpCenterpoint, "shieldTemplate", setShieldTemplate, getShieldTemplate, xmlelement, mode);
    8087        XMLPortParam(JumpCenterpoint, "enemy1Template", setEnemy1Template, getEnemy1Template, xmlelement, mode);
     88        XMLPortParam(JumpCenterpoint, "enemy2Template", setEnemy2Template, getEnemy2Template, xmlelement, mode);
     89        XMLPortParam(JumpCenterpoint, "enemy3Template", setEnemy3Template, getEnemy3Template, xmlelement, mode);
     90        XMLPortParam(JumpCenterpoint, "enemy4Template", setEnemy4Template, getEnemy4Template, xmlelement, mode);
    8191    }
    8292
     
    90100
    91101        // Check, whether it's still Jump.
    92         this->checkGametype();
     102        checkGametype();
    93103    }
    94104
  • code/branches/pickupsFS14/src/modules/jump/JumpCenterpoint.h

    r10050 r10074  
    9999        @endcode
    100100        As can be seen, there are actually two templates. The first template is needed to set the camera for the @ref orxonox::JumpFigure "JumpFigure". The second template ist the actual template for the @ref orxonox::JumpFigure "JumpFigure", the template for the camera position is added and a @ref orxonox::Model "Model" for the @ref orxonox::JumpFigure "JumpFigure" is attached.
    101        
     101        propellerTemplate_
    102102        Finally the JumpCenterpoint is created.
    103103        @code
     
    171171                { return this->projectileTemplate_; }
    172172
     173            void setSpringTemplate(const std::string& newTemplate)
     174                { this->springTemplate_ = newTemplate; }
     175
     176            const std::string& getSpringTemplate() const
     177                { return this->springTemplate_; }
     178
     179            void setRocketTemplate(const std::string& newTemplate)
     180                { this->rocketTemplate_ = newTemplate; }
     181
     182            const std::string& getRocketTemplate() const
     183                { return this->rocketTemplate_; }
     184
     185            void setPropellerTemplate(const std::string& newTemplate)
     186                { this->propellerTemplate_ = newTemplate; }
     187
     188            const std::string& getPropellerTemplate() const
     189                { return this->propellerTemplate_; }
     190
     191            void setBootsTemplate(const std::string& newTemplate)
     192                { this->bootsTemplate_ = newTemplate; }
     193
     194            const std::string& getBootsTemplate() const
     195                { return this->bootsTemplate_; }
     196
     197            void setShieldTemplate(const std::string& newTemplate)
     198                { this->shieldTemplate_ = newTemplate; }
     199
     200            const std::string& getShieldTemplate() const
     201                { return this->shieldTemplate_; }
     202
    173203            void setFigureTemplate(const std::string& newTemplate)
    174204                { this->figureTemplate_ = newTemplate; }
     
    182212            const std::string& getEnemy1Template() const
    183213                { return this->enemy1Template_; }
     214
     215            void setEnemy2Template(const std::string& newTemplate)
     216                { this->enemy2Template_ = newTemplate; }
     217
     218            const std::string& getEnemy2Template() const
     219                { return this->enemy2Template_; }
     220
     221            void setEnemy3Template(const std::string& newTemplate)
     222                { this->enemy3Template_ = newTemplate; }
     223
     224            const std::string& getEnemy3Template() const
     225                { return this->enemy3Template_; }
     226
     227            void setEnemy4Template(const std::string& newTemplate)
     228                { this->enemy4Template_ = newTemplate; }
     229
     230            const std::string& getEnemy4Template() const
     231                { return this->enemy4Template_; }
    184232
    185233
     
    210258                { return sectionLength_; }
    211259
    212             /**
    213             @brief Set the dimensions of the playing field.
    214             @param dimension A vector with the width of the playing field as first component and the height as second.
    215             */
    216             void setPlatformLength(const float platformLength)
    217                 { this->platformLength_ = platformLength; }
    218             /**
    219             @brief Get the dimensions of the playing field.
    220             @return Returns a vector with the width of the playing field as first component and the height as second.
    221             */
    222             float getPlatformLength() const
    223                 { return platformLength_; }
     260            void setPlatformSpeed(const float platformSpeed)
     261                { this->platformSpeed_ = platformSpeed; }
     262
     263            float getPlatformSpeed() const
     264                { return platformSpeed_; }
     265
     266            void setCameraOffset(const float cameraOffset)
     267                { this->cameraOffset_ = cameraOffset; }
     268
     269            float getCameraOffset() const
     270                { return cameraOffset_; }
     271
    224272
    225273        private:
     
    233281            std::string platformFakeTemplate_; //!< The template for the ball.
    234282            std::string projectileTemplate_; //!< The template for the ball.
     283            std::string springTemplate_; //!< The template for the ball.
     284            std::string rocketTemplate_; //!< The template for the ball.
     285            std::string propellerTemplate_; //!< The template for the ball.
     286            std::string bootsTemplate_; //!< The template for the ball.
     287            std::string shieldTemplate_; //!< The template for the ball.
    235288            std::string figureTemplate_; //!< The template for the bats.
    236289            std::string enemy1Template_; //!< The template for the bats.
     290            std::string enemy2Template_; //!< The template for the bats.
     291            std::string enemy3Template_; //!< The template for the bats.
     292            std::string enemy4Template_; //!< The template for the bats.
    237293
    238294            float width_; //!< The height of the playing field.
    239295            float height_; //!< The width of the playing field.
    240296            float sectionLength_; //!< Height of one section
    241             float platformLength_; // Avoids intersecting platforms
     297            float platformSpeed_; //!< Height of one section
     298            float cameraOffset_; //!< Height of one section
    242299    };
    243300}
  • code/branches/pickupsFS14/src/modules/jump/JumpEnemy.cc

    r10050 r10074  
    5656        RegisterObject(JumpEnemy);
    5757
    58         this->figure_ = 0;
     58        dead_ = false;
     59        figure_ = 0;
     60        width_ = 0.0;
     61        height_ = 0.0;
     62        setPosition(Vector3(0,0,0));
     63        setVelocity(Vector3(0,0,0));
     64        setAcceleration(Vector3(0,0,0));
    5965        setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    60         this->setPosition(Vector3(0,0,0));
    61         this->setVelocity(Vector3(0,0,0));
    62         this->setAcceleration(Vector3(0,0,0));
    6366    }
    6467
     
    8285    {
    8386        SUPER(JumpEnemy, XMLPort, xmlelement, mode);
     87
     88        XMLPortParam(JumpEnemy, "height", setHeight, getHeight, xmlelement, mode);
     89        XMLPortParam(JumpEnemy, "width", setWidth, getWidth, xmlelement, mode);
    8490    }
    8591
     
    116122
    117123
     124        // Interact with Figure
     125        Vector3 enemyPosition = getPosition();
     126
     127        if (figure_ != NULL)
     128        {
     129            Vector3 figurePosition = figure_->getPosition();
     130            if(figurePosition.x > enemyPosition.x-width_ && figurePosition.x < enemyPosition.x+width_ && figurePosition.z > enemyPosition.z-height_ && figurePosition.z < enemyPosition.z+height_)
     131            {
     132                touchFigure();
     133            }
     134        }
    118135    }
    119136
     
    141158    void JumpEnemy::touchFigure()
    142159    {
    143 
     160        if (dead_ == false)
     161        {
     162                figure_->CollisionWithEnemy(this);
     163        }
    144164    }
    145165}
  • code/branches/pickupsFS14/src/modules/jump/JumpEnemy.h

    r10050 r10074  
    8787                { return Vector2(this->fieldWidth_, this->fieldHeight_); }
    8888
     89            void setWidth(const float width)
     90                { this->width_ = width; }
     91            float getWidth() const
     92                { return width_; }
     93            void setHeight(const float height)
     94                { this->height_ = height; }
     95            float getHeight() const
     96                { return height_; }
     97
    8998            virtual void setProperties(float newLeftBoundary, float newRightBoundary, float newLowerBoundary, float newUpperBoundary, float newHSpeed, float newVSpeed);
    9099
    91100            void setFigure(WeakPtr<JumpFigure> bats); //!< Set the bats for the ball.
     101            virtual void touchFigure();
     102            bool dead_;
     103        protected:
    92104
    93             virtual void touchFigure();
     105            float width_;
     106            float height_;
    94107
    95         protected:
    96108            float fieldWidth_; //!< The width of the playing field.
    97109            float fieldHeight_; //!< The height of the playing field.
  • code/branches/pickupsFS14/src/modules/jump/JumpFigure.cc

    r10050 r10074  
    4949        RegisterObject(JumpFigure);
    5050
    51         this->movement_ = 0;
    52         this->bMoveLocal_ = false;
    53         this->length_ = 0.25;
    54         this->fieldWidth_ = 180;
    55         this->bSteadiedPosition_ = false;
     51        leftHand_ = NULL;
     52        rightHand_ = NULL;
     53
     54        fieldHeight_ = 0;
     55        fieldWidth_ = 0;
     56
     57        jumpSpeed_ = 0.0;
     58        handSpeed_ = 0.0;
     59        handMaxAngle_ = 0.0;
     60        handMinAngle_ = 0.0;
     61        rocketPos_ = 0.0;
     62        propellerPos_ = 0.0;
     63        bootsPos_ = 0.0;
    5664
    5765        moveUpPressed = false;
     
    6674        mouseFactor_ = 75.0;
    6775        maxFireRate = 0.3;
     76
     77        handAngle_ = 0.0;
     78        animateHands_ = false;
     79        turnUp_ = false;
     80
     81        rocketActive_ = false;
     82        propellerActive_ = false;
     83        bootsActive_ = false;
     84        shieldActive_ = false;
     85        rocketSpeed_ = 0.0;
     86        propellerSpeed_ = 0.0;
     87
     88        dead_ = false;
    6889    }
    6990
     
    7697        SUPER(JumpFigure, XMLPort, xmlelement, mode);
    7798        XMLPortParam(JumpFigure, "mouseFactor", setMouseFactor, getMouseFactor, xmlelement, mode);
     99        XMLPortParam(JumpFigure, "modelLefthand", setModelLeftHand, getModelLeftHand, xmlelement, mode);
     100        XMLPortParam(JumpFigure, "modelRighthand", setModelRightHand, getModelRightHand, xmlelement, mode);
     101        XMLPortParam(JumpFigure, "rocketPos", setRocketPos, getRocketPos, xmlelement, mode);
     102        XMLPortParam(JumpFigure, "propellerPos", setPropellerPos, getPropellerPos, xmlelement, mode);
     103        XMLPortParam(JumpFigure, "bootsPos", setBootsPos, getBootsPos, xmlelement, mode);
     104        XMLPortParam(JumpFigure, "jumpSpeed", setJumpSpeed, getJumpSpeed, xmlelement, mode);
     105        XMLPortParam(JumpFigure, "rocketSpeed", setRocketSpeed, getRocketSpeed, xmlelement, mode);
     106        XMLPortParam(JumpFigure, "propellerSpeed", setPropellerSpeed, getPropellerSpeed, xmlelement, mode);
     107        XMLPortParam(JumpFigure, "handMinAngle", setHandMinAngle, getHandMinAngle, xmlelement, mode);
     108        XMLPortParam(JumpFigure, "handMaxAngle", setHandMaxAngle, getHandMaxAngle, xmlelement, mode);
     109        XMLPortParam(JumpFigure, "handSpeed", setHandSpeed, getHandSpeed, xmlelement, mode);
    78110    }
    79111
     
    90122
    91123        // If the bat is controlled (but not over the network).
    92         if (this->hasLocalController())
     124        if (hasLocalController())
    93125        {
    94126                timeSinceLastFire += dt;
    95127
    96             /*if (this->movement_ != 0)
    97             {
    98                 // The absolute value of the movement is restricted to be lesser or equal than the speed of the bat.
    99                 this->movement_ = clamp(this->movement_, -1.0f, 1.0f) * this->speed_;
    100 
    101                 // If moveRightLeft() is used the movement is dependento on wehther it is the right or the left bat, so, it is i.e. dependent on the orientation of the bat.
    102                 if (this->bMoveLocal_)
    103                     this->setVelocity(this->getOrientation() * Vector3(this->movement_, 0, 0));
    104                 else
    105                     this->setVelocity(0, 0, this->movement_);
    106 
    107                 this->movement_ = 0;
    108                 this->bSteadiedPosition_ = false;
    109             }
    110             // If there is no movement but the position has not been steadied, the velocity is set to zero and the position is reaffirmed.
    111             else if (!this->bSteadiedPosition_)
    112             {
    113                 // To ensure network synchronicity
    114                 this->setVelocity(0, 0, 0);
    115                 this->setPosition(this->getPosition());
    116                 this->bSteadiedPosition_ = true;
    117             }*/
    118 
    119 
     128                // Move up/down
    120129                Vector3 velocity = getVelocity();
    121 
    122                 velocity.z -= gravityAcceleration;
    123 
    124                 /*if (moveLeftPressed == true)
    125                 {
    126                         velocity.x = -accelerationFactor;
    127                         moveLeftPressed = false;
    128                 }
    129                 if (moveRightPressed == true)
    130                 {
    131                         velocity.x = accelerationFactor;
    132                         moveRightPressed = false;
    133                 }*/
    134 
    135                 velocity.x = -mouseFactor_*horizontalSpeed;
    136 
     130                if (rocketActive_ == true)
     131                {
     132                        velocity.z = rocketSpeed_;
     133                }
     134                else if (propellerActive_ == true)
     135                {
     136                        velocity.z = propellerSpeed_;
     137                }
     138                else
     139                {
     140                        velocity.z -= gravityAcceleration;
     141                }
     142
     143                // Animate Hands
     144                if (animateHands_ == true)
     145                {
     146                        if (turnUp_ == true)
     147                        {
     148                                handAngle_ += handSpeed_ * dt;
     149                        }
     150                        else
     151                                {
     152                                        handAngle_ -= handSpeed_ * dt;
     153                                }
     154                if (handAngle_ > handMaxAngle_)
     155                {
     156                        turnUp_ = false;
     157                }
     158                if (handAngle_ <= handMinAngle_)
     159                {
     160                        animateHands_ = false;
     161                }
     162
     163                                if (leftHand_ != NULL)
     164                                {
     165                                        leftHand_->setOrientation(Vector3(0.0, 1.0, 0.0), Degree(-handAngle_));
     166                                }
     167                                if (rightHand_ != NULL)
     168                                {
     169                                        rightHand_->setOrientation(Vector3(0.0, 1.0, 0.0), Degree(handAngle_));
     170                                }
     171                }
     172
     173                // Move left/right
     174                if (dead_ == false)
     175                {
     176                        velocity.x = -mouseFactor_*horizontalSpeed;
     177                }
     178                else
     179                {
     180                        velocity.x = 0.0;
     181                }
     182
     183                // Cheats
    137184                if (moveUpPressed == true)
    138185                {
    139186                        velocity.z = 200.0f;
    140187                        moveUpPressed = false;
     188                        dead_ = false;
    141189                }
    142190                if (moveDownPressed == true)
     
    146194
    147195                setVelocity(velocity);
     196
    148197
    149198                if (firePressed && timeSinceLastFire >= maxFireRate)
     
    156205        }
    157206
    158         Vector3 position = this->getPosition();
    159 
     207        // Move through the left and right screen boundaries
     208        Vector3 position = getPosition();
    160209        if (position.x < -fieldWidth_*1.1)
    161210        {
     
    166215                position.x = -fieldWidth_*1.1;
    167216        }
    168 
    169         this->setPosition(position);
    170 
     217        setPosition(position);
     218
     219        // Reset key variables
    171220        moveUpPressed = false;
    172221        moveDownPressed = false;
     
    178227    void JumpFigure::JumpFromPlatform(JumpPlatform* platform)
    179228    {
    180         Vector3 velocity = getVelocity();
    181         velocity.z = 200.0f;
    182         setVelocity(velocity);
    183     }
    184 
     229        if (dead_ == false)
     230        {
     231                Vector3 velocity = getVelocity();
     232                velocity.z = (bootsActive_ ? 1.2*jumpSpeed_ : jumpSpeed_);
     233                setVelocity(velocity);
     234
     235                animateHands_ = true;
     236                handAngle_ = 0.0;
     237                turnUp_ = true;
     238        }
     239    }
     240
     241    void JumpFigure::JumpFromSpring(JumpSpring* spring)
     242    {
     243        if (dead_ == false)
     244        {
     245                Vector3 velocity = getVelocity();
     246                velocity.z = 1.2*jumpSpeed_;
     247                setVelocity(velocity);
     248        }
     249    }
     250
     251    void JumpFigure::CollisionWithEnemy(JumpEnemy* enemy)
     252        {
     253        if (rocketActive_ == false && propellerActive_ == false && shieldActive_ == false)
     254                {
     255                        dead_ = true;
     256                }
     257        }
     258
     259    bool JumpFigure::StartRocket(JumpRocket* rocket)
     260    {
     261        if (rocketActive_ == false && propellerActive_ == false && bootsActive_ == false)
     262        {
     263                attach(rocket);
     264                rocket->setPosition(0.0, rocketPos_, 0.0);
     265                rocket->setVelocity(0.0, 0.0, 0.0);
     266                rocketActive_ = true;
     267
     268                return true;
     269        }
     270
     271        return false;
     272    }
     273
     274    void JumpFigure::StopRocket(JumpRocket* rocket)
     275    {
     276                rocket->setPosition(0.0, 0.0, -1000.0);
     277        rocket->setVelocity(0.0, 0.0, 0.0);
     278        detach(rocket);
     279                rocket->destroy();
     280                rocketActive_ = false;
     281    }
     282
     283    bool JumpFigure::StartPropeller(JumpPropeller* propeller)
     284    {
     285        if (rocketActive_ == false && propellerActive_ == false && bootsActive_ == false)
     286        {
     287                attach(propeller);
     288                propeller->setPosition(0.0, 0.0, propellerPos_);
     289                propeller->setVelocity(0.0, 0.0, 0.0);
     290                propellerActive_ = true;
     291
     292                return true;
     293        }
     294
     295        return false;
     296    }
     297
     298    void JumpFigure::StopPropeller(JumpPropeller* propeller)
     299    {
     300        propeller->setPosition(0.0, 0.0, -1000.0);
     301        propeller->setVelocity(0.0, 0.0, 0.0);
     302        detach(propeller);
     303        propeller->destroy();
     304        propellerActive_ = false;
     305    }
     306
     307    bool JumpFigure::StartBoots(JumpBoots* boots)
     308    {
     309        if (rocketActive_ == false && propellerActive_ == false && bootsActive_ == false)
     310        {
     311                attach(boots);
     312                boots->setPosition(0.0, 0.0, bootsPos_);
     313                boots->setVelocity(0.0, 0.0, 0.0);
     314                bootsActive_ = true;
     315
     316                return true;
     317        }
     318
     319        return false;
     320    }
     321
     322    void JumpFigure::StopBoots(JumpBoots* boots)
     323    {
     324        boots->setPosition(0.0, 0.0, -1000.0);
     325        boots->setVelocity(0.0, 0.0, 0.0);
     326        detach(boots);
     327        boots->destroy();
     328        bootsActive_ = false;
     329    }
     330
     331    bool JumpFigure::StartShield(JumpShield* shield)
     332    {
     333        if (shieldActive_ == false)
     334        {
     335                attach(shield);
     336                shield->setPosition(0.0, 0.0, propellerPos_);
     337                shield->setVelocity(0.0, 0.0, 0.0);
     338                shieldActive_ = true;
     339
     340                return true;
     341        }
     342
     343        return false;
     344    }
     345
     346    void JumpFigure::StopShield(JumpShield* shield)
     347    {
     348        shield->setPosition(0.0, 0.0, -1000.0);
     349        shield->setVelocity(0.0, 0.0, 0.0);
     350        detach(shield);
     351        shield->destroy();
     352        shieldActive_ = false;
     353    }
     354
     355    void JumpFigure::InitializeAnimation(Context* context)
     356    {
     357        leftHand_ = new Model(context);
     358        rightHand_ = new Model(context);
     359
     360        leftHand_->addTemplate(modelLeftHand_);
     361        rightHand_->addTemplate(modelRightHand_);
     362
     363                attach(leftHand_);
     364                attach(rightHand_);
     365    }
    185366
    186367    /**
    187     @brief
     368    @briefhandPosition_
    188369        Overloaded the function to steer the bat up and down.
    189370    @param value
     
    216397        if (value.x > 0)
    217398        {
    218                 //orxout() << "right pressed" << endl;
    219399                moveLeftPressed = false;
    220400                moveRightPressed = true;
     
    222402        else
    223403        {
    224                 //orxout() << "left pressed" << endl;
    225404                moveLeftPressed = true;
    226405                moveRightPressed = false;
    227406        }
    228         /*this->bMoveLocal_ = true;
    229         this->movement_ = value.x;*/
    230407    }
    231408
     
    233410    {
    234411        horizontalSpeed = value.x;
    235 
    236412    }
    237413
     
    248424    }
    249425
     426    void JumpFigure::fire(unsigned int firemode)
     427    {
     428        //SUPER(JumpFigure, fire, firemode);
     429    }
     430
    250431    void JumpFigure::fired(unsigned int firemode)
    251432    {
    252         orxout() << "fire pressed" << endl;
     433        //SUPER(JumpFigure, fired, firemode);
    253434        firePressed = true;
    254435    }
  • code/branches/pickupsFS14/src/modules/jump/JumpFigure.h

    r10050 r10074  
    7171            virtual void rotateRoll(const Vector2& value);
    7272
     73            void fire(unsigned int firemode);
    7374            virtual void fired(unsigned int firemode);
    7475
    7576            virtual void JumpFromPlatform(JumpPlatform* platform);
    76 
    77             /**
    78             @brief Set the height of the playing field.
    79             @param height The height of the playing field.
    80             */
     77            virtual void JumpFromSpring(JumpSpring* spring);
     78            virtual void CollisionWithEnemy(JumpEnemy* enemy);
     79            virtual bool StartRocket(JumpRocket* rocket);
     80            virtual void StopRocket(JumpRocket* rocket);
     81            virtual bool StartPropeller(JumpPropeller* propeller);
     82            virtual void StopPropeller(JumpPropeller* propeller);
     83            virtual bool StartBoots(JumpBoots* boots);
     84            virtual void StopBoots(JumpBoots* boots);
     85            virtual bool StartShield(JumpShield* shield);
     86            virtual void StopShield(JumpShield* shield);
     87
     88            virtual void InitializeAnimation(Context* context);
     89
    8190            void setFieldDimension(float width, float height)
    82                 { this->fieldWidth_ = width; this->fieldHeight_ = height; }
     91                { fieldWidth_ = width; fieldHeight_ = height; }
    8392
    8493            void setFieldDimension(const Vector2& dimension)
    85                 { this->setFieldDimension(dimension.x, dimension.y); }
     94                { setFieldDimension(dimension.x, dimension.y); }
     95
     96            Vector2 getFieldDimension() const
     97                { return Vector2(fieldWidth_, fieldHeight_); }
    8698
    8799            void setMouseFactor(const float mouseFactor)
    88                 { this->mouseFactor_ = mouseFactor; }
     100                { mouseFactor_ = mouseFactor; }
    89101
    90102            const float getMouseFactor() const
    91                 { return this->mouseFactor_; }
    92 
    93             /**
    94             @brief Get the height of the playing field.
    95             @return Returns the height of the playing field.
    96             */
    97             Vector2 getFieldDimension() const
    98                 { return Vector2(this->fieldWidth_, this->fieldHeight_); }
    99 
    100             /**
    101             @brief Set the length of the bat.
    102             @param length The length of the bat (in z-direction) as percentage of the height of the playing field.
    103             */
    104             void setLength(float length)
    105                 { this->length_ = length; }
    106             /**
    107             @brief Get the length of the bat.
    108             @return Returns the length of the bat (in z-direction) as percentage of the height of the playing field.
    109             */
    110             float getLength() const
    111                 { return this->length_; }
     103                { return mouseFactor_; }
     104
     105            void setModelLeftHand(const std::string& modelLeftHand)
     106                { modelLeftHand_ = modelLeftHand; }
     107
     108            const std::string& getModelLeftHand() const
     109                { return modelLeftHand_; }
     110
     111            void setModelRightHand(const std::string& modelRightHand)
     112                { modelRightHand_ = modelRightHand; }
     113
     114            const std::string& getModelRightHand() const
     115                { return modelRightHand_; }
     116
     117            void setRocketPos(const float rocketPos)
     118                { rocketPos_ = rocketPos; }
     119
     120            const float getRocketPos() const
     121                { return rocketPos_; }
     122
     123                        void setPropellerPos(const float propellerPos)
     124                                { propellerPos_ = propellerPos; }
     125
     126                        const float getPropellerPos() const
     127                                { return propellerPos_; }
     128
     129                        void setBootsPos(const float bootsPos)
     130                                { bootsPos_ = bootsPos; }
     131
     132                        const float getBootsPos() const
     133                                { return bootsPos_; }
     134
     135            void setJumpSpeed(const float jumpSpeed)
     136                { jumpSpeed_ = jumpSpeed; }
     137
     138            const float getJumpSpeed() const
     139                { return jumpSpeed_; }
     140
     141            void setRocketSpeed(const float rocketSpeed)
     142                { rocketSpeed_ = rocketSpeed; }
     143
     144            const float getRocketSpeed() const
     145                { return rocketSpeed_; }
     146
     147            void setPropellerSpeed(const float propellerSpeed)
     148                { propellerSpeed_ = propellerSpeed; }
     149
     150            const float getPropellerSpeed() const
     151                { return propellerSpeed_; }
     152
     153            void setHandMinAngle(const float handMinAngle)
     154                { handMinAngle_ = handMinAngle; }
     155
     156            const float getHandMinAngle() const
     157                { return handMinAngle_; }
     158
     159            void setHandMaxAngle(const float handMaxAngle)
     160                { handMaxAngle_ = handMaxAngle; }
     161
     162            const float getHandMaxAngle() const
     163                { return handMaxAngle_; }
     164
     165            void setHandSpeed(const float handSpeed)
     166                { handSpeed_ = handSpeed; }
     167
     168            const float getHandSpeed() const
     169                { return handSpeed_; }
    112170
    113171            bool fireSignal;
     172            bool dead_;
     173
    114174        private:
    115             float movement_; //!< The amount (and direction), in z-direction, of movement of the bat.
    116             bool bMoveLocal_; //!< Helper to know whether the movement is caused by moveFrontBack() or moveRightLeft().
    117             float length_; //!< The length of the bat (in z-direction) as percentage of the height of the playing field.
    118             float fieldWidth_; //!< The height of the playing field.
     175            std::string modelLeftHand_;
     176            std::string modelRightHand_;
     177
     178            Model* leftHand_;
     179            Model* rightHand_;
     180
     181            float fieldWidth_;
    119182            float fieldHeight_;
    120             bool bSteadiedPosition_; //!< Helper boolean, to keep track of when to steady the position, to ensure network synchronicity.
    121183            float timeSinceLastFire;
    122184
     
    129191            float gravityAcceleration;
    130192            float mouseFactor_;
     193
     194            float jumpSpeed_;
     195            float handSpeed_;
     196            float handMaxAngle_;
     197            float handMinAngle_;
     198            float rocketPos_;
     199            float propellerPos_;
     200            float bootsPos_;
    131201            float maxFireRate;
    132202
    133203            float horizontalSpeed;
     204
     205            float handAngle_;
     206            bool animateHands_;
     207            bool turnUp_;
     208
     209            bool rocketActive_;
     210            bool propellerActive_;
     211            bool bootsActive_;
     212            bool shieldActive_;
     213            float rocketSpeed_;
     214            float propellerSpeed_;
    134215    };
    135216}
  • code/branches/pickupsFS14/src/modules/jump/JumpItem.cc

    r10050 r10074  
    5656        RegisterObject(JumpItem);
    5757
    58         this->figure_ = 0;
    59         setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    60         this->setPosition(Vector3(0,0,0));
    61         this->setVelocity(Vector3(0,0,0));
    62         this->setAcceleration(Vector3(0,0,0));
     58        attachedToFigure_ = false;
     59
     60        figure_ = 0;
     61        height_ = 0.0;
     62        width_ = 0.0;
     63        setPosition(Vector3(0,0,0));
     64        setVelocity(Vector3(0,0,0));
     65        setAcceleration(Vector3(0,0,0));
    6366    }
    6467
     
    6972    JumpItem::~JumpItem()
    7073    {
    71         /*if (this->isInitialized())
    72         {
    73             if (this->bDeleteBats_)
    74                 delete this->figure_;
    7574
    76             delete[] this->batID_;
    77         }*/
    7875    }
    7976
     
    8279    {
    8380        SUPER(JumpItem, XMLPort, xmlelement, mode);
     81
     82        XMLPortParam(JumpItem, "height", setHeight, getHeight, xmlelement, mode);
     83        XMLPortParam(JumpItem, "width", setWidth, getWidth, xmlelement, mode);
    8484    }
    8585
     
    9494    {
    9595        SUPER(JumpItem, tick, dt);
    96 
    97         // Get the current position, velocity and acceleration of the enemy.
    98         Vector3 position = getPosition();
     96        // Get the current position, velocity and acceleration of the item.
     97        Vector3 position = getWorldPosition();
    9998        Vector3 velocity = getVelocity();
    10099
     
    109108        }
    110109
    111         // Set the position, velocity and acceleration of the enemy, if they have changed.
     110        // Set the position, velocity and acceleration of the item, if they have changed.
    112111        if (velocity != getVelocity())
     112        {
    113113            setVelocity(velocity);
    114         if (position != getPosition())
    115             setPosition(position);
    116 
    117 
     114        }
    118115    }
    119116
     
    125122        upperBoundary_ = newUpperBoundary;
    126123
    127         this->setVelocity(Vector3(newHSpeed,0,newVSpeed));
     124        setVelocity(Vector3(newHSpeed,0,newVSpeed));
    128125    }
    129126
  • code/branches/pickupsFS14/src/modules/jump/JumpItem.h

    r10050 r10074  
    6262            JumpItem(Context* context);
    6363            virtual ~JumpItem();
     64            virtual void tick(float dt);
     65            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     66            virtual void setProperties(float newLeftBoundary, float newRightBoundary, float newLowerBoundary, float newUpperBoundary, float newHSpeed, float newVSpeed);
     67            virtual void setFigure(WeakPtr<JumpFigure> bats); //!< Set the bats for the ball.
     68            virtual void touchFigure();
    6469
    65             virtual void tick(float dt);
    66 
    67             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    68 
    69             /**
    70             @brief Set the dimensions of the playing field.
    71             @param width The width of the playing field.
    72             @param height The height of the playing field.
    73             */
    7470            void setFieldDimension(float width, float height)
    7571                { this->fieldWidth_ = width; this->fieldHeight_ = height; }
    76             /**
    77             @brief Get the dimensions of the playing field.
    78             @param dimension A vector with the width as the first and height as the second component.
    79             */
    8072            void setFieldDimension(const Vector2& dimension)
    8173                { this->setFieldDimension(dimension.x, dimension.y); }
    82             /**
    83             @brief Get the dimensions of the playing field.
    84             @return Returns a vector with the width as the first and height as the second component.
    85             */
    8674            Vector2 getFieldDimension() const
    8775                { return Vector2(this->fieldWidth_, this->fieldHeight_); }
    8876
    89             virtual void setProperties(float newLeftBoundary, float newRightBoundary, float newLowerBoundary, float newUpperBoundary, float newHSpeed, float newVSpeed);
     77            void setWidth(const float width)
     78                { this->width_ = width; }
     79            float getWidth() const
     80                { return width_; }
     81            void setHeight(const float height)
     82                { this->height_ = height; }
     83            float getHeight() const
     84                { return height_; }
    9085
    91             void setFigure(WeakPtr<JumpFigure> bats); //!< Set the bats for the ball.
    92 
    93             virtual void touchFigure();
     86            bool attachedToFigure_;
    9487
    9588        protected:
     
    9790            float fieldHeight_; //!< The height of the playing field.
    9891
     92            WeakPtr<JumpFigure> figure_; //!< An array with the two bats.
     93            float height_;
     94            float width_;
     95
    9996            float leftBoundary_;
    10097            float rightBoundary_;
    10198            float lowerBoundary_;
    10299            float upperBoundary_;
    103 
    104             WeakPtr<JumpFigure> figure_; //!< An array with the two bats.
    105100    };
    106101}
  • code/branches/pickupsFS14/src/modules/jump/JumpPlatform.cc

    r10050 r10074  
    5858        RegisterObject(JumpPlatform);
    5959
    60         this->figure_ = 0;
     60        figure_ = 0;
    6161
    6262        //initialize sound
    6363        if (GameMode::isMaster())
    6464                 {
    65                          this->defScoreSound_ = new WorldSound(this->getContext());
    66                          this->defScoreSound_->setVolume(1.0f);
    67                          this->defBatSound_ = new WorldSound(this->getContext());
    68                          this->defBatSound_->setVolume(0.4f);
    69                          this->defBoundarySound_ = new WorldSound(this->getContext());
    70                          this->defBoundarySound_->setVolume(0.5f);
     65                         defScoreSound_ = new WorldSound(this->getContext());
     66                         defScoreSound_->setVolume(1.0f);
     67                         defBatSound_ = new WorldSound(this->getContext());
     68                         defBatSound_->setVolume(0.4f);
     69                         defBoundarySound_ = new WorldSound(this->getContext());
     70                         defBoundarySound_->setVolume(0.5f);
    7171                 }
    7272                 else
    7373                 {
    74                          this->defScoreSound_ = 0;
    75                          this->defBatSound_ = 0;
    76                          this->defBoundarySound_ = 0;
     74                         defScoreSound_ = 0;
     75                         defBatSound_ = 0;
     76                         defBoundarySound_ = 0;
    7777                 }
    7878
    79         this->setPosition(Vector3(0,0,0));
    80         this->setVelocity(Vector3(0,0,0));
    81         this->setAcceleration(Vector3(0,0,0));
     79        setPosition(Vector3(0,0,0));
     80        setVelocity(Vector3(0,0,0));
     81        setAcceleration(Vector3(0,0,0));
    8282    }
    8383
     
    8888    JumpPlatform::~JumpPlatform()
    8989    {
    90         /*if (this->isInitialized())
    91         {
    92             if (this->bDeleteBats_)
    93                 delete this->figure_;
    9490
    95             delete[] this->batID_;
    96         }*/
    9791    }
    9892
     
    10195    {
    10296        SUPER(JumpPlatform, XMLPort, xmlelement, mode);
     97
     98        XMLPortParam(JumpPlatform, "height", setHeight, getHeight, xmlelement, mode);
     99        XMLPortParam(JumpPlatform, "width", setWidth, getWidth, xmlelement, mode);
     100
    103101        XMLPortParam(JumpPlatform, "defScoreSound",  setDefScoreSound,  getDefScoreSound,  xmlelement, mode);
    104102        XMLPortParam(JumpPlatform, "defBatSound",  setDefBatSound,  getDefBatSound,  xmlelement, mode);
     
    124122            Vector3 figureVelocity = figure_->getVelocity();
    125123
    126             if(figureVelocity.z < 0 && figurePosition.x > platformPosition.x-10 && figurePosition.x < platformPosition.x+10 && figurePosition.z > platformPosition.z-4 && figurePosition.z < platformPosition.z+4)
     124            float tolerance = 3.0;
     125
     126            if(figureVelocity.z < 0 && figurePosition.x > platformPosition.x-width_/2 && figurePosition.x < platformPosition.x+width_/2 && figurePosition.z > platformPosition.z-height_/2*tolerance && figurePosition.z < platformPosition.z+height_/2)
    127127            {
    128128                touchFigure();
    129129            }
    130130        }
    131 
    132 
    133 
    134 
    135 
    136         /*
    137         // If the ball has gone over the top or bottom boundary of the playing field (i.e. the ball has hit the top or bottom delimiters).
    138         if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2)
    139         {
    140             defBoundarySound_->play(); //play boundary sound
    141             // Its velocity in z-direction is inverted (i.e. it bounces off).
    142             velocity.z = -velocity.z;
    143             // And its position is set as to not overstep the boundary it has just crossed.
    144             if (position.z > this->fieldHeight_ / 2)
    145                 position.z = this->fieldHeight_ / 2;
    146             if (position.z < -this->fieldHeight_ / 2)
    147                 position.z = -this->fieldHeight_ / 2;
    148 
    149             this->fireEvent();
    150         }
    151 
    152         // If the ball has crossed the left or right boundary of the playing field (i.e. a player has just scored, if the bat isn't there to parry).
    153         if (position.x > this->fieldWidth_ / 2 || position.x < -this->fieldWidth_ / 2)
    154         {
    155             float distance = 0;
    156 
    157             if (this->bat_ != NULL) // If there are bats.
    158             {
    159                 // If the right boundary has been crossed.
    160                 if (position.x > this->fieldWidth_ / 2 && this->bat_[1] != NULL)
    161                 {
    162                     // Calculate the distance (in z-direction) between the ball and the center of the bat, weighted by half of the effective length of the bat (with additional 10%)
    163                     distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
    164                     if (fabs(distance) <= 1) // If the bat is there to parry.
    165                     {
    166                         defBatSound_->play(); //play bat sound
    167                         // Set the ball to be exactly at the boundary.
    168                         position.x = this->fieldWidth_ / 2;
    169                         // Invert its velocity in x-direction (i.e. it bounces off).
    170                         velocity.x = -velocity.x;
    171                         // Adjust the velocity in the z-direction, depending on where the ball hit the bat.
    172                         velocity.z = distance * distance * sgn(distance) * JumpPlatform::MAX_REL_Z_VELOCITY * this->speed_;
    173                         acceleration = this->bat_[1]->getVelocity() * this->accelerationFactor_ * -1;
    174 
    175                         this->fireEvent();
    176                     }
    177                     // If the left player scores.
    178                     else if (GameMode::isMaster() && position.x > this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
    179                     {
    180                         defScoreSound_->play();//play score sound
    181                         if (this->getGametype() && this->bat_[0])
    182                         {
    183                             this->getGametype()->playerScored(this->bat_[0]->getPlayer());
    184                             return;
    185                         }
    186                     }
    187                 }
    188                 // If the left boundary has been crossed.
    189                 else if (position.x < -this->fieldWidth_ / 2 && this->bat_[0] != NULL)
    190                 {
    191                     // Calculate the distance (in z-direction) between the ball and the center of the bat, weighted by half of the effective length of the bat (with additional 10%)
    192                     distance = (position.z - this->figure_->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
    193                     if (fabs(distance) <= 1) // If the bat is there to parry.
    194                     {
    195                         defBatSound_->play(); //play bat sound
    196                         // Set the ball to be exactly at the boundary.
    197                         position.x = -this->fieldWidth_ / 2;
    198                         // Invert its velocity in x-direction (i.e. it bounces off).
    199                         velocity.x = -velocity.x;
    200                         // Adjust the velocity in the z-direction, depending on where the ball hit the bat.
    201                         velocity.z = distance * distance * sgn(distance) * JumpPlatform::MAX_REL_Z_VELOCITY * this->speed_;
    202                         acceleration = this->bat_[0]->getVelocity() * this->accelerationFactor_ * -1;
    203 
    204                         this->fireEvent();
    205                     }
    206                     // If the right player scores.
    207                     else if (GameMode::isMaster() && position.x < -this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
    208                     {
    209                         defScoreSound_->play();//play score sound
    210                         if (this->getGametype() && this->bat_[1])
    211                         {
    212                             this->getGametype()->playerScored(this->bat_[1]->getPlayer());
    213                             return;
    214                         }
    215                     }
    216                 }
    217             }
    218         }
    219         */
    220131    }
    221132
    222     /**
    223     @brief
    224         Set the bats for the ball.
    225     @param bats
    226         An array (of size 2) of weak pointers, to be set as the new bats.
    227     */
    228133    void JumpPlatform::setFigure(WeakPtr<JumpFigure> newFigure)
    229134    {
    230135        figure_ = newFigure;
    231     }
    232 
    233     void JumpPlatform::accelerateFigure()
    234     {
    235         figure_->JumpFromPlatform(this);
    236136    }
    237137
  • code/branches/pickupsFS14/src/modules/jump/JumpPlatform.h

    r10050 r10074  
    6262            JumpPlatform(Context* context);
    6363            virtual ~JumpPlatform();
    64 
    6564            virtual void tick(float dt);
    66 
    6765            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    68 
    69             /**
    70             @brief Set the dimensions of the playing field.
    71             @param width The width of the playing field.
    72             @param height The height of the playing field.
    73             */
    74             void setFieldDimension(float width, float height)
    75                 { this->fieldWidth_ = width; this->fieldHeight_ = height; }
    76             /**
    77             @brief Get the dimensions of the playing field.
    78             @param dimension A vector with the width as the first and height as the second component.
    79             */
    80             void setFieldDimension(const Vector2& dimension)
    81                 { this->setFieldDimension(dimension.x, dimension.y); }
    82             /**
    83             @brief Get the dimensions of the playing field.
    84             @return Returns a vector with the width as the first and height as the second component.
    85             */
    86             Vector2 getFieldDimension() const
    87                 { return Vector2(this->fieldWidth_, this->fieldHeight_); }
    88 
    89 
    9066            void setFigure(WeakPtr<JumpFigure> bats); //!< Set the bats for the ball.
    91 
    92             virtual void accelerateFigure();
    9367            virtual void touchFigure();
    9468
     
    10276            const std::string& getDefBoundarySound();
    10377
     78            void setWidth(const float width)
     79                { this->width_ = width; }
     80            float getWidth() const
     81                { return width_; }
     82            void setHeight(const float height)
     83                { this->height_ = height; }
     84            float getHeight() const
     85                { return height_; }
     86
    10487        protected:
    105             float fieldWidth_; //!< The width of the playing field.
    106             float fieldHeight_; //!< The height of the playing field.
    107             WeakPtr<JumpFigure> figure_; //!< An array with the two bats.
     88            float width_;
     89            float height_;
     90            WeakPtr<JumpFigure> figure_;
    10891            WorldSound* defScoreSound_;
    10992            WorldSound* defBatSound_;
  • code/branches/pickupsFS14/src/modules/jump/JumpPlatformDisappear.cc

    r10050 r10074  
    101101        if (isActive())
    102102        {
    103                 accelerateFigure();
     103                figure_->JumpFromPlatform(this);
    104104                active_ = false;
    105                 orxout() << "platform deactivated" << endl;
    106105        }
    107106    }
  • code/branches/pickupsFS14/src/modules/jump/JumpPlatformFake.cc

    r10050 r10074  
    4444#include "core/XMLPort.h"
    4545
    46 #include "graphics/Backlight.h"
    47 
    4846namespace orxonox
    4947{
  • code/branches/pickupsFS14/src/modules/jump/JumpPlatformHMove.cc

    r10050 r10074  
    116116    void JumpPlatformHMove::touchFigure()
    117117    {
    118         accelerateFigure();
     118        figure_->JumpFromPlatform(this);
    119119    }
    120120}
  • code/branches/pickupsFS14/src/modules/jump/JumpPlatformStatic.cc

    r10050 r10074  
    8787    void JumpPlatformStatic::touchFigure()
    8888    {
    89         accelerateFigure();
     89        figure_->JumpFromPlatform(this);
    9090    }
    9191}
  • code/branches/pickupsFS14/src/modules/jump/JumpPlatformTimer.cc

    r10050 r10074  
    117117    void JumpPlatformTimer::touchFigure()
    118118    {
    119         accelerateFigure();
    120119        if (isActive())
    121120        {
    122                 accelerateFigure();
     121                figure_->JumpFromPlatform(this);
    123122        }
    124123    }
  • code/branches/pickupsFS14/src/modules/jump/JumpPlatformVMove.cc

    r10050 r10074  
    113113    void JumpPlatformVMove::touchFigure()
    114114    {
    115         accelerateFigure();
     115        figure_->JumpFromPlatform(this);
    116116    }
    117117}
  • code/branches/pickupsFS14/src/modules/jump/JumpPrereqs.h

    r10050 r10074  
    7979    class JumpEnemy;
    8080    class JumpItem;
     81    class JumpSpring;
     82    class JumpRocket;
     83    class JumpPropeller;
     84    class JumpBoots;
     85    class JumpShield;
    8186    class JumpFigure;
    8287    class JumpCenterpoint;
  • code/branches/pickupsFS14/src/modules/jump/JumpProjectile.cc

    r10050 r10074  
    5656        RegisterObject(JumpProjectile);
    5757
    58         this->figure_ = 0;
     58        figure_ = 0;
    5959
    60         this->registerVariables();
     60        registerVariables();
    6161
    62         this->setPosition(Vector3(0,0,0));
    63         this->setVelocity(Vector3(0,0,0));
    64         this->setAcceleration(Vector3(0,0,0));
     62        setPosition(Vector3(0,0,0));
     63        setVelocity(Vector3(0,0,250.0));
     64        setAcceleration(Vector3(0,0,0));
    6565    }
    6666
     
    108108        SUPER(JumpProjectile, tick, dt);
    109109
    110         Vector3 platformPosition = this->getPosition();
     110        Vector3 projectilePosition = getPosition();
    111111
    112         if (figure_ != NULL)
    113         {
    114             Vector3 figurePosition = figure_->getPosition();
    115             Vector3 figureVelocity = figure_->getVelocity();
     112                for (ObjectList<JumpEnemy>::iterator it = ObjectList<JumpEnemy>::begin(); it != ObjectList<JumpEnemy>::end(); ++it)
     113                {
     114                        Vector3 enemyPosition = it->getPosition();
     115                        float enemyWidth = it->getWidth();
     116                        float enemyHeight = it->getHeight();
    116117
    117             if(figureVelocity.z < 0 && figurePosition.x > platformPosition.x-10 && figurePosition.x < platformPosition.x+10 && figurePosition.z > platformPosition.z-4 && figurePosition.z < platformPosition.z+4)
    118             {
    119                 touchFigure();
    120             }
    121         }
     118                        if(projectilePosition.x > enemyPosition.x-enemyWidth && projectilePosition.x < enemyPosition.x+enemyWidth && projectilePosition.z > enemyPosition.z-enemyHeight && projectilePosition.z < enemyPosition.z+enemyHeight)
     119                        {
     120                                it->dead_ = true;
     121                        }
     122                }
    122123    }
    123124
     
    128129        An array (of size 2) of weak pointers, to be set as the new bats.
    129130    */
    130     void JumpProjectile::setFigure(WeakPtr<JumpFigure> newFigure)
     131    void JumpProjectile::setFigure(WeakPtr<JumpFigure> figure)
    131132    {
    132         figure_ = newFigure;
    133     }
    134 
    135     void JumpProjectile::accelerateFigure()
    136     {
    137 
    138     }
    139 
    140     void JumpProjectile::touchFigure()
    141     {
    142 
     133        figure_ = figure;
    143134    }
    144135}
  • code/branches/pickupsFS14/src/modules/jump/JumpProjectile.h

    r10050 r10074  
    6767            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    6868
    69             /**
    70             @brief Set the dimensions of the playing field.
    71             @param width The width of the playing field.
    72             @param height The height of the playing field.
    73             */
    7469            void setFieldDimension(float width, float height)
    7570                { this->fieldWidth_ = width; this->fieldHeight_ = height; }
    76             /**
    77             @brief Get the dimensions of the playing field.
    78             @param dimension A vector with the width as the first and height as the second component.
    79             */
     71
    8072            void setFieldDimension(const Vector2& dimension)
    8173                { this->setFieldDimension(dimension.x, dimension.y); }
    82             /**
    83             @brief Get the dimensions of the playing field.
    84             @return Returns a vector with the width as the first and height as the second component.
    85             */
     74
    8675            Vector2 getFieldDimension() const
    8776                { return Vector2(this->fieldWidth_, this->fieldHeight_); }
    8877
    8978
    90             void setFigure(WeakPtr<JumpFigure> bats); //!< Set the bats for the ball.
    91 
    92             virtual void accelerateFigure();
    93             virtual void touchFigure();
     79            void setFigure(WeakPtr<JumpFigure> figure);
    9480
    9581        protected:
  • code/branches/pickupsFS14/src/modules/jump/JumpScore.cc

    r10050 r10074  
    5555        RegisterObject(JumpScore);
    5656
    57         this->owner_ = NULL;
    58 
     57        owner_ = NULL;
     58        showScore_ = false;
     59        showMessages_ = false;
    5960    }
    6061
     
    7576    {
    7677        SUPER(JumpScore, XMLPort, xmlelement, mode);
     78
     79        XMLPortParam(JumpScore, "showScore", setShowScore, getShowScore, xmlelement, mode);
     80        XMLPortParam(JumpScore, "showMessages", setShowMessages, getShowMessages, xmlelement, mode);
     81        XMLPortParam(JumpScore, "gameOverText", setGameOverText, getGameOverText, xmlelement, mode);
    7782    }
    7883
     
    9297        if (this->owner_ != NULL)
    9398        {
    94                 /*
    95             if (!this->owner_->hasEnded())
    96             {
    97                 // Get the two players.
    98                 player1_ = this->owner_->getPlayer();
    99             }
    100 
    101             std::string name1;
    102 
    103             std::string score1("0");
    104 
    105             // Save the name and score of each player as a string.
    106             if (player1_ != NULL)
    107             {
    108                 name1 = player1_->getName();
    109                 score1 = multi_cast<std::string>(this->owner_->getScore(player1_));
    110             }
    111 
    112             // Assemble the strings, depending on what should all be displayed.
    113             std::string output1;
    114             if (this->bShowLeftPlayer_)
    115             {
    116                 if (this->bShowName_ && this->bShowScore_ && player1_ != NULL)
    117                     output1 = name1 + " - " + score1;
    118                 else if (this->bShowScore_)
    119                     output1 = score1;
    120                 else if (this->bShowName_)
    121                     output1 = name1;
    122             }
    123 
    124             std::string output("JUMP");
    125             if (this->bShowName_ || this->bShowScore_)
    126             {
    127                 if (this->bShowLeftPlayer_ && this->bShowRightPlayer_)
    128                     output = output1 + ':' + output2;
    129                 else if (this->bShowLeftPlayer_ || this->bShowRightPlayer_)
    130                     output = output1 + output2;
    131             }
    132 
    133             this->setCaption(output);*/
    134 
    135 
    136 
    137 
    13899            if (!owner_->hasEnded())
    139100            {
     
    142103                if (player_ != NULL)
    143104                {
    144                         int score = owner_->getScore(player_);
     105                        if (showScore_ == true)
     106                        {
     107                        int score = owner_->getScore(player_);
    145108
    146                         std::string str = multi_cast<std::string>(score);
    147                         setCaption(str);
     109                        std::string str = multi_cast<std::string>(score);
     110                        setCaption(str);
     111                        }
     112                        else if (showMessages_ == true)
     113                        {
     114
     115                        setCaption(owner_->getDead(player_) == true ? gameOverText_ : "");
     116                        }
    148117                }
    149118            }
  • code/branches/pickupsFS14/src/modules/jump/JumpScore.h

    r10050 r10074  
    6464            virtual void changedOwner(); //!< Is called when the owner changes.
    6565
     66            void setShowScore(const bool showScore)
     67                { showScore_ = showScore; }
     68
     69            const bool getShowScore() const
     70                { return showScore_; }
     71
     72            void setShowMessages(const bool showMessages)
     73                { showMessages_ = showMessages; }
     74
     75            const bool getShowMessages() const
     76                { return showMessages_; }
     77
     78            void setGameOverText(const std::string& gameOverText)
     79                { this->gameOverText_ = gameOverText; }
     80
     81            const std::string& getGameOverText() const
     82                { return this->gameOverText_; }
     83
    6684        private:
    6785            Jump* owner_; //!< The Jump game that owns this JumpScore.
    6886            WeakPtr<PlayerInfo> player_; //!< Store information about left player permanently.
    6987            WorldSound* scoreSound_;
     88            bool showScore_;
     89            bool showMessages_;
     90            std::string gameOverText_;
    7091
    7192    };
Note: See TracChangeset for help on using the changeset viewer.