Hi guys, i had the idea of making a Bloons fangame, based soley on the engineer. The game concept is that all the towers are the engineers sentries, and you play as the engineer on the map itself, and you can run around. One of the main mechanics will be to be able to lift up sentries and move them, or use them yourself as a gun, before being able to place them back down in any spot you want.
Concepts for sentries/towers range from things like a glue sentry, that may have an upgrade path that turns it into a spike factory type tower that lays lots of glue down on the track, or a sniper sentry that can have an ability to automatically target mortars constantly.
The problem here is i would much rather the sentries target the first bloon ahead of all the others instead of the closest bloon. But i have little idea on how i would go about this. I have been able to think of something on the bloon side of things, like adding a distance counter that simply adds however far it moved since the last frame to its track distance count. My only struggle is communicating that to the sentries, espeacially when working with limited distance on sentries.
So this is definitely possible, and might be easiest with a series of Messages.
The basic idea would be to have each bloon count its distance like you said, then have each sentry go through and check if the furthest bloon is in range, and if not then the next furthest, and if not then the next next furthest, etc. until either they find a bloon in range or they run out of bloons. There would have to be a central brain object that could use Messages or a Global to run through the bloons in order and make sure they send out their info to the sentries.
If that doesn’t make sense I can try making an example of this as well.
this is great and i see it works in the test thing you made but im having some slight trouble implementing it, (you willl be credited) im working on recording the problem, but the range seems to be inconsistant
Ah, that looks like you have to increase the Emit’s expire time, otherwise the bullets will go away before hitting anything. As well you probably want to increase the Emit’s force value.
Also make sure your game’s drag setting is turned to 0.
Oh and it looks like you changed the range to 20 for some reason? That’s really tiny… I’d recommend at least 100.
Oh, yeah I think I know what’s going on, do you have a link to your game? I think it may be an issue with how the code got pasted
You can dm it to me if you want to keep the game private
Oh wait, you accidentally have the brain object sending the vGet message to the “bloon” object instead of the “bloon parent” object
I think it should work if you set that vGet message to send to the “bloon parent” type
Ok also try directly modifying A in the expression that controls the towers’ range (click the expression and type in A to be 100). Currently the 100 value is failing to send before the squared value actually is computed
Yeah, I’m still looking for the issue…I have a feeling it may be something to do with how you are moving the bloons. The +X and +Y inputs on the Position behavior tend to create really strange and buggy results, so I would recommend just using a separate Number for X and Y and then using the + input on those, and then having them set the position directly
Ok I finally found it. In the Dist^2 Expression (inside the bloon object) I messed up in the original code so that it reused the x distance instead of the y. The expression should be this: Math.pow((B-A),2)+Math.pow((D-C),2)
Sorry about that