Official Everybody Edits Forums

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.

#1 2015-11-29 08:38:38, last edited by Tako (2015-11-29 08:48:06)

Tako
Member
From: Memphis, Tennessee, USA
Joined: 2015-08-10
Posts: 6,663
Website

[Concept] [Algorithm] MS Spraypaint

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

Wooted by:
Tako1448782718562495

Board footer

Powered by FluxBB

[ Started around 1713869579.8118 - Generated in 0.021 seconds, 10 queries executed - Memory usage: 1.34 MiB (Peak: 1.4 MiB) ]