For smooth movement, i would recommend using ATAN, SIN and COS, since increasing/decreasing X and Y by conditional statements would produce an odd movement. Here's a sample code.
Depends on how you implement it. The algoritm archieve that gradual movement, just visualize it:
Let's suppose that the X value of a projectile which ID is 7 is 2 (X=2). On the first frame, X is increased by using the algoritm, now X is 3. Later on the next frame, the same algoritm is used, but since X is no longer 2 but 3, it will increase to 4, and so on...
The most generic ones:
- Using arrays (recommended).
- SPOFS alone.
Quick example:
I check a certain range of sprites ID and check if one of those IDs is actually being used on a sprite. If there's a sprite with such ID, i extract his X and Y values (by using SPOFS), increase either X or Y, and relocating the sprite using the new coordinates.
That's also relative easy.
If by laser you mean a big laser that goes into infinity: Just spawn it using the player coordinates.
If you mean individual projectiles: Same as above but after spawn it, on each frame, increase the offsets of every single projectile so they will still move independently of the player.
By manipulating variables that later will be used to locate the sprite onscreen:
IF BUTTON(1) AND #RIGHT THEN INC PX
IF BUTTON(1) AND #LEFT THEN DEC PX
SPOFS 2,PX,PY
Well, you can take a look at the commands, their explanation and their examples to see whenever command could help you on your task.
Other thing you could do is toying (practice) around with such commands and algoritms, you will learn a lot from that. I was toying with Sine and Cosine and from that i made this game from it:
--
That is called Algoritm, which helps out to visualize a complex process. You can extrapolate that logic into computer instructions and voilá, you have a program.
On summary: You basically write instructions to a computer to do what you want it to do. To make those instructions you need to learn the tools you have available (functions, keywords and data types), and logic to glue all that.
The computer executes instructions line-by-line just as we do anything. For example:
To go to school i should:
1) Wake up
2) Dress up
3) Eat breakfast
4) Take the bus
--
Also, you can check the built-in examples and see their codes and try to understand them. IMO is not a good way to learn since all of them are spaghetti code and you would get confused, in contrast of being structured code, which improves readability of the code.
If you want to learn how to program: any how-to-program tutorial should do the trick.
If you want to learn the built-in functions: SmileBASIC website has a Reference Manual that listed all functions with examples. You can also use the "?" button on the keyboardto access to certain parts of the manual (only works if you locate the cursor on a function or keyword).
In that regard, any how-to-program thread should work, sad thing SmileBASIC doesn't have a built-in tutorial for that, but well...
If you want to know the functionality of any built-in function, the SmileBASIC webpage has a Reference Manual for that. Anything beyond that is basic knowledge on how to write code.