tModLoader How to draw a sprite when an item is used

Valdriks

Terrarian
(This is my first post on this site and I'm rather new to "drawing" sprites in tModloader so bear with me)

I'm trying to make a modded magic weapon that makes one of 6 distorted faces briefly appear and then fade away every time it's used.

I should have no trouble making the weapon decide which face to show, but as for making said face appear, I'm not sure what kind of approach I should take. UseItem() and similar methods won't work, because there's no "spritebatch" argument which is required by the only "draw" code that I know of.

Any suggestions or pointers on how to achieve this would be greatly appreciated. Again, I haven't done much sprite drawing before so I wouldn't be surprised if I'm missing some obvious way of doing this.

(I don't think I need to attach any files or code, because the script is just a generic magic weapon and I'm just asking about how to make an effect. Correct me if I'm wrong though)
 
You mean you want the item graphic itself to be different upon use each time? Or is this an additional graphic that appears when the item is used?
 
It's an additional graphic (the weapon itself is a book). I feel like making a new dust for each one (or just one new dust that decides on its own which face to show) might be the right decision, but the faces are fairly larger than most dusts (they're all 28x28), and they're not supposed to move.

As I was writing this, I realized that the 'bubble' dust in ExampleMod is 30x30 and that there is indeed a simple way to make a custom dust not move (just by not making it move in the override Update method).
I'm going to try making new dusts now; I probably didn't need to make this thread in the first place, so my apologies. Thanks anyway for replying!


EDIT: The dust worked perfectly! It was surprisingly easy to make, too, and I was even able to make it decide on its own which sprite to use so I didn't have to make individual dusts. Thanks again for being willing to help—Next time I'll do more research to avoid making an unnecessary thread.
 
Last edited:
Back
Top Bottom