Guns? (SOLVED)

I know it’s possible to make guns, but for a newbie, how would one go about making one in his game? I’ve been trying really hard to get it, but I’m not entirely certain.

Do you know much about vector math in games? It’s the easiest way to shoot bullets. Then you can use ray casting to check for collisions between frames if bullet moves fast enough.

To make guns work in your game you need to break down the questions into more basic parts.

http://blog.wolfire.com/2009/07/linear-algebra-for-game-developers-part-1/

You can do different kind of behavior for each guns. You can simulate accuracy by randomizing the direction of the bullet vector slightly within that gun’s range. Your bullets can have behaviors like arches / gravity too.

2 Likes

Thanks! Do I need to a factory for the bullets or no? Because I can’t seem to spawn them in.

Yes, the only way to dynamically spawn anything into a game is with factories (or proxies, but they are for big things like levels)

4 Likes

Thank you!