I’m trying to make it so a “darkness” block changes its alpha when i have my “beam” block hit it. The problem is that the “beam” doesnt interact with the darkness block when i have it spawn infront of the player with the attacher. But when i just place it in the world it behaves like normal. Am i missing something here?
I dont think attachers have collisions turned on… Im sorry, I had this problem too when trying to make a sword
But what I’m thinking of when you say “darkness and beam” is that the beam is cutting through the darkness, so a attachment may not be the best way to do that anyways, you could just emit it and set the beams velocity to 4 or something like that…
Attached objects do not have any collisions…
There‘s many workarounds, you can try what hong said and see if it worked. If not, you can provide a link if you want and im certain we‘re going to find a way to solve your problem
I’ll try using the emit and tell you how it goes
https://flowlab.io/game/play/2213402 This is the game, I couldn’t get the beam to follow the player with emit so I removed it. Thanks in advance for anyone willing to help
I know something but let’s wait for some og members to give you a clean code
@CodeAlpaca can you tell us what you think, please. Then i can compare my solution to it
You can do a few different things
Emit an object. It’s not as clean of a solution, so I’d recommend the other options.
Spawn an object. This object would be set to the X and Y chord of the player (with an offset). This would work the exact same as an attacker except with collisions (but make sure it’s not solid)
Ray Casts. You can ray cast for the object you’re looking for, then send a message set to “Send to last ray cast”. Depending on how the game is set up, there is a chance this could lower performance, but it’s probably fine.
raycasts lower performance?
Yeah if you have a bunch of raycasts and proximities it can lower the performance of a game
Yes, depending on how the game is.
If you have 1 ray cast searching for the Ground, but there are 2000 ground objects, that will lower performance.
If you have 3 ray casts searching for 20 objects, that’s not really going to do much.
Distance also matters.
I don’t know the exact specifics on it, so if you want to know more about how it effects performance you could ask grazer.
As an example, in Beyond the Glass we were using 3 raycasts for a ground check, but there were ~12k ground objects. So it lowered it to 15-20 fps. When I removed the rays and used a different method it jumped up to 60 fps.
And just as a reminder, only run code when it’s needed.
hmmmm, so can you check if my game The last one left’s grass does anything? I have like 10 raycasts on it
Sure, can you link it?
I ran out of screen time and am using my Chromebook(blocked) but you kind find it on the Post-Flowjam booster(free indie) Post by BradenS, it should be in the latest
It says ray casts take up the most (~10ms), but performance was ~55 fps for me, so I think it’s good.
I managed to use a different solution all together and just made the darkness with a vignette in the user interface layer. Which somehow made me discover yet ANOTHER problem. That being that the vignette’s center only follows the player to a certain point and then goes past the player…
The vignette is in the “inside” level
@CodeAlpaca You wouldn’t happen to know how to fix this by any chance?
well, you could make the camera on the player infinite, but put invisible borders one where the player could go