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
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.
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.
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...