Dealing with multiple enemy shots?
-
@SteveZX81 the code looks like it would create a new shot at every null sprite rather than just one, but you're getting none if one already exists. So I'm wondering if you've defined the length of shots as 1 rather than the maximum number of shots you want when you created the array. Or it is creating all of them, but in a single frame, so they're all at the same place, so it only looks like one. You could try adjusting their location by a multiple of i, just to visually see if it is creating more than one shot.
-
He's only getting one and no more because all the slots are being filled up with the same sprite, with the same properties. So there are X number of shots but they're all on top of each other. That would be my best guess without actually running the code.
-
That's what I meant by my second option for what had gone wrong. I just didn't word it very clearly.
-
Here is my code now.
When I press the shoot button I get
--Error --
Line 108
Function N/A
Operation not recognized. -
I will have to play about with this after work - i think that might be why I was using Will's method of assigning the nullSprite in the first place.
[edit] While you wait go back to assigning all empty slots to nullSprite and see if that works. The more I think about it, the more I think that's why I used that method in the first place. You will still need to break out of the loop with the 'foundSlot' boolean. But i have a feeling it is not liking you trying to assign a sprite handle to something that has previously declared as a bool.
-
oops (edited)
-
Mornin' @SteveZX81! I just shared a program called "particleLaser Sprites" which gives detailed comments on every section.
It's not doing any collision with enemies, but there is a commented out example for where the collision code would be.
Hope it helps mate, let me know if I can expand on anything in there.
-
@Dave said in Dealing with multiple enemy shots?:
Mornin' @SteveZX81! I just shared a program called "particleLaser Sprites" which gives detailed comments on every section.
It's not doing any collision with enemies, but there is a commented out example for where the collision code would be.
Hope it helps mate, let me know if I can expand on anything in there.
oh Dave, you're too good to me! Thank you.
-
@Dave Hi Dave. Where did you share "SpreadLaser Sprites"
-
Back then it would have been a user share as we did not have community sharing. If @Dave still has it then maybe he could re-share using an ID now?
-
@BildoCZ I might still have it, I'll check my Switch watch this space.
Edit: I do have it and I have now submitted it, the code is UQP63MNF6D but give it a few hours to clear the 'pending' state.
-
@SteveZX81 - Life saver. I deleted the program recently as I was cleaning up my projects (I tend to make a lot to test individual things).
Hope it helps @BildoCZ ! Let me know if you need anything
-
@SteveZX81 just downloaded it, looks good love the comments should be able to use this for my program hopefully
-
Thx all.
I'm a beginner in FUZE. But I used to work in Game Maker. :) -
@Dave so i'm using the laser program for my scrolling top down game to get my plane to shoot but i cant get the y axis movement working? apart from that it works great.
-
@waldron Y axis movement of the bullets you mean? I'll hae to check the program again as i've forgotten the details. Will download now
-
Hmm - the example doesn't use sprite properties to their best effect at all. It'll work, but it should really be using the properties of the sprites properly. I'll whip up another example a bit later and post the share code on this thread.
-
@Dave no the bullet direction is fine its just the ship movement i'm having trouble with the up and down movement tried all sorts
-
Give it a share and message me the share code if you like @waldron
Is it after adding the other code that the y axis movement stopped working, or are you y et to actually have it working as you wanted?
-
@Dave so the player controls for that one is
plr.vel += {j.lx,0} plr.pos += plr.vel plr.vel += *= 0.9`` i tried j.ly but it just go's diagonal lol