I did something similar in Sophia with the catapults and the JUMP command. Catapults "throw" stones by spawning a sprite nearby which then jumps and bounces until it meets an obstacle left or right, then it disappears and another one is spawned. A variable is set to 0 when the stone sprite disappears and to 1 when it is on the screen, in order to avoid a continuous spawning (if the variable is 0 the sprite can be spawned).
Post by Jonathan Cauldwell on Apr 15, 2020 15:14:47 GMT
Alessandro's idea is a good one.
If you're using MPAGD you've got TABLEJUMP (the old AGD JUMP) but you also have JUMP N, which might be better for projectiles and gives you a little more control so you can dampen any bounce. Don't forget MPAGD sprites also have READ, DATA and RESTORE so you can read X and Y coordinates or displacements from a table. Unlike Sinclair BASIC, MPAGD's sprites will all remember their individual positions in the DATA table so you can have multiple sprites on the go, all accessing the same table but at different points in the parabola/sine wave/orbit/whatever