[Kde-games-devel] Fwd: Kasteroids New version

Martin Heni martin at heni-online.de
Thu Jun 19 12:24:47 CEST 2003


I got the following messge which I would like to forward to the list.
Can someone doing Kasteroid look into this?

----------  Forwarded Message  ----------

Subject: Kasteroids New version
Date: Tuesday 17 June 2003 20:19
From: Bartek <gang65 at wp.pl>
To: martin at heni-online.de

Hi.
My name is Bartosz Kosiorek.
I come from Poland.
I would like develop KAsteroid but Martin Jones write that :

 "Sorry for the very slow reply and sorry to hear about your
disaster. I'm
forwarding you the changes you sent me so that you can continue
your work. I
don't have time for KDE work anymore so it would be good if
you'd take over
kasteroids maintainership" .

I create some nice paths to this great game. Could you look at
this and tell me what do you think about it.

Thanks Bartosz Kosiorek

---------------------------------------------------
Szukasz wyjazdu wakacyjnego? Sprawdź nasze oferty!
Nowy serwis w WP http://oferty.wp.pl/wakacje.html

-------------------------------------------------------


-------------- next part --------------
diff -u kasterold/ChangeLog kaster2.3/ChangeLog
--- kasterold/ChangeLog	Tue Mar 13 06:52:57 2001
+++ kaster2.3/ChangeLog	Wed Jan 30 01:53:31 2002
@@ -1,3 +1,11 @@
+Version 2.3
+ * [Bartosz Kosiorek <gang65 at poczta.onet.pl>]
+                       Fixed some bugs
+                       Random rocks place
+		       Improve playabality
+		       New sounds
+		       New model of ship
+
 Version 2.2
  * [Martin Jones]      Show "Game Over" and stats in the game window instead
                        of displaying many annoying dialogs at the end of the
Binary files kasterold/hi16-app-kasteroids.png and kaster2.3/hi16-app-kasteroids.png differ
diff -u kasterold/main.cpp kaster2.3/main.cpp
--- kasterold/main.cpp	Tue Jul 31 00:14:57 2001
+++ kaster2.3/main.cpp	Sun Dec  9 03:41:11 2001
@@ -34,6 +34,7 @@
         KASTEROIDS_VERSION, description, KAboutData::License_GPL, 
         "(c) 1997, Martin R. Jones");
     aboutData.addAuthor("Martin R. Jones",0, "mjones at kde.org");
+    aboutData.addAuthor("Bartosz Kosiorek",0, "gang65 at poczta.onet.pl");
     KCmdLineArgs::init( argc, argv, &aboutData );
 
     KApplication app;
diff -u kasterold/sprites.h kaster2.3/sprites.h
--- kasterold/sprites.h	Fri Mar 16 08:45:29 2001
+++ kaster2.3/sprites.h	Sat Nov 24 17:09:30 2001
@@ -29,7 +29,7 @@
 
 #define MAX_SHIELD_AGE          350
 #define MAX_POWERUP_AGE         500
