0 Members and 1 Guest are viewing this topic.
Repeat getKey(15)End
Repeat getKey(15) //Our container code. Keeps repeating until user hits ClearFor(r1,0,79) //Loops through all 80 particlesr1*8+L1->r6 //Stores a pointer to the position of the particle in the array to r6{r6}{r}+{r6+4}{r}->{r6}{r} //Increments the x-position by the x-velocity{r6+6}{r}+4->{r6+6}{r} //Increments the y-velocity due to gravity. I find 4 to be a nice number.{r6+2}{r}+{r6+6}{r}->{r6+2}{r} //Increments the y-position by the y-velocityPxl-On({r6}{r}/256,{r6+2}{r}/256) //Draws the pixelEndDispGraphClrDraw //Displays the screen when all the pixels have been drawn and clears the screen so that the next set of updated particles can be drawn.End
For(r1,0,79)r1*8+L1->r612288->{r6}{r} //Sets the initial x-position of the particles to 48 (inflated by 256)12288->{r6+2}{r} //Sets the initial y-pos to 48rand^300-150->{r6+4}{r} //Sets the x-velocity to a random number between -150 and 150 (no bias)rand^300-325->{r6+6}{r} //Sets the y-velocity to a random number between-325 and -25 (biased upwards)End
For(r1,0,79)r1*8+L1->r612288->{r6}{r}12288->{r6+2}{r}rand^300-150->{r6+4}{r}rand^300-325->{r6+6}{r}EndRepeat getKey(15)For(r1,0,79)r1*8+L1->r6{r6}{r}+{r6+4}{r}->{r6}{r}{r6+6}{r}+4->{r6+6}{r}{r6+2}{r}+{r6+6}{r}->{r6+2}{r}Pxl-On({r6}{r}/256,{r6+2}{r}/256)EndDispGraphClrDrawEnd
For(r1,0,79)12288->{r1*8+L1->r6}{r}12288->{r6+2}{r}rand^300-150->{r6+4}{r}rand^300-325->{r6+6}{r}EndRepeat getKey(15)For(r1,0,79){r1*8+L1->r6+6}{r}+4->{r6+6}{r}Pxl-On({r6}{r}+{r6+4}{r}->{r6}{r}/256,{r6+2}{r}+{r6+6}{r}->{r6+2}{r}/256)EndDispGraphClrDrawEnd
Thanks for an awesome tutorial! I know the curly brackets point to a specific location in memory, but what does adding {r} (the superscript r?) do?
Quote from: chattahippie on July 29, 2011, 02:42:36 pmThanks for an awesome tutorial! I know the curly brackets point to a specific location in memory, but what does adding {r} (the superscript r?) do?It makes it so it's a two byte number. In other words, it allow it to hold any number from 0 to 65535 instead of just 0 to 255. It's also faster in Axe (generally speaking). However, it takes twice as much space to store a single number.
Repeat getKey(15) //Our container code. Keeps repeating until user hits ClearL1->r6 //Initializes the pointer held in r680While -1->r1 //Runs this loop 80 times{r6}{r}+{r6+4}{r}->{r6}{r} //Increments the x-position by the x-velocity{r6+6}{r}+4->{r6+6}{r} //Increments the y-velocity due to gravity. I find 4 to be a nice number.{r6+2}{r}+{r6+6}{r}->{r6+2}{r} //Increments the y-position by the y-velocityPxl-On({r6}{r}/256,{r6+2}{r}/256) //Draws the pixelr6+8->r6 //Moves the pointer in r6 up 8 bytes aka now it points to the next particler1EndDispGraphClrDraw //Displays and clears the screen so that the next set of updated particles can be drawn.End