Attached is my take on what you are going for. On line 159 you should stop at len(TXT$) - 1. On line 162 it looks like you are reprinting everything up to the current character (special codes and all) on the current line. Instead you should keep track of both the x and y coordinate (x would increment for each character but reset to start on a newline). Then locate and print the current character o
Thanks for the compliment. The $, #, and % are type specifiers so SmileBasic knows what kind of data each variable stores. It helps you avoid data type bugs. Hopefully the next SmileBasic will get user defined types. Then I wouldn't need those anymore.
Attached is a starter sample program. Try typing it in. If you get it working try changing things around. As for tips: use lots of comments, use option strict, give your variables type specifiers. plan things out before you start coding. Avoid goto and gosub, use def instead. Have fun.
Q34443GD is my samples folder. If you are trying to do platform style jumping check out the program PLATFORM in there. It is super mario brothers type stuff. Never did get all the bugs out however. You may be interested in slimebump2 in there as well. P.S. I like the glasses. I may update that project some day so get it while the code is valid.
DEF lets you make user defined funtions. They can contain parameters and optionally return results. You can also define variables belonging to just that function. With user defined functions you can do recursion too. Basically like Gosub but much much better. I recommend user defined functions over gosub in virtually in every case.
Part 3 of 3: This is the part you were asking about. The coin checks if the player collided with it. If so, we play a sound, decrease the coins remaining and add to the score. After that we release the sprite from use. I also have a function for drawing the score on screen that is overdone. I use gputchr so I can use gprio to put it over top of the sprites and background.
Part 2 of 3. This shows the win state dialog and moving the player around in response to the D Pad. Note the use of Min() and Max() to limit the player to locations on screen.
Part 1 of 3: I fill the background, set up the sprites, and make a main loop. Note the use of spfunc. This allows you to create a function that is called for the sprite on each time through the main loop. The call sprite line in the loop makes sure everything gets called. Also note spcol so the sprites participate in collisions. I made it so you win the game when the coins are all collected.
Will the attached code help? 1 << 14 gives you the a number that in binary is just a 1 at the 14th bit. You then OR it with the tile number to combine them together. Once you have done it often enough it will make sense. But it can cause headaches the first few times. Just think of bits 12 to 15 as a bunch of true or false flags. You want to turn them on or off.
Attached is my version. The general steps are. Switch to the bottom screen and make a sprite there. Check if the touch screen has been touched. If touched check if the sprite was touched and if so do the thing you want. Just make sure you switch back to the bottom screen before checking for touch collisions again.