|
@@ -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
|
|
|
for( int i = 0; i < items.getEintragAnzahl(); i++ )
|
|
|
{
|
|
@@ -305,6 +310,7 @@ void Spiel::tick()
|
|
|
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 );
|
|
|
i--;
|
|
|
removed = 1;
|
|
@@ -370,6 +376,7 @@ void Spiel::tick()
|
|
|
Geschoss *g2 = shots.z( j );
|
|
|
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 )
|
|
|
removed = 1;
|
|
|
g->addGeschossTreffer( this );
|
|
@@ -401,16 +408,19 @@ void Spiel::tick()
|
|
|
}
|
|
|
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 );
|
|
|
break;
|
|
|
}
|
|
|
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._ ) );
|
|
|
break;
|
|
|
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 ) );
|
|
|
break;
|
|
|
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++ )
|
|
|
{
|
|
|
if( s2->abstandZu( g ) < 50 )
|
|
@@ -868,6 +878,8 @@ void Spiel::render( Bild &zRObj )
|
|
|
}
|
|
|
for( auto s = shots.getIterator(); s; s++ )
|
|
|
s->render( zRObj );
|
|
|
+ for( auto a = animations.getIterator(); a; a++ )
|
|
|
+ a->render( zRObj );
|
|
|
// TODO: render timer
|
|
|
zRObj.releaseDrawOptions();
|
|
|
}
|
|
@@ -1706,6 +1718,11 @@ ResourceRegistry *Spiel::zResources() const
|
|
|
return resources;
|
|
|
}
|
|
|
|
|
|
+void Spiel::addAnimation( SingleAnimation *animation )
|
|
|
+{
|
|
|
+ animations.add( animation );
|
|
|
+}
|
|
|
+
|
|
|
int Spiel::läuft() const
|
|
|
{
|
|
|
if( !begonnen )
|