Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Pages: 1
If anyone has their own little program to help them in world development, I thought of a neat way to create the MS Spraypaint tool in EE. It can also be generalized for any other tool that takes time to complete, maybe something that cycles through different shades.
Anyway, here's the algorithm in pseudocode:
Spraying = false;
SprayMode = true;
void Main
Start a thread that runs Spray(int, int, int, int) in the background.
void OnBuild ( Block b )
if (b.Id == TriggerId && b.Point == TriggerPoint && SprayMode) // If the block triggers. TriggerId is any block ID that triggers the spray mode. TriggerPoint is the center of the circle.
Spraying = True
Delete(b) // Remove the block they just built
Wait 1 second
if (Block at (b.X, b.Y)'s ID is NOT the same as b's ID)
Spraying = False
// Now, if they are holding down the left clicker, the block will be immediately replaced, and this will repeat.
void Spray( int x, int y, int radius, int id )
while Spraying AND SprayMode
Build a random block within the circle whose center is (x, y) and radius is "radius".
// Math break:
// You can find a random point within a circle by choosing a random X between negative("radius") and "radius".
// Plug it in to the equation for a circle solved for y.
// The result will always be positive, so 50% of the time you should switch it to negative so that the entire circle gets filled.
So in this algorithm, the user holds left click on a tile, and the bot will randomly filly up the area around that square until you release left click. It knows when you stop holding left click by repeatedly deleting the block you place and then checking if the exact same block is still there after 1 second.
Note: You would need to remember some variables for the center, the radius, and the Block ID, so it doesn't assume every block event means spraypaint.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
Pages: 1
[ Started around 1739705182.8177 - Generated in 0.033 seconds, 12 queries executed - Memory usage: 1.34 MiB (Peak: 1.41 MiB) ]