Need helping making multiple Enemies on screen at a time.
I suppose you also posted this topic in the new SBS as well. You can assign variables and functions specific to a sprite using SPVAR and SPFUNC.
SPSET 0,0: SPOFS 0,200,125 SPVAR 0,โHEALTHโ,10 SPVAR 0,โNAMEโ,โStrawberryโ SPFUNC 0,โTESTโ LOOP CALL SPRITE VSYNC ENDLOOP DEF TEST VAR I=CALLIDX() VAR HP=SPVAR(I,โHEALTHโ) VAR NAME$=SPVAR(I,โNAMEโ) LOCATE 0,0:?NAME$+โ HP:โ;HP;โ โ IF BUTTON(1,#B_RRIGHT,2) THEN BEEP 0:DEC HP SPVAR I,โHEALTHโ,HP ENDIf this works (I have not tested this), text should appear at the top of the screen with a number that decreases every time you tap the A button. The function TEST is assigned to sprite 0. The CALL SPRITE function runs through every sprite function (in this case, โTESTโ is constantly called because it is assigned to the strawberry sprite). This isnโt a direct answer to your problem but I hope it can point you in the right direction.
No problem. Iโve recently started using sprite variables myself and it makes managing many sprites so much easier
Honestly once you get the hang out it its rinse and repeat. The thing o had most trouble one was Wall Collision with enemies.
It wasn't fun lol.
https://www.reddit.com/r/SmileBASIC/comments/j0putt/until_then_update_demo_release_october_5th/?utm_medium=android_app&utm_source=share
Oh for sure. Iโm working on a project that has background movement and attempting to move the enemy sprites with their own movement function while keeping up with the background movement all the while checking collision for all sprites was difficult to grasp. Iโve got it now though!
If you use DIM/VAR to allocate variables, remember that you need one for each sprite. You would need to either have unique variables or variables in an array. That is part of what makes using sprite variables a lot more attractive.