|
@@ -218,6 +218,11 @@ void Spiel::tick()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ for( int i = 0; i < animations.getEintragAnzahl(); i++ )
|
|
|
|
+ {
|
|
|
|
+ if( animations.z( i )->tick( zeit ) )
|
|
|
|
+ animations.remove( i-- );
|
|
|
|
+ }
|
|
// gegenstand despawn
|
|
// gegenstand despawn
|
|
for( int i = 0; i < items.getEintragAnzahl(); i++ )
|
|
for( int i = 0; i < items.getEintragAnzahl(); i++ )
|
|
{
|
|
{
|
|
@@ -305,6 +310,7 @@ void Spiel::tick()
|
|
s->addGetroffen();
|
|
s->addGetroffen();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ addAnimation( new SingleAnimation( g->getX() + g->getWidth() / 2 - 50, g->getY() + g->getHeight() / 2 - 50, 100, 100, resources->getResource( R_EXPLOSION, 0 ) ) );
|
|
shots.remove( i );
|
|
shots.remove( i );
|
|
i--;
|
|
i--;
|
|
removed = 1;
|
|
removed = 1;
|
|
@@ -370,6 +376,7 @@ void Spiel::tick()
|
|
Geschoss *g2 = shots.z( j );
|
|
Geschoss *g2 = shots.z( j );
|
|
if( g2->intersectsWith( g ) )
|
|
if( g2->intersectsWith( g ) )
|
|
{
|
|
{
|
|
|
|
+ addAnimation( new SingleAnimation( g->getX() + g->getWidth() / 2 - 20, g->getY() + g->getHeight() / 2 - 20, 40, 40, resources->getResource( R_EXPLOSION, 0 ) ) );
|
|
if( g2->getTyp() == GESCHOSS_PFEIL )
|
|
if( g2->getTyp() == GESCHOSS_PFEIL )
|
|
removed = 1;
|
|
removed = 1;
|
|
g->addGeschossTreffer( this );
|
|
g->addGeschossTreffer( this );
|
|
@@ -401,16 +408,19 @@ void Spiel::tick()
|
|
}
|
|
}
|
|
case GESCHOSS_KUGEL:
|
|
case GESCHOSS_KUGEL:
|
|
{
|
|
{
|
|
|
|
+ addAnimation( new SingleAnimation( g->getX() + g->getWidth() / 2 - 25, g->getY() + g->getHeight() / 2 - 25, 50, 50, resources->getResource( R_EXPLOSION, 0 ) ) );
|
|
s->nimmSchaden( KUGEL_DAMAGE, g->zBesitzer(), invert( g->getRichtung() ), this );
|
|
s->nimmSchaden( KUGEL_DAMAGE, g->zBesitzer(), invert( g->getRichtung() ), this );
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case GESCHOSS_DRACHENAUGE:
|
|
case GESCHOSS_DRACHENAUGE:
|
|
|
|
+ addAnimation( new SingleAnimation( g->getX() + g->getWidth() / 2 - 25, g->getY() + g->getHeight() / 2 - 25, 50, 50, resources->getResource( R_EXPLOSION, 0 ) ) );
|
|
s->addEffekt( new DrachenAugeEffect( g->zBesitzer(), s._ ) );
|
|
s->addEffekt( new DrachenAugeEffect( g->zBesitzer(), s._ ) );
|
|
break;
|
|
break;
|
|
case GESCHOSS_FEUERBALL:
|
|
case GESCHOSS_FEUERBALL:
|
|
feuer.add( new FeuerballTreffer( resources, ++nextId, (int)g->getX() - (int)g->getWidth() / 2, (int)g->getY() - (int)g->getHeight() / 2, g->getBesitzer(), 10 ) );
|
|
feuer.add( new FeuerballTreffer( resources, ++nextId, (int)g->getX() - (int)g->getWidth() / 2, (int)g->getY() - (int)g->getHeight() / 2, g->getBesitzer(), 10 ) );
|
|
break;
|
|
break;
|
|
case GESCHOSS_MINE:
|
|
case GESCHOSS_MINE:
|
|
|
|
+ addAnimation( new SingleAnimation( g->getX() + g->getWidth() / 2 - 50, g->getY() + g->getHeight() / 2 - 50, 100, 100, resources->getResource( R_EXPLOSION, 0 ) ) );
|
|
for( auto s2 = spieler.getIterator(); s2; s2++ )
|
|
for( auto s2 = spieler.getIterator(); s2; s2++ )
|
|
{
|
|
{
|
|
if( s2->abstandZu( g ) < 50 )
|
|
if( s2->abstandZu( g ) < 50 )
|
|
@@ -868,6 +878,8 @@ void Spiel::render( Bild &zRObj )
|
|
}
|
|
}
|
|
for( auto s = shots.getIterator(); s; s++ )
|
|
for( auto s = shots.getIterator(); s; s++ )
|
|
s->render( zRObj );
|
|
s->render( zRObj );
|
|
|
|
+ for( auto a = animations.getIterator(); a; a++ )
|
|
|
|
+ a->render( zRObj );
|
|
// TODO: render timer
|
|
// TODO: render timer
|
|
zRObj.releaseDrawOptions();
|
|
zRObj.releaseDrawOptions();
|
|
}
|
|
}
|
|
@@ -1706,6 +1718,11 @@ ResourceRegistry *Spiel::zResources() const
|
|
return resources;
|
|
return resources;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void Spiel::addAnimation( SingleAnimation *animation )
|
|
|
|
+{
|
|
|
|
+ animations.add( animation );
|
|
|
|
+}
|
|
|
|
+
|
|
int Spiel::läuft() const
|
|
int Spiel::läuft() const
|
|
{
|
|
{
|
|
if( !begonnen )
|
|
if( !begonnen )
|