<?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[Benötige Hilfe]]></title><description><![CDATA[<p>Hallo, ich bin neu hier und kenne mich noch nicht so gut aus, also bitte um Nachsicht <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>
<p>Ich würde gerne ein C++/Cli Spiel programmieren. Das Spiel heißt Pong. Mir ist es bereits schon gelungen meinen &quot;Spielball&quot; zu bewegen. Nun komme ich aber nicht weiter und brauche Euren Rat.</p>
<p>Wie kann ich meinen &quot;Spielball&quot; von einer Wand abprallen lassen, bzw. welche Abfrage benötige ich? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Mein Code bis jetzt:</p>
<p>private: System::Void Timer_Tick(System::Object^ sender, System::EventArgs^ e) {</p>
<p>xWert += 10;<br />
yWert += 10;</p>
<p>Ball-&gt;Location = System::Drawing::Point(xWert, yWert);</p>
<p>if(Ball-&gt;Location.Y == 366)<br />
{<br />
xWert -= 10;<br />
yWert -= 10;<br />
}</p>
<p>}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/314136/benötige-hilfe</link><generator>RSS for Node</generator><lastBuildDate>Sat, 01 Aug 2026 16:36:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/314136.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 21 Feb 2013 15:44:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 15:46:49 GMT]]></title><description><![CDATA[<p>Hallo, ich bin neu hier und kenne mich noch nicht so gut aus, also bitte um Nachsicht <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>
<p>Ich würde gerne ein C++/Cli Spiel programmieren. Das Spiel heißt Pong. Mir ist es bereits schon gelungen meinen &quot;Spielball&quot; zu bewegen. Nun komme ich aber nicht weiter und brauche Euren Rat.</p>
<p>Wie kann ich meinen &quot;Spielball&quot; von einer Wand abprallen lassen, bzw. welche Abfrage benötige ich? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Mein Code bis jetzt:</p>
<p>private: System::Void Timer_Tick(System::Object^ sender, System::EventArgs^ e) {</p>
<p>xWert += 10;<br />
yWert += 10;</p>
<p>Ball-&gt;Location = System::Drawing::Point(xWert, yWert);</p>
<p>if(Ball-&gt;Location.Y == 366)<br />
{<br />
xWert -= 10;<br />
yWert -= 10;<br />
}</p>
<p>}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300662</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300662</guid><dc:creator><![CDATA[Human3000]]></dc:creator><pubDate>Thu, 21 Feb 2013 15:46:49 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 15:53:50 GMT]]></title><description><![CDATA[<blockquote>
<p>Wie kann ich meinen &quot;Spielball&quot; von einer Wand abprallen lassen, bzw. welche Abfrage benötige ich?</p>
</blockquote>
<p>Soll er lediglich von vertikalen, bzw. horizontalen Wänden abprallen, dann invertiere einfach die Y- bzw. X-Komponente des Richtungsvektors.</p>
<p>Sprich, bewegt sich der Ball in jedem Schritt 10 Pixel nach links und 3 nach oben, hat also den Richtungsvektor <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mover accent="true"><mrow><mi>v</mi></mrow><mo>⃗</mo></mover><mo>=</mo><mrow><mo fence="true">(</mo><mtable><mtr><mtd><mrow><mo>−</mo><mn>1</mn><mn>0</mn></mrow></mtd></mtr><mtr><mtd><mrow><mo>−</mo><mn>3</mn></mrow></mtd></mtr></mtable><mo fence="true">)</mo></mrow></mrow><annotation encoding="application/x-tex">\vec{v}=\left(\begin{array}{c} -10 \\ -3 \end{array}\right)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:1.45em;"></span><span class="strut bottom" style="height:2.40003em;vertical-align:-0.95003em;"></span><span class="base textstyle uncramped"><span class="mord accent"><span class="vlist"><span style="top:0em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="mord textstyle cramped"><span class="mord mathit" style="margin-right:0.03588em;">v</span></span></span><span style="top:0em;margin-left:0.05556em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="accent-body accent-vec"><span>⃗</span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="mrel">=</span><span class="minner textstyle uncramped"><span class="style-wrap reset-textstyle textstyle uncramped" style="top:0em;"><span class="delimsizing size3">(</span></span><span class="mord"><span class="mtable"><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist"><span style="top:-0.6099999999999999em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="mord textstyle uncramped"><span class="mord">−</span><span class="mord mathrm">1</span><span class="mord mathrm">0</span></span></span><span style="top:0.5900000000000003em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="mord textstyle uncramped"><span class="mord">−</span><span class="mord mathrm">3</span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="arraycolsep" style="width:0.5em;"></span></span></span><span class="style-wrap reset-textstyle textstyle uncramped" style="top:0em;"><span class="delimsizing size3">)</span></span></span></span></span></span>, und prallt dann gegen die Linke Wand, dann invertierst du die X-Komponente, sodass <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mover accent="true"><mrow><mi>v</mi></mrow><mo>⃗</mo></mover><mo>=</mo><mrow><mo fence="true">(</mo><mtable><mtr><mtd><mrow><mn>1</mn><mn>0</mn></mrow></mtd></mtr><mtr><mtd><mrow><mo>−</mo><mn>3</mn></mrow></mtd></mtr></mtable><mo fence="true">)</mo></mrow></mrow><annotation encoding="application/x-tex">\vec{v}=\left(\begin{array}{c} 10 \\ -3 \end{array}\right)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:1.45em;"></span><span class="strut bottom" style="height:2.40003em;vertical-align:-0.95003em;"></span><span class="base textstyle uncramped"><span class="mord accent"><span class="vlist"><span style="top:0em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="mord textstyle cramped"><span class="mord mathit" style="margin-right:0.03588em;">v</span></span></span><span style="top:0em;margin-left:0.05556em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="accent-body accent-vec"><span>⃗</span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="mrel">=</span><span class="minner textstyle uncramped"><span class="style-wrap reset-textstyle textstyle uncramped" style="top:0em;"><span class="delimsizing size3">(</span></span><span class="mord"><span class="mtable"><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist"><span style="top:-0.6099999999999999em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="mord textstyle uncramped"><span class="mord mathrm">1</span><span class="mord mathrm">0</span></span></span><span style="top:0.5900000000000003em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="mord textstyle uncramped"><span class="mord">−</span><span class="mord mathrm">3</span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="arraycolsep" style="width:0.5em;"></span></span></span><span class="style-wrap reset-textstyle textstyle uncramped" style="top:0em;"><span class="delimsizing size3">)</span></span></span></span></span></span>.<br />
Da in Pong keine Reibung herrscht, ist dabei die Y-Komponente unbeeinflusst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300666</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300666</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Thu, 21 Feb 2013 15:53:50 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:01:06 GMT]]></title><description><![CDATA[<p>Falls du Sones Beitrag nicht verstehst:</p>
<p>Statt 10 zu addieren oder zu subtrahieren, addiere immer den Wert der Variablen z.B. speedX und speedY.<br />
SpeedX (bzw. speedY -je nachdem welche 'Wand') nimmst du mal -1, wenn eine Wand erreicht wurde.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300670</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300670</guid><dc:creator><![CDATA[Jockelx]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:01:06 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:01:31 GMT]]></title><description><![CDATA[<p>ja, danke erstmal.</p>
<p>aber welche Abfrage muss ich treffen damit mein &quot;Spielball&quot; nicht das Spielfeld verlässt.</p>
<p>Momentan habe ich nämlich noch das Problem, dass sich mein Spielball von der Mitte des Spielfelds, schräg nach rechts unten bewegt und dann verschwindet der Spielball einfach.</p>
<p>Möchte aber, solbald er die Grenze des Spielfeldes erreicht, dass er abprallt?</p>
<p>Bei dieser Abfrage bin ich überfordert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300671</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300671</guid><dc:creator><![CDATA[Human3000]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:01:31 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:03:41 GMT]]></title><description><![CDATA[<p>Wird Location.Y denn sicher irgendwann genau gleich 366?<br />
Eher nicht oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300672</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300672</guid><dc:creator><![CDATA[Jockelx]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:03:41 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:09:13 GMT]]></title><description><![CDATA[<p>Keine ahnung ob diese Abfrage funktioniert. Aber da mein Spielfeld die Größe von 898 * 366 Pixel hat, dachte ich das nützt vielleicht was.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300675</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300675</guid><dc:creator><![CDATA[Human3000]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:09:13 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:14:38 GMT]]></title><description><![CDATA[<p>Und was ist die Startposition vom Ball?<br />
Wenn die z.B 350 ist, wird Location.Y dann irgendwann mal <strong>genau</strong> 366 wenn immer 10 addiert wird?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300680</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300680</guid><dc:creator><![CDATA[Jockelx]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:14:38 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:21:33 GMT]]></title><description><![CDATA[<p>Die Startposition vom Ball liegt derzeit bei (449,183).<br />
also der x-Wert ist 449 und der y-Wert 183.</p>
<p>ach ja genau, du du meinst wohl dass der Wert 366 nie genau erreicht wird.<br />
ich sollte besser &gt;= 366 schreiben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300682</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300682</guid><dc:creator><![CDATA[Human3000]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:21:33 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:24:34 GMT]]></title><description><![CDATA[<p>Genau. Zumindest solange du nur 4 Wände hast und keine kleinen Mauern oder sowas im Spielfeld stehen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300686</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300686</guid><dc:creator><![CDATA[Jockelx]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:24:34 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:32:30 GMT]]></title><description><![CDATA[<p>also ich hab jetzt folgendes mal ausgebessert. habe mein Spielfeld auf die Größe 900 x 360 Pixel verändert und meinen Startwert genau auf (0,0) gesetzt damit sicher die Zahl 360 erreicht wird.</p>
<p>meine Abfrage lautet nun:</p>
<p>private: System::Void Timer_Tick(System::Object^ sender, System::EventArgs^ e) {</p>
<p>xWert += 10;<br />
yWert += 10;</p>
<p>Ball-&gt;Location = System::Drawing::Point(xWert, yWert);</p>
<p>if(Ball-&gt;Location.Y == 360)<br />
{<br />
xWert += 10;<br />
yWert -= 10;<br />
}</p>
<p>}</p>
<p>aber der Ball prallt trotzdem nicht von der Wand ab, was nun? gibt es noch eine andere Abfrage? <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="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300689</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300689</guid><dc:creator><![CDATA[Human3000]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:32:30 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:33:23 GMT]]></title><description><![CDATA[<p>Dann bleibt er an der Wand kleben. Wie man das ändert haben Sone und ich schon geschreiben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300691</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300691</guid><dc:creator><![CDATA[Jockelx]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:33:23 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:39:31 GMT]]></title><description><![CDATA[<p>das habe ich auch schon geändert. nu r das Problem ist, dss er es nicht macht! Der Ball bleibt einfach nicht kleben, sondern fährt weiter.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300693</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300693</guid><dc:creator><![CDATA[Human3000]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:39:31 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:44:47 GMT]]></title><description><![CDATA[<p>Was ist &quot;das&quot; und &quot;es&quot;? Zeig mal den neuen Code.</p>
<blockquote>
<p>Der Ball bleibt einfach nicht kleben, sondern fährt weiter.</p>
</blockquote>
<p>Wirklich? 360 liegt außerhalb des Spielfelds, den Ball solltest du also gar nicht mehr sehen können.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300695</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300695</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:44:47 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:46:10 GMT]]></title><description><![CDATA[<p>Nein, er bleibt kleben, nur siehst du das nicht.<br />
LocationXY ist die linke obere Ecke des Balls.<br />
Abprallen sollte er aber, wenn die untere Ecke über den Bereich geht.<br />
Kommste damit weiter?</p>
<p>Edit: Kannst ja testeweise mal in deiner if-Abfrage nen kleineren Wert als die Spielfeldgröße angeben</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300696</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300696</guid><dc:creator><![CDATA[Jockelx]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:46:10 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:47:28 GMT]]></title><description><![CDATA[<p>alles klar. wenn das so ist, dann müsste ich nur noch die größe des Balls subtrahieren oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300698</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300698</guid><dc:creator><![CDATA[Human3000]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:47:28 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 16:50:28 GMT]]></title><description><![CDATA[<p>Ja, hört sich gut an.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300700</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300700</guid><dc:creator><![CDATA[Jockelx]]></dc:creator><pubDate>Thu, 21 Feb 2013 16:50:28 GMT</pubDate></item><item><title><![CDATA[Reply to Benötige Hilfe on Thu, 21 Feb 2013 17:29:45 GMT]]></title><description><![CDATA[<p>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/2300707</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300707</guid><dc:creator><![CDATA[Human3000]]></dc:creator><pubDate>Thu, 21 Feb 2013 17:29:45 GMT</pubDate></item></channel></rss>