I’m a beginner game dev working on a retro shooter. I would like to have a weapon pickup system using sprites instead of meshes but I’m not sure how to make this work using blueprints. Is there a way to achieve this to make it as retro as possible?
I have actually done something like this before, inspired by Doom-engine games. Considering your tag I hope this is what you are looking for.
You will need a texture that you have set up for use as a sprite, and a blueprint for your pickup.
The Texture
When you have imported a texture you want to use for your sprite, you need to fix a few things. You’ll most likely want to disable texture filtering. If you have texture filtering on, you might experience that your sprite is blurred and not “retro pixel-y”.
- Open the texture and set its Texture Group property to 2D Pixels (unfiltered).
- In this specific case I would also recommend making sure that Mip Gen Settings are set to NoMipmaps, and Power Of Two Mode is set to None
The Blueprint
You naturally create a blueprint for your pickup. This blueprint needs to consist of two components: A Box Collision and a Billboard.
- If you look at the description for the billboard you will see that it is described as a 2d texture that always faces the camera… just like most of the games of that era did. Once you have added a billboard, set its Sprite property to point to your sprite texture. Looks neat already, doesn’t it?
- The box collision is what allows you to pick up the item. Old games usually had box collision that were equal size in X and Y. The X and Y were usually set to a number that was close to (or equal) to the width of the sprite in pixels. How they handled the Z (height) of the collision depends a bit from game to game. Some had a specific size (especially objects that the player could stand on), while other times they were simply “infinitely high”. I’d say set your Z to be close to or equal to the height of the sprite in pixels. In Unreal Engine 4, for the box collision you would have to set it as half the size you actually want it to be. As an example, if you have a texture that is 46x35 pixels, you would set your box collision’s box extent properties X and Y to 23 (half of 46) or Z to to 17.5 (half of 35).
- Check if your collision is placed below your floor. If it is, you will likely have to set its Z location in the blueprint to the same as the value you put in the box entents Z in the last step. Following the same example, that means you’d also have to put 17.5 for Z location.
- Next you need to check if Collision Preset property of the box collision allows for overlapping. I do believe I set mine to OverlapAllDynamic. This will allow your player to move “through” the object, without the object acting like a solid wall. You will also want to put a check in the checkbox named Generate Overlap Events.
- In your blueprint’s Event Graph you will need to add a “ActorBeginOverlap” event. What specific code you put in here depends on you and how your game works. The gist of it is that you will have the code add a new weapon to your players inventory (you can check which players walked over the item with the Other Actor input of the event), and either delete the pickup object or, if you want to add code for respawning the item, hide/disable it.
That’s the basic idea of how to achieve it. Hope this will help you on your way.
Thanks, I will try this out and see how it goes! By any Chance do you know how I would use a line trace for a bullet as a shoot mechanic, considering that I am adding more than one gun? And could you maybe send a picture of the blueprints you where explaining to help me visualise it? If not I’m sure I will manage! Thanks for the help!
Any idea, how to use a flip book for that bill board? i got all my pick ups animated by a paper flipbook and now i can’t seems to get them to works as bill boards.