-#define MAX_MISSILE_AGE         40
+#define MAX_MISSILE_AGE         20
 
 class KMissile : public QCanvasSprite
 {
diff -u kasterold/toplevel.cpp kaster2.3/toplevel.cpp
--- kasterold/toplevel.cpp	Sat Apr 14 01:17:39 2001
+++ kaster2.3/toplevelcpp	Mon Feb  4 02:53:38 2002
@@ -43,7 +43,9 @@
 
 struct SLevel
 {
-    int    nrocks;
+    int    nLargeRocks;
+    int    nMediumRocks;
+    int    nSmallRocks;
     double rockSpeed;
 };
 
@@ -51,34 +53,38 @@
 
 SLevel levels[MAX_LEVELS] =
 {
-    { 1, 0.4 },
-    { 1, 0.6 },
-    { 2, 0.5 },
-    { 2, 0.7 },
-    { 2, 0.8 },
-    { 3, 0.6 },
-    { 3, 0.7 },
-    { 3, 0.8 },
-    { 4, 0.6 },
-    { 4, 0.7 },
-    { 4, 0.8 },
-    { 5, 0.7 },
-    { 5, 0.8 },
-    { 5, 0.9 },
-    { 5, 1.0 }
+    { 0, 1 , 1, 0.4 },
+    { 0, 2 , 2, 0.6 },
+    { 1, 1 , 2, 0.5 },
+    { 1, 2 , 2, 0.7 },
+    { 1, 3 , 3, 0.8 },
+    { 2, 1 , 3, 0.6 },
+    { 2, 2 , 3, 0.7 },
+    { 2, 3 , 4, 0.8 },
+    { 3, 1 , 4, 0.6 },
+    { 3, 2 , 4, 0.7 },
+    { 3, 3 , 5, 0.8 },
+    { 4, 1 , 5, 0.7 },
+    { 4, 2 , 5, 0.8 },
+    { 4, 3 , 6, 0.9 },
+    { 5, 1 , 6, 1.0 }
 };
 
 const char *soundEvents[] = 
 {
     "ShipDestroyed",
-    "RockDestroyed",
+    "MediumRockDestroyed",
+    "BigRockDestroyed",
+    "TakePowerup",
     0
 };
 
 const char *soundDefaults[] = 
 {
     "Explosion.wav",
-    "ploop.wav",
+    "rockexpl.wav",
+    "rockexpl2wav",
+    "Powerup.wav",
     0
 };
 
@@ -95,7 +101,7 @@
     setCaption("");
 
     QWidget *mainWin = new QWidget( this );
-    mainWin->setFixedSize(640, 480);
+    mainWin->setFixedSize(620, 460);
 
     view = new KAsteroidsView( mainWin );
     connect( view, SIGNAL( shipKilled() ), SLOT( slotShipKilled() ) );
@@ -239,7 +245,7 @@
     label->setPalette( pal );
     hbd->addWidget( label );
 
-    shootLCD = new QLCDNumber( 1, mainWin );
+    shootLCD = new QLCDNumber( 3, mainWin );
     shootLCD->setFrameStyle( QFrame::NoFrame );
     shootLCD->setSegmentStyle( QLCDNumber::Flat );
     shootLCD->setPalette( pal );
@@ -268,24 +274,24 @@
     highscore = new HighscoreList( this );
 
     accel = new KAccel( this );
+    actions.insert( "Shoot", Shoot );
+    accel->insertItem( i18n("Shoot"), "Shoot", Qt::Key_Space );
     actions.insert( "Thrust", Thrust );
     accel->insertItem( i18n("Thrust"), "Thrust", Qt::Key_Up );
     actions.insert( "RotateLeft", RotateLeft );
     accel->insertItem( i18n("Rotate Left"), "RotateLeft", Qt::Key_Left );
     actions.insert( "RotateRight", RotateRight );
     accel->insertItem( i18n("Rotate Right"), "RotateRight", Qt::Key_Right );
-    actions.insert( "Shoot", Shoot );
-    accel->insertItem( i18n("Shoot"), "Shoot", Qt::Key_Space );
+    actions.insert( "Brake", Brake);
+    accel->insertItem( i18n("Brake"), "Brake", Qt::Key_Down );
     actions.insert( "Teleport", Teleport );
     accel->insertItem( i18n("Teleport"), "Teleport", Qt::Key_Z );
-    actions.insert( "Brake", Brake);
-    accel->insertItem( i18n("Brake"), "Brake", Qt::Key_X );
     actionsinsert( "Shield", Shield );
     accel->insertItem( i18n("Shield"), "Shield", Qt::Key_S );
-    actions.insert( "Pause", Pause );
-    accel->insertItem( i18n("Pause"), "Pause", Qt::Key_P );
     actions.insert( "Launch", Launch );
     accel->insertItem( i18n("Launch"), "Launch", Qt::Key_L );
+    actions.insert( "Pause", Pause );
+    accel->insertItem( i18n("Pause"), "Pause", Qt::Key_P );
 
     accel->readSettings();
 
@@ -302,6 +308,8 @@
 #endif
 
     readSettings();
+    
+    KAstTopLevel::slotNewGame();
 }
 
 KAstTopLevel::~KAstTopLevel()
@@ -517,8 +525,15 @@
     shipsLCD->display( shipsRemain-1 );
     view->newGame();
     view->setRockSpeed( levels[0].rockSpeed );
-    view->addRocks( levels[0].nrocks );
-    view->showText( i18n( "Press %1 to launch." )
+    view->addRocks( levels[0].nLargeRocks , ID_ROCK_LARGE);
+    view->addRocks( levels[0].nMediumRocks , ID_ROCK_MEDIUM);
+    view->addRocks( levels[0].nSmallRocks , ID_ROCK_SMALL);
+    
+    view->showText( i18n( " Your mission is to save Earth from asteroids. \n"
+                          "You must destroy all asteroids and go back to station.\n"
+			  "Your spaceship is armed with heavy laser. \n"
+			  "                        Goodluck captain.\n \n"
+                          "Press %1 to launch." )
                     .arg(KAccel::keyToString(accel->currentKey("Launch"), true)),
                     yellow );
     waitShip = true;
@@ -558,19 +573,20 @@
     switch ( size )
     {
 	case 0:
-	    score += 10;
+	    score += 5;
+	    playSound( "BigRockDestroyed" );
 	     break;
 
 	case 1:
-	    score += 20;
+	    score += 10;
+	    playSound( "MediumRockDestroyed" );
 	    break;
 
 	default:
-	    score += 40;
+	    score += 15;
+	    playSound( "MediumRockDestroyed" );
       }
 
-    playSound( "RockDestroyed" );
-
     scoreLCD->display( score );
 }
 
