Hey guys!

I am working on a 2D game with weapons.

I have a base weapon script here

https://pastebin.com/JEXXNB9J

And have a script for each weapon which extends the base weapon and has all the firing and reloading function in it.

Here:

https://pastebin.com/rWinRQFB

I am happy I got close to it working but somehow the reload only works when pressing the reload button, but not automatically when the clip is empty.

Maybe you get a better look into the problem.

Also I'd love to get any input on what you think of it and if I maybe use some bad habits or really inefficient or unusual stuff that stings in your eye

Ready new to it.

Thanks for any help!

Mh kinda sad the community isn't more active but I found the mistake myself!

Problem was I always set the current_ammo equal to the clip_size which always filled the mag and thus it didn't need to reload.

This was supposed to only happen on initializing so that's what I missed.

You'd likely have gotten a reply or two if you had actually posted your code, or even just a snippet of it.

@Megalomaniak said: You'd likely have gotten a reply or two if you had actually posted your code, or even just a snippet of it.

I posted a pastebin including it, didn't that work? Altho I see that using the built in function is cleaner and easier to look into. Point taken, wasn't meant as attack but it is sometimes hard on noobs looking for help.

Ah, sorry. They do show up. I apparently had pastebin blocked on my end for some reason. Might be the case for some others as well, but shouldn't be the case for everybody.

@Muxu said: Mh kinda sad the community isn't more active but I found the mistake myself!

I saw the post, I just didn't have the time to reply. :sweat_smile: I'm glad you figure it out though! And thanks for posting the solution, that should make it easier for anyone else who has a similar issue in the future :smile:

2 years later