<?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[c++ console Spiel Problem]]></title><description><![CDATA[<p>Hallo..<br />
Ich bin am verzweifeln.. wer lust hat und etwas Zeit investieren möchte der kann mir gerne helfen und den code durchlesen um folgenden Fehler zu finden:</p>
<p>Die Objekte (obstacles) kommen an zufälliger Stelle von oben an und gehen nach unten.<br />
Wenn der Schuss (bei eingabe durch Spacetaste) an selber Stelle wie mit einem der Objekte<br />
ist, geht das Objekt sofort aus dem Sichtfeld und fängt von neu wieder an.</p>
<p>Wenn ich jedoch an bestimmten Positionen mit dem Schiff schieße, denkt das Programm, es sei ein Objekt im weg obwohl es ganz woanders ist. Dieses wird dann auch verschwinden.<br />
Die Positionen von der aus das Programm denkt, es sei etwas im Weg, variieren je nachdem wie ich das Aussehen des Objektes ändere. Egal ob char ascii oder ein Zeichen. Habe die jz als int gemacht aber dort auch keine Besserung.<br />
Sry für den langen code.</p>
<p>#include &lt;iostream&gt;<br />
#include &lt;Windows.h&gt;<br />
#include &lt;cstdlib&gt;<br />
#include &lt;ctime&gt;<br />
#include &lt;conio.h&gt;<br />
#include &lt;string.h&gt;<br />
#include &lt;stdio.h&gt;<br />
using namespace std;</p>
<p>void clearscreen(); //used to prevent flicker</p>
<p>int main()<br />
{<br />
char map[60][80];</p>
<p>//loads the map with spaces and borders<br />
for(int i=0; i &lt; 55; ++i) {<br />
for(int j=0; j &lt; 75; ++j) {</p>
<p>map[i][j] = ' ';<br />
}<br />
}</p>
<p>int y = 52, x = 36; //the cars coordinates<br />
srand(time(0));<br />
//the obstacles coordiantes<br />
int points = 0; //points that the player has earned<br />
int speedship = 20; //determines the speed of the obstacles (and the car)<br />
int speedobstacles=100;<br />
//the cash coordinates<br />
int cashcheck = 0; //balances when the cash spawns<br />
int cashpickedup = 0;<br />
int laserspeed = 10;<br />
int l= 53, s = 36;<br />
int laser = 0;<br />
int f = 0;<br />
int u = 0;<br />
int G = 0;<br />
int F = 0;<br />
int t;<br />
int zahl;<br />
int a = 0, b = rand() % 74 + 1;<br />
int g = 0, h = rand() % 74 + 1;<br />
int m = 0, n = rand() % 74 + 1;<br />
int zahl2 = 0;<br />
bool startup = true;</p>
<p>int obstacle = 'a';<br />
int obstacle2 = 'b';<br />
int obstacle1 = 'c';</p>
<p>//the game loop</p>
<p>for (int G=0; G&lt;=10; G++)<br />
{</p>
<p>for(;;) {<br />
clearscreen();<br />
//places the car at its default location</p>
<p><div class="plugin-markdown"><input type="checkbox" id="checkbox102830" checked="true" /><label for="checkbox102830">= 'I';</label></div><br />
map[y][x-1] = 'I';<br />
map[y][x+1] = 'I';<br />
map[y][x-2] = 'I';<br />
map[y][x-3] = '-';<br />
map[y][x-4] = '-';<br />
map[y][x-5] = 'i';<br />
map[y][x+2] = '-';<br />
map[y][x+3] = '-';<br />
map[y][x+4] = 'i';<br />
map[y-1][x+1] = '\';<br />
map[y-1][x-1] = 'I';<br />
map[y+1][x+1] = 'T';<br />
map[y+1][x-1] = '-';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102829" checked="true" /><label for="checkbox102829">= '-';</label></div><br />
map[y+1][x-2] = 'T';<br />
map[y+1][x-3] = '\';<br />
map[y+1][x+2] = '/';<br />
map[y-1][x-2] = 'I';<br />
map[y-2][x-1] = 'I';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102828" checked="true" /><label for="checkbox102828">= 'I';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102827" checked="true" /><label for="checkbox102827">= 'I';</label></div><br />
map[y-1][x-2] = '/';</p>
<p>//generates the obstacles</p>
<p>map[a+1][b-1] = ' ';<br />
map[a+1][b+1] = ' ';<br />
map[a+2][b] = ' ';<br />
++a;</p>
<p>map[a+1][b-1] = obstacle1;<br />
map[a+1][b+1] = obstacle1;<br />
map[a+2][b] = obstacle1;</p>
<p>map[m+1][n-1] = ' ';<br />
map[m+1][n+1] = ' ';<br />
map[m+2][n] = ' ';<br />
++m;</p>
<p>map[m+1][n-1] = obstacle;<br />
map[m+1][n+1] = obstacle;<br />
map[m+2][n] = obstacle;</p>
<p>map[g+1][h-1] = ' ';<br />
map[g+1][h+1] = ' ';<br />
map[g+2][h] = ' ';<br />
++g;</p>
<p>map[g+1][h-1] = obstacle2;<br />
map[g+1][h+1] = obstacle2;<br />
map[g+2][h] = obstacle2;</p>
<p>if(a &gt; 53)<br />
{<br />
a = 0;<br />
b = rand() % 74 + 1;</p>
<p>}</p>
<p>if(m &gt; 53)<br />
{<br />
m = 0;<br />
n = rand() % 74 + 1;</p>
<p>}</p>
<p>if(g &gt; 53)<br />
{<br />
g = 0;<br />
h = rand() % 74 + 1;</p>
<p>}</p>
<p>//displays the map<br />
for(int i=0; i &lt; 55; ++i) {<br />
for(int j=0; j &lt; 75; ++j) {<br />
cout &lt;&lt; map[i][j];<br />
if(j &gt;= 74) {<br />
cout &lt;&lt; endl;<br />
}<br />
}<br />
}<br />
cout &lt;&lt; &quot; Points: &quot; &lt;&lt; points;<br />
//does so the game starts after a key is pressed<br />
if(startup) {<br />
_getch();<br />
startup = false;<br />
}<br />
//moves the car to the left</p>
<p>if(GetAsyncKeyState(VK_LEFT)) {<br />
if(map[y][x-4] == obstacle) {<br />
goto lost;<br />
}<br />
else if(map[y][x-4] != '|') {<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102834" checked="true" /><label for="checkbox102834">= 'I';</label></div><br />
map[y][x-1] = ' ';<br />
map[y][x+1] = ' ';<br />
map[y][x-2] = ' ';<br />
map[y][x-3] = ' ';<br />
map[y][x-4] = ' ';<br />
map[y][x-5] = ' ';<br />
map[y][x+2] = ' ';<br />
map[y][x+3] = ' ';<br />
map[y][x+4] = ' ';<br />
map[y-1][x+1] = ' ';<br />
map[y-1][x-1] = ' ';<br />
map[y+1][x+1] = ' ';<br />
map[y+1][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102833" checked="true" /><label for="checkbox102833">= ' ';</label></div><br />
map[y+1][x-2] = ' ';<br />
map[y+1][x-3] = ' ';<br />
map[y+1][x+2] = ' ';<br />
map[y-1][x-2] = ' ';<br />
map[y-2][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102832" checked="true" /><label for="checkbox102832">= ' ';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102831" checked="true" /><label for="checkbox102831">= ' ';</label></div><br />
map[y-1][x-2] = ' ';<br />
if (laser == 0)<br />
{</p>
<p>map [l-2] [s] = ' ';<br />
map [l-2] [s-1] = ' ';</p>
<p>s -=3;<br />
}<br />
x -=3;<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102838" checked="true" /><label for="checkbox102838">= 'I';</label></div><br />
map[y][x-1] = 'I';<br />
map[y][x+1] = 'I';<br />
map[y][x-2] = 'I';<br />
map[y][x-3] = '-';<br />
map[y][x-4] = '-';<br />
map[y][x-5] = 'i';<br />
map[y][x+2] = '-';<br />
map[y][x+3] = '-';<br />
map[y][x+4] = 'i';<br />
map[y-1][x+1] = '\';<br />
map[y-1][x-1] = 'I';<br />
map[y+1][x+1] = 'T';<br />
map[y+1][x-1] = '-';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102837" checked="true" /><label for="checkbox102837">= '-';</label></div><br />
map[y+1][x-2] = 'T';<br />
map[y+1][x-3] = '\';<br />
map[y+1][x+2] = '/';<br />
map[y-1][x-2] = 'I';<br />
map[y-2][x-1] = 'I';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102836" checked="true" /><label for="checkbox102836">= 'I';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102835" checked="true" /><label for="checkbox102835">= 'I';</label></div><br />
map[y-1][x-2] = '/';</p>
<p>}<br />
}<br />
//moves the car to the right<br />
if(GetAsyncKeyState(VK_RIGHT)) {<br />
if(map[y][x+5] == obstacle) {<br />
goto lost;<br />
}<br />
else if(map[y][x+5] != '|' ) {<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102842" checked="true" /><label for="checkbox102842">= 'I';</label></div><br />
map[y][x-1] = ' ';<br />
map[y][x+1] = ' ';<br />
map[y][x-2] = ' ';<br />
map[y][x-3] = ' ';<br />
map[y][x-4] = ' ';<br />
map[y][x-5] = ' ';<br />
map[y][x+2] = ' ';<br />
map[y][x+3] = ' ';<br />
map[y][x+4] = ' ';<br />
map[y-1][x+1] = ' ';<br />
map[y-1][x-1] = ' ';<br />
map[y+1][x+1] = ' ';<br />
map[y+1][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102841" checked="true" /><label for="checkbox102841">= ' ';</label></div><br />
map[y+1][x-2] = ' ';<br />
map[y+1][x-3] = ' ';<br />
map[y+1][x+2] = ' ';<br />
map[y-1][x-2] = ' ';<br />
map[y-2][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102840" checked="true" /><label for="checkbox102840">= ' ';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102839" checked="true" /><label for="checkbox102839">= ' ';</label></div><br />
map[y-1][x-2] = ' ';<br />
if (laser == 0)<br />
{</p>
<p>map [l-2] [s] = ' ';<br />
map [l-2] [s-1] = ' ';<br />
s+=3;<br />
}<br />
x +=3;<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102846" checked="true" /><label for="checkbox102846">= 'I';</label></div><br />
map[y][x-1] = 'I';<br />
map[y][x+1] = 'I';<br />
map[y][x-2] = 'I';<br />
map[y][x-3] = '-';<br />
map[y][x-4] = '-';<br />
map[y][x-5] = 'i';<br />
map[y][x+2] = '-';<br />
map[y][x+3] = '-';<br />
map[y][x+4] = 'i';<br />
map[y-1][x+1] = '\';<br />
map[y-1][x-1] = 'I';<br />
map[y+1][x+1] = 'T';<br />
map[y+1][x-1] = '-';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102845" checked="true" /><label for="checkbox102845">= '-';</label></div><br />
map[y+1][x-2] = 'T';<br />
map[y+1][x-3] = '\';<br />
map[y+1][x+2] = '/';<br />
map[y-1][x-2] = 'I';<br />
map[y-2][x-1] = 'I';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102844" checked="true" /><label for="checkbox102844">= 'I';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102843" checked="true" /><label for="checkbox102843">= 'I';</label></div><br />
map[y-1][x-2] = '/';</p>
<p>}<br />
}</p>
<p>if(GetAsyncKeyState(VK_UP)) {<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102852" checked="true" /><label for="checkbox102852">== obstacle)</label></div><br />
{<br />
goto lost;<br />
}<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102851" checked="true" /><label for="checkbox102851">!= '|') {</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102850" checked="true" /><label for="checkbox102850">= ' ';</label></div><br />
map[y][x-1] = ' ';<br />
map[y][x+1] = ' ';<br />
map[y][x-2] = ' ';<br />
map[y][x-3] = ' ';<br />
map[y][x-4] = ' ';<br />
map[y][x-5] = ' ';<br />
map[y][x+2] = ' ';<br />
map[y][x+3] = ' ';<br />
map[y][x+4] = ' ';<br />
map[y-1][x+1] = ' ';<br />
map[y-1][x-1] = ' ';<br />
map[y+1][x+1] = ' ';<br />
map[y+1][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102849" checked="true" /><label for="checkbox102849">= ' ';</label></div><br />
map[y+1][x-2] = ' ';<br />
map[y+1][x-3] = ' ';<br />
map[y+1][x+2] = ' ';<br />
map[y-1][x-2] = ' ';<br />
map[y-2][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102848" checked="true" /><label for="checkbox102848">= ' ';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102847" checked="true" /><label for="checkbox102847">= ' ';</label></div><br />
map[y-1][x-2] = ' ';<br />
if (laser == 0)<br />
{</p>
<p>map [l-2] [s] = ' ';<br />
map [l-2] [s-1] = ' ';</p>
<p>l-=3;<br />
}<br />
y -=3;<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102856" checked="true" /><label for="checkbox102856">= 'I';</label></div><br />
map[y][x-1] = 'I';<br />
map[y][x+1] = 'I';<br />
map[y][x-2] = 'I';<br />
map[y][x-3] = '-';<br />
map[y][x-4] = '-';<br />
map[y][x-5] = 'i';<br />
map[y][x+2] = '-';<br />
map[y][x+3] = '-';<br />
map[y][x+4] = 'i';<br />
map[y-1][x+1] = '\';<br />
map[y-1][x-1] = 'I';<br />
map[y+1][x+1] = 'T';<br />
map[y+1][x-1] = '-';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102855" checked="true" /><label for="checkbox102855">= '-';</label></div><br />
map[y+1][x-2] = 'T';<br />
map[y+1][x-3] = '\';<br />
map[y+1][x+2] = '/';<br />
map[y-1][x-2] = 'I';<br />
map[y-2][x-1] = 'I';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102854" checked="true" /><label for="checkbox102854">= 'I';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102853" checked="true" /><label for="checkbox102853">= 'I';</label></div><br />
map[y-1][x-2] = '/';</p>
<p>}<br />
}</p>
<p>if(GetAsyncKeyState(VK_DOWN)) {<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102862" checked="true" /><label for="checkbox102862">== obstacle) {</label></div><br />
goto lost;<br />
}<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102861" checked="true" /><label for="checkbox102861">!= '|') {</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102860" checked="true" /><label for="checkbox102860">= ' ';</label></div><br />
map[y][x-1] = ' ';<br />
map[y][x+1] = ' ';<br />
map[y][x-2] = ' ';<br />
map[y][x-3] = ' ';<br />
map[y][x-4] = ' ';<br />
map[y][x-5] = ' ';<br />
map[y][x+2] = ' ';<br />
map[y][x+3] = ' ';<br />
map[y][x+4] = ' ';<br />
map[y-1][x+1] = ' ';<br />
map[y-1][x-1] = ' ';<br />
map[y+1][x+1] = ' ';<br />
map[y+1][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102859" checked="true" /><label for="checkbox102859">= ' ';</label></div><br />
map[y+1][x-2] = ' ';<br />
map[y+1][x-3] = ' ';<br />
map[y+1][x+2] = ' ';<br />
map[y-1][x-2] = ' ';<br />
map[y-2][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102858" checked="true" /><label for="checkbox102858">= ' ';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102857" checked="true" /><label for="checkbox102857">= ' ';</label></div><br />
map[y-1][x-2] = ' ';<br />
if (laser == 0)<br />
{</p>
<p>map [l-2] [s] = ' ';<br />
map [l-2] [s-1] = ' ';</p>
<p>l+=3;<br />
}<br />
y +=3;<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102866" checked="true" /><label for="checkbox102866">= 'I';</label></div><br />
map[y][x-1] = 'I';<br />
map[y][x+1] = 'I';<br />
map[y][x-2] = 'I';<br />
map[y][x-3] = '-';<br />
map[y][x-4] = '-';<br />
map[y][x-5] = 'i';<br />
map[y][x+2] = '-';<br />
map[y][x+3] = '-';<br />
map[y][x+4] = 'i';<br />
map[y-1][x+1] = '\';<br />
map[y-1][x-1] = 'I';<br />
map[y+1][x+1] = 'T';<br />
map[y+1][x-1] = '-';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102865" checked="true" /><label for="checkbox102865">= '-';</label></div><br />
map[y+1][x-2] = 'T';<br />
map[y+1][x-3] = '\';<br />
map[y+1][x+2] = '/';<br />
map[y-1][x-2] = 'I';<br />
map[y-2][x-1] = 'I';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102864" checked="true" /><label for="checkbox102864">= 'I';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102863" checked="true" /><label for="checkbox102863">= 'I';</label></div><br />
map[y-1][x-2] = '/';</p>
<p>}<br />
}</p>
<p>if(GetAsyncKeyState(VK_SPACE)) //Schießen</p>
<p>{</p>
<p>for (f=0; f&lt;=53; f++)<br />
{</p>
<p>if ( map [l-f] [s] == obstacle || map [l-f] [s-1] == obstacle)<br />
{</p>
<p>map [m-1] [n-1] ='<em>';<br />
map [m-1] [n+1] = '</em>';<br />
map [m-1] [n] = '<em>';<br />
map[m] [n] = '</em>';<br />
map[m+1][n-1] = '<em>';<br />
map[m+1][n+1] = '</em>';<br />
map[m+2][n] = '*';<br />
m = 53;<br />
}</p>
<p>if ( map [l-f] [s] == obstacle2 || map [l-f] [s-1] == obstacle2)<br />
{</p>
<p>map [g-1] [h-1] ='<em>';<br />
map [g-1] [h+1] = '</em>';<br />
map [g-1] [h] = '<em>';<br />
map[g] [h] = '</em>';<br />
map[g+1][h-1] = '<em>';<br />
map[g+1][h+1] = '</em>';<br />
map[g+2][h] = '*';</p>
<p>g=53;</p>
<p>}</p>
<p>if ( map [l-f] [s] == obstacle1 || map [l-f] [s-1] == obstacle1)<br />
{</p>
<p>map [a-1] [b-1] ='<em>';<br />
map [a-1] [b+1] = '</em>';<br />
map [a-1] [b] = '<em>';<br />
map[a] [b] = '</em>';<br />
map[a+1][b-1] = '<em>';<br />
map[a+1][b+1] = '</em>';<br />
map[a+2][b] = '*';<br />
a = 53;<br />
}</p>
<p>map [l-f] [s] = '|';<br />
map [l-f] [s-1] = '|';</p>
<p>}<br />
F=1;<br />
t=1;</p>
<p>}</p>
<p>if (F==1)<br />
{</p>
<p>++G;<br />
if (G==2)</p>
<p>{</p>
<p>for (f=0; f&lt;=53; f++)<br />
{</p>
<p>map [l-f] [s] = ' ';<br />
map [l-f] [s-1] = ' ';<br />
map [l-f] [s+1] = ' ';<br />
map [l-f] [s-2] = ' ';<br />
map [l-f] [s+2] = ' ';<br />
map [l-f] [s-3] = ' ';<br />
map [l-f] [s+3] = ' ';<br />
map [l-f] [s-4] = ' ';<br />
map [l-f] [s+4] = ' ';<br />
map [l-f] [s-5] = ' ';<br />
map [l-f] [s+5] = ' ';<br />
map [l-f] [s-6] = ' ';</p>
<p>}<br />
G=0;<br />
}<br />
if (G==0)<br />
{</p>
<p>F=0;<br />
}<br />
}</p>
<p>//checks if the car crashed<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102867" checked="true" /><label for="checkbox102867">== obstacle2 || map[y-2][x-1] == obstacle2 || map[y-2][x+1] == obstacle2 || map[y] [x-4] == obstacle2 || map[y] [x+5] == obstacle2) {</label></div><br />
lost:<br />
cout &lt;&lt; &quot;\n\nDu hast verloren!\n&quot; &lt;&lt; endl;<br />
cin.get();<br />
return 0;<br />
}<br />
//checks if the player picked up cash</p>
<p>++points;<br />
//speeds up the obstacles each time the player gets another 100 points<br />
if(points == 100 || points == 200 || points == 300 || points == 400) {</p>
<p>}<br />
Sleep(speedship);<br />
}<br />
}</p>
<p>return 0;<br />
}<br />
void clearscreen()<br />
{<br />
HANDLE hOut;<br />
COORD Position;</p>
<p>hOut = GetStdHandle(STD_OUTPUT_HANDLE);</p>
<p>Position.X = 0;<br />
Position.Y = 0;<br />
SetConsoleCursorPosition(hOut, Position);<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/331327/c-console-spiel-problem</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 17:38:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/331327.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 22 Feb 2015 20:16:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to c++ console Spiel Problem on Sun, 22 Feb 2015 20:16:12 GMT]]></title><description><![CDATA[<p>Hallo..<br />
Ich bin am verzweifeln.. wer lust hat und etwas Zeit investieren möchte der kann mir gerne helfen und den code durchlesen um folgenden Fehler zu finden:</p>
<p>Die Objekte (obstacles) kommen an zufälliger Stelle von oben an und gehen nach unten.<br />
Wenn der Schuss (bei eingabe durch Spacetaste) an selber Stelle wie mit einem der Objekte<br />
ist, geht das Objekt sofort aus dem Sichtfeld und fängt von neu wieder an.</p>
<p>Wenn ich jedoch an bestimmten Positionen mit dem Schiff schieße, denkt das Programm, es sei ein Objekt im weg obwohl es ganz woanders ist. Dieses wird dann auch verschwinden.<br />
Die Positionen von der aus das Programm denkt, es sei etwas im Weg, variieren je nachdem wie ich das Aussehen des Objektes ändere. Egal ob char ascii oder ein Zeichen. Habe die jz als int gemacht aber dort auch keine Besserung.<br />
Sry für den langen code.</p>
<p>#include &lt;iostream&gt;<br />
#include &lt;Windows.h&gt;<br />
#include &lt;cstdlib&gt;<br />
#include &lt;ctime&gt;<br />
#include &lt;conio.h&gt;<br />
#include &lt;string.h&gt;<br />
#include &lt;stdio.h&gt;<br />
using namespace std;</p>
<p>void clearscreen(); //used to prevent flicker</p>
<p>int main()<br />
{<br />
char map[60][80];</p>
<p>//loads the map with spaces and borders<br />
for(int i=0; i &lt; 55; ++i) {<br />
for(int j=0; j &lt; 75; ++j) {</p>
<p>map[i][j] = ' ';<br />
}<br />
}</p>
<p>int y = 52, x = 36; //the cars coordinates<br />
srand(time(0));<br />
//the obstacles coordiantes<br />
int points = 0; //points that the player has earned<br />
int speedship = 20; //determines the speed of the obstacles (and the car)<br />
int speedobstacles=100;<br />
//the cash coordinates<br />
int cashcheck = 0; //balances when the cash spawns<br />
int cashpickedup = 0;<br />
int laserspeed = 10;<br />
int l= 53, s = 36;<br />
int laser = 0;<br />
int f = 0;<br />
int u = 0;<br />
int G = 0;<br />
int F = 0;<br />
int t;<br />
int zahl;<br />
int a = 0, b = rand() % 74 + 1;<br />
int g = 0, h = rand() % 74 + 1;<br />
int m = 0, n = rand() % 74 + 1;<br />
int zahl2 = 0;<br />
bool startup = true;</p>
<p>int obstacle = 'a';<br />
int obstacle2 = 'b';<br />
int obstacle1 = 'c';</p>
<p>//the game loop</p>
<p>for (int G=0; G&lt;=10; G++)<br />
{</p>
<p>for(;;) {<br />
clearscreen();<br />
//places the car at its default location</p>
<p><div class="plugin-markdown"><input type="checkbox" id="checkbox102830" checked="true" /><label for="checkbox102830">= 'I';</label></div><br />
map[y][x-1] = 'I';<br />
map[y][x+1] = 'I';<br />
map[y][x-2] = 'I';<br />
map[y][x-3] = '-';<br />
map[y][x-4] = '-';<br />
map[y][x-5] = 'i';<br />
map[y][x+2] = '-';<br />
map[y][x+3] = '-';<br />
map[y][x+4] = 'i';<br />
map[y-1][x+1] = '\';<br />
map[y-1][x-1] = 'I';<br />
map[y+1][x+1] = 'T';<br />
map[y+1][x-1] = '-';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102829" checked="true" /><label for="checkbox102829">= '-';</label></div><br />
map[y+1][x-2] = 'T';<br />
map[y+1][x-3] = '\';<br />
map[y+1][x+2] = '/';<br />
map[y-1][x-2] = 'I';<br />
map[y-2][x-1] = 'I';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102828" checked="true" /><label for="checkbox102828">= 'I';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102827" checked="true" /><label for="checkbox102827">= 'I';</label></div><br />
map[y-1][x-2] = '/';</p>
<p>//generates the obstacles</p>
<p>map[a+1][b-1] = ' ';<br />
map[a+1][b+1] = ' ';<br />
map[a+2][b] = ' ';<br />
++a;</p>
<p>map[a+1][b-1] = obstacle1;<br />
map[a+1][b+1] = obstacle1;<br />
map[a+2][b] = obstacle1;</p>
<p>map[m+1][n-1] = ' ';<br />
map[m+1][n+1] = ' ';<br />
map[m+2][n] = ' ';<br />
++m;</p>
<p>map[m+1][n-1] = obstacle;<br />
map[m+1][n+1] = obstacle;<br />
map[m+2][n] = obstacle;</p>
<p>map[g+1][h-1] = ' ';<br />
map[g+1][h+1] = ' ';<br />
map[g+2][h] = ' ';<br />
++g;</p>
<p>map[g+1][h-1] = obstacle2;<br />
map[g+1][h+1] = obstacle2;<br />
map[g+2][h] = obstacle2;</p>
<p>if(a &gt; 53)<br />
{<br />
a = 0;<br />
b = rand() % 74 + 1;</p>
<p>}</p>
<p>if(m &gt; 53)<br />
{<br />
m = 0;<br />
n = rand() % 74 + 1;</p>
<p>}</p>
<p>if(g &gt; 53)<br />
{<br />
g = 0;<br />
h = rand() % 74 + 1;</p>
<p>}</p>
<p>//displays the map<br />
for(int i=0; i &lt; 55; ++i) {<br />
for(int j=0; j &lt; 75; ++j) {<br />
cout &lt;&lt; map[i][j];<br />
if(j &gt;= 74) {<br />
cout &lt;&lt; endl;<br />
}<br />
}<br />
}<br />
cout &lt;&lt; &quot; Points: &quot; &lt;&lt; points;<br />
//does so the game starts after a key is pressed<br />
if(startup) {<br />
_getch();<br />
startup = false;<br />
}<br />
//moves the car to the left</p>
<p>if(GetAsyncKeyState(VK_LEFT)) {<br />
if(map[y][x-4] == obstacle) {<br />
goto lost;<br />
}<br />
else if(map[y][x-4] != '|') {<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102834" checked="true" /><label for="checkbox102834">= 'I';</label></div><br />
map[y][x-1] = ' ';<br />
map[y][x+1] = ' ';<br />
map[y][x-2] = ' ';<br />
map[y][x-3] = ' ';<br />
map[y][x-4] = ' ';<br />
map[y][x-5] = ' ';<br />
map[y][x+2] = ' ';<br />
map[y][x+3] = ' ';<br />
map[y][x+4] = ' ';<br />
map[y-1][x+1] = ' ';<br />
map[y-1][x-1] = ' ';<br />
map[y+1][x+1] = ' ';<br />
map[y+1][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102833" checked="true" /><label for="checkbox102833">= ' ';</label></div><br />
map[y+1][x-2] = ' ';<br />
map[y+1][x-3] = ' ';<br />
map[y+1][x+2] = ' ';<br />
map[y-1][x-2] = ' ';<br />
map[y-2][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102832" checked="true" /><label for="checkbox102832">= ' ';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102831" checked="true" /><label for="checkbox102831">= ' ';</label></div><br />
map[y-1][x-2] = ' ';<br />
if (laser == 0)<br />
{</p>
<p>map [l-2] [s] = ' ';<br />
map [l-2] [s-1] = ' ';</p>
<p>s -=3;<br />
}<br />
x -=3;<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102838" checked="true" /><label for="checkbox102838">= 'I';</label></div><br />
map[y][x-1] = 'I';<br />
map[y][x+1] = 'I';<br />
map[y][x-2] = 'I';<br />
map[y][x-3] = '-';<br />
map[y][x-4] = '-';<br />
map[y][x-5] = 'i';<br />
map[y][x+2] = '-';<br />
map[y][x+3] = '-';<br />
map[y][x+4] = 'i';<br />
map[y-1][x+1] = '\';<br />
map[y-1][x-1] = 'I';<br />
map[y+1][x+1] = 'T';<br />
map[y+1][x-1] = '-';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102837" checked="true" /><label for="checkbox102837">= '-';</label></div><br />
map[y+1][x-2] = 'T';<br />
map[y+1][x-3] = '\';<br />
map[y+1][x+2] = '/';<br />
map[y-1][x-2] = 'I';<br />
map[y-2][x-1] = 'I';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102836" checked="true" /><label for="checkbox102836">= 'I';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102835" checked="true" /><label for="checkbox102835">= 'I';</label></div><br />
map[y-1][x-2] = '/';</p>
<p>}<br />
}<br />
//moves the car to the right<br />
if(GetAsyncKeyState(VK_RIGHT)) {<br />
if(map[y][x+5] == obstacle) {<br />
goto lost;<br />
}<br />
else if(map[y][x+5] != '|' ) {<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102842" checked="true" /><label for="checkbox102842">= 'I';</label></div><br />
map[y][x-1] = ' ';<br />
map[y][x+1] = ' ';<br />
map[y][x-2] = ' ';<br />
map[y][x-3] = ' ';<br />
map[y][x-4] = ' ';<br />
map[y][x-5] = ' ';<br />
map[y][x+2] = ' ';<br />
map[y][x+3] = ' ';<br />
map[y][x+4] = ' ';<br />
map[y-1][x+1] = ' ';<br />
map[y-1][x-1] = ' ';<br />
map[y+1][x+1] = ' ';<br />
map[y+1][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102841" checked="true" /><label for="checkbox102841">= ' ';</label></div><br />
map[y+1][x-2] = ' ';<br />
map[y+1][x-3] = ' ';<br />
map[y+1][x+2] = ' ';<br />
map[y-1][x-2] = ' ';<br />
map[y-2][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102840" checked="true" /><label for="checkbox102840">= ' ';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102839" checked="true" /><label for="checkbox102839">= ' ';</label></div><br />
map[y-1][x-2] = ' ';<br />
if (laser == 0)<br />
{</p>
<p>map [l-2] [s] = ' ';<br />
map [l-2] [s-1] = ' ';<br />
s+=3;<br />
}<br />
x +=3;<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102846" checked="true" /><label for="checkbox102846">= 'I';</label></div><br />
map[y][x-1] = 'I';<br />
map[y][x+1] = 'I';<br />
map[y][x-2] = 'I';<br />
map[y][x-3] = '-';<br />
map[y][x-4] = '-';<br />
map[y][x-5] = 'i';<br />
map[y][x+2] = '-';<br />
map[y][x+3] = '-';<br />
map[y][x+4] = 'i';<br />
map[y-1][x+1] = '\';<br />
map[y-1][x-1] = 'I';<br />
map[y+1][x+1] = 'T';<br />
map[y+1][x-1] = '-';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102845" checked="true" /><label for="checkbox102845">= '-';</label></div><br />
map[y+1][x-2] = 'T';<br />
map[y+1][x-3] = '\';<br />
map[y+1][x+2] = '/';<br />
map[y-1][x-2] = 'I';<br />
map[y-2][x-1] = 'I';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102844" checked="true" /><label for="checkbox102844">= 'I';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102843" checked="true" /><label for="checkbox102843">= 'I';</label></div><br />
map[y-1][x-2] = '/';</p>
<p>}<br />
}</p>
<p>if(GetAsyncKeyState(VK_UP)) {<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102852" checked="true" /><label for="checkbox102852">== obstacle)</label></div><br />
{<br />
goto lost;<br />
}<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102851" checked="true" /><label for="checkbox102851">!= '|') {</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102850" checked="true" /><label for="checkbox102850">= ' ';</label></div><br />
map[y][x-1] = ' ';<br />
map[y][x+1] = ' ';<br />
map[y][x-2] = ' ';<br />
map[y][x-3] = ' ';<br />
map[y][x-4] = ' ';<br />
map[y][x-5] = ' ';<br />
map[y][x+2] = ' ';<br />
map[y][x+3] = ' ';<br />
map[y][x+4] = ' ';<br />
map[y-1][x+1] = ' ';<br />
map[y-1][x-1] = ' ';<br />
map[y+1][x+1] = ' ';<br />
map[y+1][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102849" checked="true" /><label for="checkbox102849">= ' ';</label></div><br />
map[y+1][x-2] = ' ';<br />
map[y+1][x-3] = ' ';<br />
map[y+1][x+2] = ' ';<br />
map[y-1][x-2] = ' ';<br />
map[y-2][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102848" checked="true" /><label for="checkbox102848">= ' ';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102847" checked="true" /><label for="checkbox102847">= ' ';</label></div><br />
map[y-1][x-2] = ' ';<br />
if (laser == 0)<br />
{</p>
<p>map [l-2] [s] = ' ';<br />
map [l-2] [s-1] = ' ';</p>
<p>l-=3;<br />
}<br />
y -=3;<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102856" checked="true" /><label for="checkbox102856">= 'I';</label></div><br />
map[y][x-1] = 'I';<br />
map[y][x+1] = 'I';<br />
map[y][x-2] = 'I';<br />
map[y][x-3] = '-';<br />
map[y][x-4] = '-';<br />
map[y][x-5] = 'i';<br />
map[y][x+2] = '-';<br />
map[y][x+3] = '-';<br />
map[y][x+4] = 'i';<br />
map[y-1][x+1] = '\';<br />
map[y-1][x-1] = 'I';<br />
map[y+1][x+1] = 'T';<br />
map[y+1][x-1] = '-';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102855" checked="true" /><label for="checkbox102855">= '-';</label></div><br />
map[y+1][x-2] = 'T';<br />
map[y+1][x-3] = '\';<br />
map[y+1][x+2] = '/';<br />
map[y-1][x-2] = 'I';<br />
map[y-2][x-1] = 'I';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102854" checked="true" /><label for="checkbox102854">= 'I';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102853" checked="true" /><label for="checkbox102853">= 'I';</label></div><br />
map[y-1][x-2] = '/';</p>
<p>}<br />
}</p>
<p>if(GetAsyncKeyState(VK_DOWN)) {<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102862" checked="true" /><label for="checkbox102862">== obstacle) {</label></div><br />
goto lost;<br />
}<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102861" checked="true" /><label for="checkbox102861">!= '|') {</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102860" checked="true" /><label for="checkbox102860">= ' ';</label></div><br />
map[y][x-1] = ' ';<br />
map[y][x+1] = ' ';<br />
map[y][x-2] = ' ';<br />
map[y][x-3] = ' ';<br />
map[y][x-4] = ' ';<br />
map[y][x-5] = ' ';<br />
map[y][x+2] = ' ';<br />
map[y][x+3] = ' ';<br />
map[y][x+4] = ' ';<br />
map[y-1][x+1] = ' ';<br />
map[y-1][x-1] = ' ';<br />
map[y+1][x+1] = ' ';<br />
map[y+1][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102859" checked="true" /><label for="checkbox102859">= ' ';</label></div><br />
map[y+1][x-2] = ' ';<br />
map[y+1][x-3] = ' ';<br />
map[y+1][x+2] = ' ';<br />
map[y-1][x-2] = ' ';<br />
map[y-2][x-1] = ' ';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102858" checked="true" /><label for="checkbox102858">= ' ';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102857" checked="true" /><label for="checkbox102857">= ' ';</label></div><br />
map[y-1][x-2] = ' ';<br />
if (laser == 0)<br />
{</p>
<p>map [l-2] [s] = ' ';<br />
map [l-2] [s-1] = ' ';</p>
<p>l+=3;<br />
}<br />
y +=3;<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102866" checked="true" /><label for="checkbox102866">= 'I';</label></div><br />
map[y][x-1] = 'I';<br />
map[y][x+1] = 'I';<br />
map[y][x-2] = 'I';<br />
map[y][x-3] = '-';<br />
map[y][x-4] = '-';<br />
map[y][x-5] = 'i';<br />
map[y][x+2] = '-';<br />
map[y][x+3] = '-';<br />
map[y][x+4] = 'i';<br />
map[y-1][x+1] = '\';<br />
map[y-1][x-1] = 'I';<br />
map[y+1][x+1] = 'T';<br />
map[y+1][x-1] = '-';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102865" checked="true" /><label for="checkbox102865">= '-';</label></div><br />
map[y+1][x-2] = 'T';<br />
map[y+1][x-3] = '\';<br />
map[y+1][x+2] = '/';<br />
map[y-1][x-2] = 'I';<br />
map[y-2][x-1] = 'I';<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102864" checked="true" /><label for="checkbox102864">= 'I';</label></div><br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102863" checked="true" /><label for="checkbox102863">= 'I';</label></div><br />
map[y-1][x-2] = '/';</p>
<p>}<br />
}</p>
<p>if(GetAsyncKeyState(VK_SPACE)) //Schießen</p>
<p>{</p>
<p>for (f=0; f&lt;=53; f++)<br />
{</p>
<p>if ( map [l-f] [s] == obstacle || map [l-f] [s-1] == obstacle)<br />
{</p>
<p>map [m-1] [n-1] ='<em>';<br />
map [m-1] [n+1] = '</em>';<br />
map [m-1] [n] = '<em>';<br />
map[m] [n] = '</em>';<br />
map[m+1][n-1] = '<em>';<br />
map[m+1][n+1] = '</em>';<br />
map[m+2][n] = '*';<br />
m = 53;<br />
}</p>
<p>if ( map [l-f] [s] == obstacle2 || map [l-f] [s-1] == obstacle2)<br />
{</p>
<p>map [g-1] [h-1] ='<em>';<br />
map [g-1] [h+1] = '</em>';<br />
map [g-1] [h] = '<em>';<br />
map[g] [h] = '</em>';<br />
map[g+1][h-1] = '<em>';<br />
map[g+1][h+1] = '</em>';<br />
map[g+2][h] = '*';</p>
<p>g=53;</p>
<p>}</p>
<p>if ( map [l-f] [s] == obstacle1 || map [l-f] [s-1] == obstacle1)<br />
{</p>
<p>map [a-1] [b-1] ='<em>';<br />
map [a-1] [b+1] = '</em>';<br />
map [a-1] [b] = '<em>';<br />
map[a] [b] = '</em>';<br />
map[a+1][b-1] = '<em>';<br />
map[a+1][b+1] = '</em>';<br />
map[a+2][b] = '*';<br />
a = 53;<br />
}</p>
<p>map [l-f] [s] = '|';<br />
map [l-f] [s-1] = '|';</p>
<p>}<br />
F=1;<br />
t=1;</p>
<p>}</p>
<p>if (F==1)<br />
{</p>
<p>++G;<br />
if (G==2)</p>
<p>{</p>
<p>for (f=0; f&lt;=53; f++)<br />
{</p>
<p>map [l-f] [s] = ' ';<br />
map [l-f] [s-1] = ' ';<br />
map [l-f] [s+1] = ' ';<br />
map [l-f] [s-2] = ' ';<br />
map [l-f] [s+2] = ' ';<br />
map [l-f] [s-3] = ' ';<br />
map [l-f] [s+3] = ' ';<br />
map [l-f] [s-4] = ' ';<br />
map [l-f] [s+4] = ' ';<br />
map [l-f] [s-5] = ' ';<br />
map [l-f] [s+5] = ' ';<br />
map [l-f] [s-6] = ' ';</p>
<p>}<br />
G=0;<br />
}<br />
if (G==0)<br />
{</p>
<p>F=0;<br />
}<br />
}</p>
<p>//checks if the car crashed<br />
<div class="plugin-markdown"><input type="checkbox" id="checkbox102867" checked="true" /><label for="checkbox102867">== obstacle2 || map[y-2][x-1] == obstacle2 || map[y-2][x+1] == obstacle2 || map[y] [x-4] == obstacle2 || map[y] [x+5] == obstacle2) {</label></div><br />
lost:<br />
cout &lt;&lt; &quot;\n\nDu hast verloren!\n&quot; &lt;&lt; endl;<br />
cin.get();<br />
return 0;<br />
}<br />
//checks if the player picked up cash</p>
<p>++points;<br />
//speeds up the obstacles each time the player gets another 100 points<br />
if(points == 100 || points == 200 || points == 300 || points == 400) {</p>
<p>}<br />
Sleep(speedship);<br />
}<br />
}</p>
<p>return 0;<br />
}<br />
void clearscreen()<br />
{<br />
HANDLE hOut;<br />
COORD Position;</p>
<p>hOut = GetStdHandle(STD_OUTPUT_HANDLE);</p>
<p>Position.X = 0;<br />
Position.Y = 0;<br />
SetConsoleCursorPosition(hOut, Position);<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2443883</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2443883</guid><dc:creator><![CDATA[Jannisspace]]></dc:creator><pubDate>Sun, 22 Feb 2015 20:16:12 GMT</pubDate></item><item><title><![CDATA[Reply to c++ console Spiel Problem on Sun, 22 Feb 2015 20:24:52 GMT]]></title><description><![CDATA[<pre><code>[code]
#include &lt;iostream&gt;
#include &lt;Windows.h&gt;
#include &lt;cstdlib&gt;
#include &lt;ctime&gt;
#include &lt;conio.h&gt;
#include &lt;string.h&gt;
#include &lt;stdio.h&gt;
using namespace std;

void clearscreen(); //used to prevent flicker

int main()
{
  char map[60][80];

    //loads the map with spaces and borders
    for(int i=0; i &lt; 55; ++i) {
      for(int j=0; j &lt; 75; ++j) {

        map[i][j] = ' ';
      }
    }

    int y = 52, x = 36; //the cars coordinates
    srand(time(0));
     //the obstacles coordiantes
    int points = 0; //points that the player has earned
    int speedship = 20; //determines the speed of the obstacles (and the car)
    int speedobstacles=100;
     //the cash coordinates
    int cashcheck = 0; //balances when the cash spawns
    int cashpickedup = 0;
    int laserspeed = 10;
    int l= 53, s = 36;
    int laser = 0;
    int f = 0;
    int u = 0;
    int G = 0;
    int F = 0;
    int t;
    int zahl;
    int a = 0, b = rand() % 74 + 1;
    int g = 0, h = rand() % 74 + 1;
    int m = 0, n = rand() % 74 + 1;
    int zahl2 = 0;
    bool startup = true;

    int obstacle = 'a';
    int obstacle2 = 'b';
    int obstacle1 = 'c';

    //the game loop

    for (int G=0; G&lt;=10; G++)
    {

    for(;;) {
      clearscreen();
        //places the car at its default location

    map[y][x] =  'I';
    map[y][x-1] = 'I';
    map[y][x+1] = 'I';
    map[y][x-2] = 'I';
    map[y][x-3] = '-';
    map[y][x-4] = '-';
    map[y][x-5] = 'i';
    map[y][x+2] = '-';
    map[y][x+3] = '-';
    map[y][x+4] = 'i';
    map[y-1][x+1] = '\\';
    map[y-1][x-1] = 'I';
    map[y+1][x+1] = 'T';
    map[y+1][x-1] = '-';
    map[y+1][x] = '-';
    map[y+1][x-2] = 'T';
    map[y+1][x-3] = '\\';
    map[y+1][x+2] = '/';
    map[y-1][x-2] = 'I';
    map[y-2][x-1] = 'I';
    map[y-1][x] = 'I';
    map[y-2][x] = 'I';
    map[y-1][x-2] = '/';

      //generates the obstacles

        map[a+1][b-1] = ' ';
        map[a+1][b+1] =  ' ';
        map[a+2][b] =  ' ';
        ++a;

        map[a+1][b-1] = obstacle1;
        map[a+1][b+1] = obstacle1;
        map[a+2][b] = obstacle1;

        map[m+1][n-1] = ' ';
        map[m+1][n+1] =  ' ';
        map[m+2][n] =  ' ';
        ++m;

        map[m+1][n-1] = obstacle;
        map[m+1][n+1] = obstacle;
        map[m+2][n] = obstacle;

        map[g+1][h-1] = ' ';
        map[g+1][h+1] =  ' ';
        map[g+2][h] =  ' ';
        ++g;

        map[g+1][h-1] = obstacle2;
        map[g+1][h+1] = obstacle2;
        map[g+2][h] = obstacle2;

      if(a &gt; 53)
        {
          a = 0;
          b = rand() % 74 + 1;

        }

       if(m &gt; 53)
        {
          m = 0;
          n = rand() % 74 + 1;

        }

       if(g &gt; 53)
        {
          g = 0;
          h = rand() % 74 + 1;

        }

    //displays the map
    for(int i=0; i &lt; 55; ++i) {
      for(int j=0; j &lt; 75; ++j) {
        cout &lt;&lt; map[i][j];
          if(j &gt;= 74) {
            cout &lt;&lt; endl;
          }
        }
      }
    cout &lt;&lt; &quot;    Points: &quot; &lt;&lt; points;
    //does so the game starts after a key is pressed
    if(startup) {
      _getch();
      startup = false;
    }
    //moves the car to the left

    if(GetAsyncKeyState(VK_LEFT)) {
      if(map[y][x-4] == obstacle) {
        goto lost;
      }
      else if(map[y][x-4] != '|') {
    map[y][x] = 'I';
    map[y][x-1] = ' ';
    map[y][x+1] = ' ';
    map[y][x-2] = ' ';
    map[y][x-3] = ' ';
    map[y][x-4] = ' ';
    map[y][x-5] = ' ';
    map[y][x+2] = ' ';
    map[y][x+3] = ' ';
    map[y][x+4] = ' ';
    map[y-1][x+1] = ' ';
    map[y-1][x-1] = ' ';
    map[y+1][x+1] = ' ';
    map[y+1][x-1] = ' ';
    map[y+1][x] = ' ';
    map[y+1][x-2] = ' ';
    map[y+1][x-3] = ' ';
    map[y+1][x+2] = ' ';
    map[y-1][x-2] = ' ';
    map[y-2][x-1] = ' ';
    map[y-1][x] = ' ';
    map[y-2][x] = ' ';
    map[y-1][x-2] = ' ';
    if (laser == 0)
    {

    map [l-2] [s] = ' ';
    map [l-2] [s-1] = ' ';

        s -=3;
    }
        x -=3;
     map[y][x] = 'I';
    map[y][x-1] = 'I';
    map[y][x+1] = 'I';
    map[y][x-2] = 'I';
    map[y][x-3] = '-';
    map[y][x-4] = '-';
    map[y][x-5] = 'i';
    map[y][x+2] = '-';
    map[y][x+3] = '-';
    map[y][x+4] = 'i';
    map[y-1][x+1] = '\\';
    map[y-1][x-1] = 'I';
    map[y+1][x+1] = 'T';
    map[y+1][x-1] = '-';
    map[y+1][x] = '-';
    map[y+1][x-2] = 'T';
    map[y+1][x-3] = '\\';
    map[y+1][x+2] = '/';
    map[y-1][x-2] = 'I';
    map[y-2][x-1] = 'I';
    map[y-1][x] = 'I';
    map[y-2][x] = 'I';
    map[y-1][x-2] = '/';

      }
    }
    //moves the car to the right
    if(GetAsyncKeyState(VK_RIGHT)) {
      if(map[y][x+5] == obstacle) {
        goto lost;
      }
      else if(map[y][x+5] != '|' ) {
         map[y][x] = 'I';
    map[y][x-1] = ' ';
    map[y][x+1] = ' ';
    map[y][x-2] = ' ';
    map[y][x-3] = ' ';
    map[y][x-4] = ' ';
    map[y][x-5] = ' ';
    map[y][x+2] = ' ';
    map[y][x+3] = ' ';
    map[y][x+4] = ' ';
    map[y-1][x+1] = ' ';
    map[y-1][x-1] = ' ';
    map[y+1][x+1] = ' ';
    map[y+1][x-1] = ' ';
    map[y+1][x] = ' ';
    map[y+1][x-2] = ' ';
    map[y+1][x-3] = ' ';
    map[y+1][x+2] = ' ';
    map[y-1][x-2] = ' ';
    map[y-2][x-1] = ' ';
    map[y-1][x] = ' ';
    map[y-2][x] = ' ';
    map[y-1][x-2] = ' ';
    if (laser == 0)
    {

    map [l-2] [s] = ' ';
    map [l-2] [s-1] = ' ';
        s+=3;
    }
        x +=3;
    map[y][x] = 'I';
    map[y][x-1] = 'I';
    map[y][x+1] = 'I';
    map[y][x-2] = 'I';
    map[y][x-3] = '-';
    map[y][x-4] = '-';
    map[y][x-5] = 'i';
    map[y][x+2] = '-';
    map[y][x+3] = '-';
    map[y][x+4] = 'i';
    map[y-1][x+1] = '\\';
    map[y-1][x-1] = 'I';
    map[y+1][x+1] = 'T';
    map[y+1][x-1] = '-';
    map[y+1][x] = '-';
    map[y+1][x-2] = 'T';
    map[y+1][x-3] = '\\';
    map[y+1][x+2] = '/';
    map[y-1][x-2] = 'I';
    map[y-2][x-1] = 'I';
    map[y-1][x] = 'I';
    map[y-2][x] = 'I';
    map[y-1][x-2] = '/';

      }
    }

        if(GetAsyncKeyState(VK_UP)) {
      if(map[y-1][x] == obstacle)
        {
        goto lost;
      }
      else if(map[y-1][x] != '|') {
          map[y][x] = ' ';
    map[y][x-1] = ' ';
    map[y][x+1] = ' ';
    map[y][x-2] = ' ';
    map[y][x-3] = ' ';
    map[y][x-4] = ' ';
    map[y][x-5] = ' ';
    map[y][x+2] = ' ';
    map[y][x+3] = ' ';
    map[y][x+4] = ' ';
    map[y-1][x+1] = ' ';
    map[y-1][x-1] = ' ';
    map[y+1][x+1] = ' ';
    map[y+1][x-1] = ' ';
    map[y+1][x] = ' ';
    map[y+1][x-2] = ' ';
    map[y+1][x-3] = ' ';
    map[y+1][x+2] = ' ';
    map[y-1][x-2] = ' ';
    map[y-2][x-1] = ' ';
    map[y-1][x] = ' ';
    map[y-2][x] = ' ';
    map[y-1][x-2] = ' ';
    if (laser == 0)
    {

    map [l-2] [s] = ' ';
         map [l-2] [s-1] = ' ';

        l-=3;
      }
        y -=3;
     map[y][x] = 'I';
    map[y][x-1] = 'I';
    map[y][x+1] = 'I';
    map[y][x-2] = 'I';
    map[y][x-3] = '-';
    map[y][x-4] = '-';
    map[y][x-5] = 'i';
    map[y][x+2] = '-';
    map[y][x+3] = '-';
    map[y][x+4] = 'i';
    map[y-1][x+1] = '\\';
    map[y-1][x-1] = 'I';
    map[y+1][x+1] = 'T';
    map[y+1][x-1] = '-';
    map[y+1][x] = '-';
    map[y+1][x-2] = 'T';
    map[y+1][x-3] = '\\';
    map[y+1][x+2] = '/';
    map[y-1][x-2] = 'I';
    map[y-2][x-1] = 'I';
    map[y-1][x] = 'I';
    map[y-2][x] = 'I';
    map[y-1][x-2] = '/';

      }
    }

          if(GetAsyncKeyState(VK_DOWN)) {
      if(map[y+1][x] == obstacle) {
        goto lost;
      }
      else if(map[y+1][x] != '|') {
          map[y][x] = ' ';
    map[y][x-1] = ' ';
    map[y][x+1] = ' ';
    map[y][x-2] = ' ';
    map[y][x-3] = ' ';
    map[y][x-4] = ' ';
    map[y][x-5] = ' ';
    map[y][x+2] = ' ';
    map[y][x+3] = ' ';
    map[y][x+4] = ' ';
    map[y-1][x+1] = ' ';
    map[y-1][x-1] = ' ';
    map[y+1][x+1] = ' ';
    map[y+1][x-1] = ' ';
    map[y+1][x] = ' ';
    map[y+1][x-2] = ' ';
    map[y+1][x-3] = ' ';
    map[y+1][x+2] = ' ';
    map[y-1][x-2] = ' ';
    map[y-2][x-1] = ' ';
    map[y-1][x] = ' ';
    map[y-2][x] = ' ';
    map[y-1][x-2] = ' ';
    if (laser == 0)
    {

    map [l-2] [s] = ' ';
    map [l-2] [s-1] = ' ';

        l+=3;
     }
        y +=3;
     map[y][x] = 'I';
    map[y][x-1] = 'I';
    map[y][x+1] = 'I';
    map[y][x-2] = 'I';
    map[y][x-3] = '-';
    map[y][x-4] = '-';
    map[y][x-5] = 'i';
    map[y][x+2] = '-';
    map[y][x+3] = '-';
    map[y][x+4] = 'i';
    map[y-1][x+1] = '\\';
    map[y-1][x-1] = 'I';
    map[y+1][x+1] = 'T';
    map[y+1][x-1] = '-';
    map[y+1][x] = '-';
    map[y+1][x-2] = 'T';
    map[y+1][x-3] = '\\';
    map[y+1][x+2] = '/';
    map[y-1][x-2] = 'I';
    map[y-2][x-1] = 'I';
    map[y-1][x] = 'I';
    map[y-2][x] = 'I';
    map[y-1][x-2] = '/';

      }
    }

     if(GetAsyncKeyState(VK_SPACE))   //Schießen

{

         for (f=0; f&lt;=53; f++)
         {

              if ( map [l-f] [s] == obstacle || map [l-f] [s-1] == obstacle)
                {

        map [m-1] [n-1] ='*';
        map [m-1] [n+1] = '*';
        map [m-1] [n]  =      '*';
        map[m]  [n]     =       '*';
        map[m+1][n-1] = '*';
        map[m+1][n+1] = '*';
        map[m+2][n] = '*';
        m = 53;
                }

                 if ( map [l-f] [s] == obstacle2 || map [l-f] [s-1] == obstacle2)
                {

        map [g-1] [h-1] ='*';
        map [g-1] [h+1] = '*';
        map [g-1] [h]  =      '*';
        map[g]  [h]     =       '*';
        map[g+1][h-1] = '*';
        map[g+1][h+1] = '*';
        map[g+2][h] = '*';

            g=53;

                }

                  if ( map [l-f] [s] == obstacle1 || map [l-f] [s-1] == obstacle1)
                {

        map [a-1] [b-1] ='*';
        map [a-1] [b+1] = '*';
        map [a-1] [b]  =      '*';
        map[a]  [b]     =       '*';
        map[a+1][b-1] = '*';
        map[a+1][b+1] = '*';
        map[a+2][b] = '*';
        a = 53;
                }

         map [l-f] [s] = '|';
         map [l-f] [s-1] = '|';

         }
         F=1;
         t=1;

}

if (F==1)
{

 ++G;
 if (G==2)

        {

         for (f=0; f&lt;=53; f++)
         {

         map [l-f] [s] = ' ';
         map [l-f] [s-1] = ' ';
         map [l-f] [s+1] = ' ';
         map [l-f] [s-2] = ' ';
         map [l-f] [s+2] = ' ';
         map [l-f] [s-3] = ' ';
         map [l-f] [s+3] = ' ';
         map [l-f] [s-4] = ' ';
         map [l-f] [s+4] = ' ';
         map [l-f] [s-5] = ' ';
         map [l-f] [s+5] = ' ';
         map [l-f] [s-6] = ' ';

         }
          G=0;
        }
        if (G==0)
        {

        F=0;
        }
}

    //checks if the car crashed
    if(map[y-2][x] == obstacle2 || map[y-2][x-1] == obstacle2 || map[y-2][x+1] == obstacle2 || map[y] [x-4] == obstacle2 || map[y] [x+5] == obstacle2) {
lost:
      cout &lt;&lt; &quot;\n\nDu hast verloren!\n&quot; &lt;&lt; endl;
      cin.get();
      return 0;
    }
    //checks if the player picked up cash

      ++points;
    //speeds up the obstacles each time the player gets another 100 points
    if(points == 100 || points == 200 || points == 300 || points == 400) {

      }
Sleep(speedship);
    }
    }

  return 0;
}
void clearscreen()
{
    HANDLE hOut;
    COORD Position;

    hOut = GetStdHandle(STD_OUTPUT_HANDLE);

    Position.X = 0;
    Position.Y = 0;
    SetConsoleCursorPosition(hOut, Position);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2443885</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2443885</guid><dc:creator><![CDATA[Jannisspace]]></dc:creator><pubDate>Sun, 22 Feb 2015 20:24:52 GMT</pubDate></item><item><title><![CDATA[Reply to c++ console Spiel Problem on Sun, 22 Feb 2015 20:30:48 GMT]]></title><description><![CDATA[<p>Das mag vielleicht hart klingen, aber: Der Code ist Muell. Und zwar uebler Muell. Das und der Umstand, dass du ueber 500 Zeilen schlecht formatierten Code hier postest und sagst: Leute, das ist mein Problem, loest das mal, wird dazu fuehren, dass sich sehr wahrscheinlich niemand damit befassen wird.</p>
<p>Was solltest du also tun?</p>
<p>Einen Debugger nutzen, um verschiedene Faelle durchzugehen und zu sehen, was den Fehler verursacht. Wenn das nicht moeglich ist, den Code auf das noetigste (!) zu reduzieren. Meistens findet man dann selbst den Fehler, ansonsten ist es einfacher, dann willige Helfer zu finden.<br />
Hier zum Beispiel: dein Code kompiliert bei mir nicht mal. Wie soll man denn da helfen?</p>
<p>Was du aber noch eher tun solltest, ist ein gutes Buch ueber C++ zu lesen und deinen Code neuschreiben. Da ist so viel uebel, da weiss man gar nicht wo man anfangen soll.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2443886</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2443886</guid><dc:creator><![CDATA[Hyde++ 0]]></dc:creator><pubDate>Sun, 22 Feb 2015 20:30:48 GMT</pubDate></item><item><title><![CDATA[Reply to c++ console Spiel Problem on Sun, 22 Feb 2015 20:38:37 GMT]]></title><description><![CDATA[<p>ja ok, ich habe einige Variablen drinn die ich nicht benutzt habe nur zum ausprobieren. Und wirklich viel Ahnung hab ich auch nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /><br />
Bei mir kompiliert alles ohne Fehler nur an dieser Stelle harpert es. (Ich benutze code blocks).<br />
Aber trotzdem Danke <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2443890</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2443890</guid><dc:creator><![CDATA[Jannisspace]]></dc:creator><pubDate>Sun, 22 Feb 2015 20:38:37 GMT</pubDate></item><item><title><![CDATA[Reply to c++ console Spiel Problem on Mon, 23 Feb 2015 03:48:38 GMT]]></title><description><![CDATA[<p>Jannisspace schrieb:</p>
<blockquote>
<p>Wenn ich jedoch an bestimmten Positionen mit dem Schiff schieße, denkt das Programm, es sei ein Objekt im weg obwohl es ganz woanders ist. Dieses wird dann auch verschwinden.</p>
</blockquote>
<p>Kann ich auch nach erreichen von ~280 Punkten nicht nachvollziehen. Das einzige was ich dir sagen kann ist, das die Steuerung und der Bildaufbau eine Qual sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2443920</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2443920</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Mon, 23 Feb 2015 03:48:38 GMT</pubDate></item><item><title><![CDATA[Reply to c++ console Spiel Problem on Mon, 23 Feb 2015 07:36:38 GMT]]></title><description><![CDATA[<p>Also das &quot;Flackern&quot; wurde durch VOID CLEARSCREEN() kein bisschen besser. Und das du zwischendurch einfach mal 7 Zeilen frei hast ist auch unnötig. Und ganz ehrlich: Die wirklich interessanten Sachen sind nicht kommentiert. Naja, ich seh mir das mal an wenn ich zuhause bin. BG</p>
<p>PS: Benutz mal den &quot;C++&quot; Buttton. Syntax Highlighting hilft!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2443927</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2443927</guid><dc:creator><![CDATA[PALone]]></dc:creator><pubDate>Mon, 23 Feb 2015 07:36:38 GMT</pubDate></item><item><title><![CDATA[Reply to c++ console Spiel Problem on Mon, 23 Feb 2015 13:40:12 GMT]]></title><description><![CDATA[<p>Wow also ich dachte echt das kann man vielleicht retten... naja...<br />
Also erstmal habe ich verschiedene Settings ausprobiert. Ein bisschen mit den Startparametern herumgespielt. Hat trotzdem Augenkrebs verursacht. Das System den Bildschirm zu einem Koordinatensystem zu verwandeln ist an sich gut. Aber:</p>
<p>- Der Bildschirm flackert echt hart. Ich denke, dass das Programm viel zu viel Leistung frisst um vernünftig zu laufen. Das Spiel zieht meine CPU auf bis zu 70%. Und damit läuft Skyrim locker flockig durch!</p>
<p>- Das Bild ist unruhig. das Fenster nach unten zu vergrössern hat geholfen. Flackern tuts immer noch.</p>
<p>- Wenn ich Schieße wird das Programm gekillt und meine CPU geht kurz auf 100%. Kann aber evtl. am Compiler liegen.</p>
<p>Die Variablen sehen danach so aus:<br />
map 0x0079e718 {0x0079e718 &quot; || ÌÌÌÌÌ..., ...} char[60][80]<br />
map[y-2] 0x0079f5c8 &quot; || ÌÌÌÌÌ... char[80]<br />
map[y] 0x0079f668 &quot; i--I||I--i ÌÌÌÌÌ... char[80]</p>
<p>Irgendwas verhunzt wohl die Speicherstellen...</p>
<p>- AUßERDEM!!! KEIN GOTO!!! Dein Code war schon sehr unübersichtlich, aber nicht soo kompliziert. Daher verständlich. GOTO führ zu &quot;Spaghetti-Code&quot;. Nicht tun. Bitte. Es gibt immer bessere Lösungen. Schleifen zum Beispiel. (Ausnahmen bestätigen die Regel. Aber schleifen mit einer BREAK Anweisung wären wohl besser gewesen.)</p>
<p>Zu dem vorhandenen Bug kann ich ja leider nichts sagen da das Programm einen Schuss mit einem Angriff auf meine CPU gleichsetzt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<p>Fazit: An sich kein schlechter einstieg für C++. Sowas habe ich (auch in anderen Sprachen) schon häufiger gesehen. Aber vieles ist eben unschön gelöst.</p>
<p><strong>Greets,</strong><br />
<em>PALone</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2443992</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2443992</guid><dc:creator><![CDATA[PALone]]></dc:creator><pubDate>Mon, 23 Feb 2015 13:40:12 GMT</pubDate></item><item><title><![CDATA[Reply to c++ console Spiel Problem on Mon, 23 Feb 2015 13:58:03 GMT]]></title><description><![CDATA[<p>PALone schrieb:</p>
<blockquote>
<p>Also das &quot;Flackern&quot; wurde durch VOID CLEARSCREEN() kein bisschen besser.</p>
</blockquote>
<p>Wie denn auch? Die ganze 'Map' wird andauernd neu via cout ausgegeben. Das kann doch nur flackern!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2443995</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2443995</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Mon, 23 Feb 2015 13:58:03 GMT</pubDate></item><item><title><![CDATA[Reply to c++ console Spiel Problem on Mon, 23 Feb 2015 18:55:38 GMT]]></title><description><![CDATA[<p>Davor jeweils ein CLEARSCREEN() (oder SYSTEM(&quot;cls&quot;) dachte das könnte evtl Performance heben da systemnah) haben NIX genützt. Hab mich aber auch nur etwa 30 min damit befasst. Nachdem ich das erste GOTO gesehen habe war schon verloren <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2444052</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2444052</guid><dc:creator><![CDATA[PALone]]></dc:creator><pubDate>Mon, 23 Feb 2015 18:55:38 GMT</pubDate></item><item><title><![CDATA[Reply to c++ console Spiel Problem on Tue, 24 Feb 2015 04:10:20 GMT]]></title><description><![CDATA[<p>PALone schrieb:</p>
<blockquote>
<p>Davor jeweils ein CLEARSCREEN() (oder SYSTEM(&quot;cls&quot;) dachte das könnte evtl Performance heben da systemnah) haben NIX genützt.</p>
</blockquote>
<p>Was ist daran &quot;systemnah&quot;? <code>system()</code> startet erst mal eine neue Instanz des Befehlsinterpreters (&lt;-- damit hast du performancetechnisch schon verloren) der dann <code>&quot;cls&quot;</code> ausführt, was wiederum den gesamten Console Screen Buffer mit dem Zeichen <code>' '</code> und den Attributen (Farbe) des Zeichens in der linken oberen Ecke überschreibt.</p>
<p>Auf die Lösung hat Belli schon angespielt:<br />
1. sich merken was neu gezeichnet werden muss<br />
2. nur eben <em>das</em> zeichnen<br />
3. nicht über gepufferte Ausgabe wie <code>std::cout</code> sondern am besten direkt in den Console Screen Buffer schreiben.<br />
4. ?<br />
5. Profit.</p>
<p>// edit: wenns immer noch zu lahm ist: double buffering.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2444103</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2444103</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Tue, 24 Feb 2015 04:10:20 GMT</pubDate></item></channel></rss>