Results 1 to 9 of 9

Thread: [Smily Entry 2] - NodeDraw 2

  1. #1

    [Smily Entry 2] - NodeDraw 2

    Here's the second version of NodeDraw. You can draw now (as I said in NodeDraw 1) using SHIFT. The little thumbnail on the top left indicates what will be visible and connected. I suggest you don't draw much on it, as every white pixel is treated as a node and will be connected to other white pixels. When you are finished with the drawing, press SPACE and wait for a few seconds/minutes. The time that takes it to process GREATLY depends on the amount of white pixels. Refresh to make a new one and you would probably need to click in it once, to gain focus.

    WARNING: This flash file is EXTREMELY cpu heavy. I'm not taking the responsibility of your computer crashing/freezing. It's even more heavy on the cpu than the last one, so please, use with care.

    ActionScript Code:
    var bitmap:flash.display.BitmapData = new flash.display.BitmapData(800, 600, true, 0x000000);
    var grid:flash.display.BitmapData = new flash.display.BitmapData(40, 30, false, 0x000000);
    var b:MovieClip = _root.createEmptyMovieClip("b", _root.getNextHighestDepth());
    var c:MovieClip = _root.createEmptyMovieClip("c", _root.getNextHighestDepth());
    var l:MovieClip = c.createEmptyMovieClip("l", c.getNextHighestDepth());
    b.attachBitmap(bitmap, b.getNextHighestDepth());
    var b:MovieClip = _root.createEmptyMovieClip("t", _root.getNextHighestDepth());
    t.attachBitmap(grid, t.getNextHighestDepth());
    var iy = 0;
    getInt = setInterval(getInfo, 1);
    function drawOne() {
    for (var ix = 0; ix<grid.width; ix++) {
    for (var i = 0; i<grid.width*grid.height; i++) {
    var cond = ((grid.getPixel(Math.floor(i%grid.width), Math.floor(i/grid.width)) == 0xFFFFFF) && (grid.getPixel(ix, iy) == 0xFFFFFF)) ? c.l.clear() : 1;
    cond = cond == 1 ? 1 : c.l.lineStyle(1, 0xFFFFFF*i/(grid.width*grid.height), 40/Math.sqrt(Math.pow(Math.floor(i%grid.width)-ix, 2)+Math.pow(Math.floor(i/grid.width)-iy, 2)));
    cond = cond == 1 ? 1 : c.l.moveTo(Math.floor(i%grid.width)*20, Math.floor(i/grid.width)*20);
    cond = cond == 1 ? 1 : c.l.lineTo(ix*20, iy*20);
    cond = cond == 1 ? 1 : bitmap.draw(c);
    }
    }
    iy++;
    if (iy>grid.height) {
    clearInterval(drawInt);
    }
    }
    function getInfo() {
    var cond = Key.isDown(Key.SHIFT) ? grid.setPixel(Math.floor(_root._xmouse/20), Math.floor(_root._ymouse/20), 0xFFFFFF) : null;
    cond = Key.isDown(Key.SPACE) ? "Run it!" : null;
    cond == "Run it!" ? clearInterval(getInt) : "Run it!";
    cond == "Run it!" ? drawInt=setInterval(drawOne, 1) : null;
    }
    Mouse.addListener(ml);



    Enjoy
    Attached Files Attached Files

  2. #2
    that's great!

  3. #3
    I don't see anything…


    K-Emmys-06: Best Footer; and K-Emmys-06: Most Active Member

  4. #4
    lol.... read the instructions


    member #1 of the "XML-is-a-crutch-to-make-people-feel-elite-club"
    K-Emmys-06: Best Quote K-Emmys-06: Flash Genious

  5. #5
    Err… it still doesn't work.


    K-Emmys-06: Best Footer; and K-Emmys-06: Most Active Member

  6. #6
    Why is it so slow? Lol...

    For those who it's not working for, hold shift, draw some lines, then press space... then wait like 30 seconds... haha
    I created Trainyard and now I'm making more awful games.

  7. #7
    Ha. It works fine on this machine. I was on my dad's notebook earlier.


    K-Emmys-06: Best Footer; and K-Emmys-06: Most Active Member

  8. #8
    ery intensive, but the effect is super sweet!!! i love this entry! but the drawing came out after, like, 10 seconds...

  9. #9
    Thanks for comments! The slow speed is partly because of compressed code and partly because it loops through all-the-pixels^2 because it has to compare each white pixel with each other white pixel.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012