<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[eigenes game &amp;gt;&amp;gt; geht natürlich nich :P]]></title><description><![CDATA[<p>ich hatte ma lust, nen eigenes spiel zu entwerfen, aber es läuft natürlcih nich <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>fehlerbeschreibung und sourcecode hier<br />
---&gt; <a href="http://nopaste.easy-coding.de/?id=490" rel="nofollow">http://nopaste.easy-coding.de/?id=490</a></p>
<p>sind auch teilweise befehle aus der sprache &quot;c&quot; dabei xD, aber das liegt daran, das mir nen kumpel nen teil gecodet hat, aber ich glaub es is nich schwer da durchzublicken <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/147509/eigenes-game-gt-gt-geht-natürlich-nich-p</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Sep 2026 08:25:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/147509.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 17 May 2006 14:34:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to eigenes game &amp;gt;&amp;gt; geht natürlich nich :P on Wed, 17 May 2006 14:34:42 GMT]]></title><description><![CDATA[<p>ich hatte ma lust, nen eigenes spiel zu entwerfen, aber es läuft natürlcih nich <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>fehlerbeschreibung und sourcecode hier<br />
---&gt; <a href="http://nopaste.easy-coding.de/?id=490" rel="nofollow">http://nopaste.easy-coding.de/?id=490</a></p>
<p>sind auch teilweise befehle aus der sprache &quot;c&quot; dabei xD, aber das liegt daran, das mir nen kumpel nen teil gecodet hat, aber ich glaub es is nich schwer da durchzublicken <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1059621</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1059621</guid><dc:creator><![CDATA[CronX]]></dc:creator><pubDate>Wed, 17 May 2006 14:34:42 GMT</pubDate></item><item><title><![CDATA[Reply to eigenes game &amp;gt;&amp;gt; geht natürlich nich :P on Wed, 17 May 2006 22:50:36 GMT]]></title><description><![CDATA[<p>Hm, der code vom link (vernünftig formatiert):</p>
<pre><code class="language-cpp">/*
	dies soll eigentlcih ein spiel werden, oben mit der &quot;do&quot; schleife
	isses so gedacht das sich das schiff bewegt, unten mit der &quot;for&quot;
	schleife sind die &quot;kometen&quot; programmiert die einem entgegenkommen
	- mein prob is nur, das die kometen nich entgegenkommen UND ich
	das schiff bewegen kann (also nit gleichzeitig), das hat ich
	schonmal so gemacht, da ging das nur jetz mit 3kometen gehts
	nimmer -.-
*/

/*
 *	Changed to fit Borland C/C++ 3.0 for DOS:
 *	#include &lt;cstdlib&gt;
 */
#include &lt;stdlib.h&gt;

/*
 *	Changed to fit Borland C/C++ 3.0 for DOS:
 *	#include &lt;iostream&gt;
 */
#include &lt;iostream.h&gt;

/*
 *	I don't know this file:
 *	#include &quot;stdafx.h&quot;
 */

/*
 *	Do not include &quot;.c&quot;-files!
 *	#include &quot;conioex.c&quot;
 */

/*
 *	Changed to fit Borland C/C++ 3.0 for DOS:
 *	#include &quot;conioex.h&quot;
 */
#include &lt;conio.h&gt;

#include &lt;time.h&gt;
#include &lt;stdio.h&gt;
#include &lt;malloc.h&gt;

/*
 *	Needed for sleep( );
 */
#include &lt;dos.h&gt;

/*
 *	Typedef's:
 */
typedef enum { false = 0, true } bool;

/*
 *	Function Prototypes:
 */
int komet();

/*
 *	Application Entry:
 */
int main()
{
	char	a	=  0;
	char	l	=  0;
	int	q	= 40;

	/*
	 *	Never used:
	 *	int e = 5;
	 *	char w, s, d;
	 */

	int		x	= 15;
	int		y	=  5;

	/*
	 *	Never used:
	 *	int	zufall;
	 */

	srand( (unsigned) time(NULL) );

	komet( );

	do {
		l = getch( );
		if ( l == 'w' ) {
			/*
			 *	system( &quot;cls&quot; );
			 *	Not portable, stay consistent:
			 */
			clrscr( );

			/*
			 *	y--;
			 *	No temporary copy needed:
			 */
			--y;

			gotoxy( x, y );
			printf( &quot;X-&gt;&quot; );
		} else if( l=='d' ) {
			clrscr();

			/*
			 *	x++;
			 *	see above!
			 */
			++x;

			gotoxy( x, y );
			printf( &quot;X-&gt;&quot; );
		} else if( l == 'a' ) {
			clrscr( );

			/*
			 *	--x;
			 *	see above!
			 */
			--x;

			gotoxy( x, y );
			printf( &quot;X-&gt;&quot; );
		} else if( l == 's' ) {
			clrscr();

			/*
			 *	y++;
			 *	see above!
			 */
			++y;

			gotoxy( x,y );
			printf( &quot;X-&gt;&quot; );
		}
		/*
		 *	q--;
		 *	see above, but why?
		 */

		--q;

		/*
		 *	why, assigned and never used!?
		 */
		a = 0;

	/*
	 *	} while( 1 );
	 */
	} while( true );

	/*
	 *	Never reached:
	 */

	/*
	 *	system( &quot;PAUSE&quot; );
	 *	Not portable, stay consistent:
	 */
	getch( );

	return EXIT_SUCCESS;
}

int komet()
{
	int	zeit	=  0;
	int	ende	=  1;

	int	kom1x	= 50;
	int	kom1y	=  0;

	int	kom2x	= 50;
	int	kom2y	=  0;

	int	kom3x	= 50;
	int	kom3y	=  0;

	/*
	 *	Never used:
	 *	int kom4x = 50, kom4y;
     */

	/*
	 *	srand( ( unsigned ) time( NULL ) );
	 *	srand( ) should only be used once at
	 *	program start to initialize rand( ).
	 *	There's no need to do so every time
	 *	you call rand( )!
	 */

	/*
	 *	There is no need for integer zufall,
	 *	int	zufall = rand( ) % 3;
	 */

	kom1y = ( rand( ) % 3 ) + 10;

	/*
	 *	Changed
	 *	int zufall2 = rand() % 3;
	 *	if( zufall2 == 0 )
	 *		zufall2 = 4;
	 *	to:
	 */
	int zufall2 = rand() % 3;
	zufall2 = !zufall2 ? 4 : zufall2;

	kom2y = kom1y + zufall2;

	/*
	 *	Changed
	 *	int zufall3 = rand() % 3;
	 *	if( zufall3 == 0 )
	 *		zufall3 = 4;
	 *	to:
	 */
	int zufall3 = rand() % 3;
	zufall3 = !zufall3 ? 4 : zufall3;

	kom3y = kom2y + zufall3;

	for( zeit = 75; zeit != ende; --zeit ) {
		if( kom1x != 0 ) {
			gotoxy (kom1x, kom1y);
			printf(&quot;000&quot;);
		}

		/*
		 *	if( zeit &lt; 75-10 )
		 *  {
		 *		if(kom2x!=0)
		 *		{
		 *			gotoxy (kom2x, kom2y);
		 *			printf(&quot;000&quot;);
		 *		}
		 *	}
		 *	*WTF!?!?*
		 */

		if( ( zeit &lt; 65 ) &amp;&amp; ( kom3x != 0 ) ) {
			gotoxy(kom3x, kom3y);
			printf(&quot;000&quot;);
		}

		sleep(100);
		clrscr();

		if(kom1x!=0)
			kom1x--;

		/*
		 *	if(zeit&lt;75-10)
		 *	{
		 *		if(kom2x!=0)
		 *			kom2x--;
		 *	}
		 *
		 *	if(zeit&lt;75-20)
		 *	{
		 *		if(kom3x!=0)
		 *			kom3x--;
		 *	}
		 * Again: *WTF!?!?*
		 */
		 if( ( zeit &lt; 65 ) &amp;&amp; ( kom2x != 0 ) )
			kom2x--;

		 if( ( zeit &lt; 55 ) &amp;&amp; ( kom3x != 0 ) )
			kom3x--;
	}

	/*
	 *	defined as
	 *		int komet()
	 *	but no return value!
	 */
}
</code></pre>
<p>Aber warum zum teufel lernst du nicht C (du bist übrigens im falschen Forum, hier ist C++) an einfachen Beispielen und wendest dann das erlernte in *einfachen*<br />
Progrämmchen an, anstatt dich auf ein &quot;Spiel&quot; zu stürzen, das weder irgendwann<br />
geil aussehen noch in absehbarer Zeit funktionieren wird? nimm dir bitte meine<br />
Kommentare zu Herze und denk scharf nach.</p>
<p>Greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1059894</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1059894</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Wed, 17 May 2006 22:50:36 GMT</pubDate></item></channel></rss>