@@ -582,7 +598,9 @@
 	level = MAX_LEVELS - 1;
 
     view->setRockSpeed( levels[level-1].rockSpeed );
-    view->addRocks( levels[level-1].nrocks );
+    view->addRocks( levels[level-1].nLargeRocks,  ID_ROCK_LARGE );
+    view->addRocks( levels[level-1].nMediumRocks, ID_ROCK_MEDIUM );
+    view->addRocks( levels[level-1].nSmallRocks,  ID_ROCK_SMALL );
 
     levelLCD->display( level );
 }
diff -u kasterold/toplevel.h kaster2.3/toplevel.h
--- kasterold/toplevel.h	Sat Apr 14 01:17:39 2001
+++ kaster2.3/toplevel.h	Mon Dec 10 02:01:00 2001
@@ -26,10 +26,10 @@
 public:
     KAstTopLevel();
     virtual ~KAstTopLevel();
+    void playSound( const char *snd );
 
 private:
     void initKAction();
-    void playSound( const char *snd );
     void readSoundMapping();
     void doStats();
 
diff -u kasterold/version.h kaster2.3/version.h
--- kasterold/version.h	Tue Mar 13 06:52:57 2001
+++ kaster2.3/version.h	Sat Nov 24 17:09:30 2001
@@ -1 +1 @@
-#define KASTEROIDS_VERSION	"2.2"
+#define KASTEROIDS_VERSION	"2.3"
diff -u kasterold/view.cpp kaster2.3/view.cpp
--- kasterold/view.cpp	Sun Jul 29 06:59:04 2001
+++ kaster2.3/view.cpp	Mon Feb  4 02:36:35 2002
@@ -21,7 +21,7 @@
 
 #define REFRESH_DELAY           33
 #define SHIP_SPEED              0.3
-#define MISSILE_SPEED           10.0
+#define MISSILE_SPEED           7.0
 #define SHIP_STEPS              64
 #define ROTATE_RATE             2
 #define SHIELD_ON_COST          1
@@ -33,7 +33,7 @@
 #define MAX_SHIP_SPEED		12
 #define MAX_BRAKES              5
 #define MAX_SHIELDS             5
-#define MAX_FIREPOWER		5
+#define MAX_FIREPOWER		400
 
 #define TEXT_SPEED              4
 
@@ -204,7 +204,7 @@
 
     mBrakeCount = 0;
     mTeleportCount = 0;
-    mShootCount = 0;
+    mShootCount = 40;
 
     ship->show();
     shield->show();
@@ -263,13 +263,13 @@
 
 // - - -
 
