Hi, been working on a project a little while now and I'm having some issues. I'm making a platformer and the problem is that gun mechanics are very difficult for me to get working. I can make guns shoot with Bullet behaviors and spawning but mirroring and weapons are the bane of me.
How do I make multiple guns? I've set up different animations for the player but it really does not work and doesn't change the origin points and spawning. Is there an easier way to do this?
I've also had issues with mirroring. When the player is mirrored and shoots, he shoots both directions for some reason with the system I've made. I cannot figure out how to fix this.
There are a few ways you can do this:
1. create separate animations for the character sprite holding different weapons.
2. Pin weapon to an image point (might need a plugin) or origin point of the character sprite. Mirror both the character and the weapon.
3. Set weapon position/angle/mirrored state on every tick to character's position/angle/mirrored state.
See this post:
As for firing a bullet, you need to set bullet angle (or bullet angle of motion) to 180 when the character is mirrored.
Thanks, I was able to get it working quite well. I just have one issue and that is bullets that have been spawned going to the right, when mirroring the character, come flying back at 180 degrees instead of going the direction they were originally in. You know how to fix this?
Develop games in your browser. Powerful, performant & highly capable.
That's probably because you are mirroring or changing the angle of an existing bullet instance.
You should set the angle in the event where you create/spawn new bullet.
that worked really well. that's all the issues fixed and you've helped me learn a lot, thanks!