<P>This second loop uses the same variable (<CODE>i</CODE>) as the first one, so it only continues for as many loops as the first one had left. It literally just adds or subtracts 1 (based on whether stepx or stepy was positive or negative) from <CODE>position.x</CODE> and <CODE>position.y</CODE> until the player goes into a wall, where it then moves back 1 in both directions. The idea of this loop is so that the player doesn't end up just floating a couple pixels off of any platform. Then, the function is ended.</P>
<P>The rest of <CODE>physics()</CODE> is very simple. All it does is check if the player is off the right side of the screen. If so, it changes to the next level, sets <CODE>frozen</CODE> to 1 in order to allow dialogue to play, and moves the player up to the top left of the screen. <I>Also, it breaks the game somehow. When I added the <CODE>frozen=1</CODE>it started closing the window on reaching it. This doesn't happen when <CODE>main()</CODE> does this, so I have no idea why it happens here.</I> (that's also partially why I'm writing this, I hope i can figure it out...)</P>
<H2>Drawing on the screen</H2>
+ <P>The next part of the main loop is the part that draws on the screen. This is begun with <CODE>BeginDrawing()</CODE> and ended with <CODE>EndDrawing()</CODE>.</P>
+ <P>There are two parts here as well: <CODE>bühnezeichnen()</CODE> (draw "stage", idk why i called it that i think i used too much scratch), which draws the level + the dialogue; and <CODE>spielerzeichnen()</CODE> (draw player), which ... draws the player.</P>
+ <H3>Drawing the level</H3>
+ <P>First, the function just loops through every platform in the current level, drawing them on the screen. It's literally that easy.</P>
+ <DETAILS>
+ <SUMMARY>How the level data is structured</SUMMARY>
+ <P>The data for each level is stored in <CODE>level_data.h</CODE> in 3 big arrays. First, there's an array with all the dialogue and one with all the platforms, and then there's another array that links those together. (along with giving the level a name)</P>
+ <P>The array of dialogue is an array of structs.The dialogue struct consists of a string for the character speaking it's name, the filename of an image of said character, and what they are saying; additionally, there is a <CODE>Color</CODE> (raylib type i think) for the colour the character's name should be shown as.</P>
+ <P>The array of platforms is also an array of structs. The platform struct consists of a <CODE>Rectangle</CODE> defining where on the screen the platform is and a <CODE>Color</CODE> defining what colour it should be displayed in.</P>
+ <P>The array linking these is called <CODE>stages</CODE>, and it is also an array of structs. The <CODE>stage</CODE> struct has first a string for the name of the level. Then, it has a pointer to the first <CODE>struct platform</CODE> in the <CODE>platforms</CODE> array used in the level, and an <CODE>int</CODE> (<CODE>platform_count</CODE>) for how many platforms are in it (all the platforms must be consecutive in the array). The part for the dialogue works the same way, with a pointer to the first one and the amount of dialogues.</P>
+ </DETAILS>
+ <P>Then, it checks if <CODE>frozen</CODE> is 1, aka if dialogue is currently going on. If this is true, it runs <CODE>drawdialogue()</CODE>, which draws the dialogue on the screen.</P>
+ <DETAILS>
+ <SUMMARY>How <CODE>drawdialogue()</CODE> works</SUMMARY>
+ </DETAILS>
+ <P>After that, it adds 1 to <CODE>current_dialogue</CODE>, and checks if its new value is equal to the amount of dialogues in the stage. If this is true (aka there is no more dialogue to play), it sets <CODE>current__dialogue</CODE> to 0 for the next stage, and then sets <CODE>frozen</CODE> to 0 so that the level can be played.</P>
+ <H3>Drawing the player</H3>
+ <P>Drawing the player is pretty easy. Basically, it just ... draws the image onto the screen at the correct x and y. However, there is also animation partially implemented.</P>
+ <P>Right now, it doesn't actually draw the correct frame, instead drawing the static version, but the way it works is adding <CODE>delta</CODE> to <CODE>time_since_switch</CODE> each time and then checking if that is greater than or equal to <CODE>FRAMELENGTH</CODE>. Then, it's supposed to draw the correct frame from the spritesheet.</P>
+ <H2>At the end</H2>
+ <P>This repeats until the user either closes the window or presses Escape. Then, the program... ends. like what else would it do idk </P>
+ </BODY>
+</HTML>
+