-void KAsteroidsView::addRocks( int num )
+void KAsteroidsView::addRocks( int num , int RockSize)
 {
     for ( int i = 0; i < num; i++ )
     {
-        KRock *rock = new KRock( animation[ID_ROCK_LARGE], &field,
-                                 ID_ROCK_LARGE, krandom.getLong(2),
-				 krandom.getLong(2) ? -1 : 1 );
+        KRock *rock = new KRock( animation[ RockSize ], &field,
+                                 RockSize, krandom.getLong(2),
+				 krandom.getLong(4) ? -1 : 1 );
         double dx = (2.0 - krandom.getDouble()*4.0) * rockSpeed;
         double dy = (2.0 - krandom.getDouble()*4.0) * rockSpeed;
         rock->setVelocity( dx, dy );
@@ -277,16 +277,16 @@
         if ( dx > 0 )
         {
             if ( dy > 0 )
-                rock->move( 5, 5, 0 );
+                rock->move( 1, rand()%(field.height()), 0 );
             else
-                rock->move( 5, field.height() - 25, 0 );
+                rock->move( field.width(), rand()%(field.height()) , 0 );
         }
         else
         {
             if ( dy > 0 )
-                rock->move( field.width() - 25, 5, 0 );
+                rock->move( rand()%(field.width()), 1, 0 );
             else
-                rock->move( field.width() - 25, field.height() - 25, 0 );
+                rock->move( rand()%(field.width()), field.height() , 0 );
         }
         rock->show( );
         rocks.append( rock );
@@ -559,7 +559,23 @@
             if ( (*hit)->rtti() >= ID_ROCK_LARGE &&
                  (*hit)->rtti() <= ID_ROCK_SMALL )
             {
-                shotsHit++;
+	    
+                
+	          KBit *bit;
+		for ( int i = 0; i < (rand()%3+1); i++ )
+                    {
+                            
+                      bit = new KBit( animation[ID_BIT], &field );
+                      bit->move( (*hit)->x() + 5 - krandom.getDouble() * 10,
+                                 (*hit)->y() + 5 - krandom.getDouble() * 10,
+                                 krandom.getLong(bit->frameCount()) );
+                      bit->setVelocity((*hit)->xVelocity() + 1-krandom.getDouble()*2,
+                                       (*hit)->yVelocity() + 1-krandom.getDouble()*2 );
+                      bit->setDeath( 15 + krandomgetLong(40) );
+                      bit->show( );
+                      bits.append( bit );
+                }    
+		shotsHit++;
                 rockHit( *hit );
                 missiles.removeRef( missile );
                 break;
@@ -631,15 +647,15 @@
                      (*it)->rtti() <= ID_ROCK_SMALL )
                 {
                     KBit *bit;
-                    for ( int i = 0; i < 12; i++ )
+                    for ( int i = 0; i < 20; i++ )
                     {
                       bit = new KBit( animation[ID_BIT], &field );
                       bit->move( ship->x() + 5 - krandom.getDouble() * 10,
                                  ship->y() + 5 - krandom.getDouble() * 10,
                                  krandom.getLong(bit->frameCount()) );
-                      bit->setVelocity( 1-krandom.getDouble()*2,
-                                        1-krandom.getDouble()*2 );
-                      bit->setDeath( 60 + krandom.getLong(60) );
+                      bit->setVelocity( 3-krandom.getDouble()*5,
+                                        3-krandom.getDouble()*5 );
+                      bit->setDeath( 40 + krandom.getLong(90) );
                       bit->show( );
                       bits.append( bit );
                     }
@@ -749,19 +765,28 @@
 
         if ( shootShip )
         {
-            if ( !shootDelay && (int)missiles.count() < mShootCount + 2 )
+            if ( !shootDelay && (int)missiles.count() < 4 )
             {
               KMissile *missile = new KMissile( animation[ID_MISSILE], &field );
-              missile->move( 21+ship->x()+cosangle*21,
-                             21+ship->y()+sinangle*21, 0 );
-              missile->setVelocity( shipDx + cosangle*MISSILE_SPEED,
-                                    shipDy + sinangle*MISSILE_SPEED );
+              missile->move( 20+ship->x()+cosangle*21,
+                             20+ship->y()+sinangle*21, 0 );
+	      if ( mShootCount < 1 )
+	      {
+                 missile->setVelocity( shipDx + cosangle*MISSILE_SPEED,
+                                       shipDy + sinangle*MISSILE_SPEED );
+	      }
+	      else
+	      {
+                 missile->setVelocity( shipDx + cosangle*(MISSILE_SPEED+4),
+                                       shipDy + sinangle*(MISSILE_SPEED+4));              
+		 reducePower( 1 );
+		 mShootCount--;
+	      }
               missile->show( );
               missiles.append( missile );
               shotsFired++;
-              reducePower( 1 );
 
-              shootDelay = 5;
+              shootDelay = 4;
             }
 
             if ( shootDelay )
@@ -817,7 +842,7 @@
                     switch( pup->rtti() )
                     {
                       case ID_ENERGY_POWERUP:
-                        shipPower += 150;
+                        shipPower += 180;
                         if ( shipPower > MAX_POWER_LEVEL )
                             shipPower = MAX_POWER_LEVEL;
                         break;
@@ -834,10 +859,12 @@
                         break;
                       case ID_SHOOT_POWERUP:
                         if ( mShootCount < MAX_FIREPOWER )
-                            mShootCount++;
-                        break;
+                            mShootCount += 80;
+			break;
                     }
-
+		    
+                    //playSound( "TakePowerup" );
+		    //How play this sound ?
                     powerups.removeRef( pup );
                     vitalsChanged = true;
                 }
diff -u kasterold/view.h kaster2.3/view.h
--- kasterold/view.h	Fri Mar 16 06:47:51 2001
+++ kaster2.3/view.h	Wed Jan 30 01:43:53 2002
@@ -27,7 +27,7 @@
 
     void reset();
     void setRockSpeed( double rs ) { rockSpeed = rs; }
-    void addRocks( int num );
+    void addRocks( int num, int size );
     void newGame();
     void endGame();
     void newShip();


More information about the kde-games-devel mailing list