0 votes

Hey gang, im working on the "blood and gore" part of my 2D shooter, but i come to you with a doubt regarding a "How would i do this?" because honestly i have no idea where to start.

Some context first: When you shoot (using raycasts) an enemy (the game is top down 2D, btw) a bunch of things happen, some CPUParticles that spray blood around, some decals on the ground where those particles would "land", a pool of blood forms after a while, etc. but here's the thing regarding the question:

When the raycast hits, it spawns another raycast that "continues" the path of the original one. This new raycast only collides with walls (staticbodies in a certain collision layer) and has a fixed length, if it doesnt hit anything, then nothing happens, BUT if it hits a wall it will leave a "blood splat" decal (Basically just a sprite) there.

My problem is, since this is top down, the bloodsplat sprite would have a "flat side" cutting through the middle of the sprite, and it would need to be rotated to "line up" with the flat side of the wall... How would i do this?

The methods i thought dont work or are too complex, there must be a simple way i dont know about!

Thanks in advance for any help!

EDIT: I just realized i could use like... "regular blood splat" decals and have that graphic only appear "over" walls but "below" everything else. This seems like the simplest solution... I'd still wouldnt know how to do it.

Godot version 3.2.2
in Engine by (304 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.