Results 1 to 9 of 9
Thread: [Smily Entry 2] - NodeDraw 2
-
January 28th, 2006, 06:58 PM #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
-
January 28th, 2006, 08:30 PM #2
that's great!

"HEY!"
"YEAH!"
"WHAT?!"
"OKAY!"
"LET'S GO..." - Lil Jon.
-
January 28th, 2006, 08:45 PM #3
-
January 28th, 2006, 08:46 PM #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
-
January 28th, 2006, 08:48 PM #5
-
January 29th, 2006, 01:35 AM #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... hahaI created Trainyard and now I'm making more awful games.
-
January 29th, 2006, 02:19 AM #7
-
January 29th, 2006, 04:39 AM #86,170iAm t3h hybrid
postsery intensive, but the effect is super sweet!!! i love this entry! but the drawing came out after, like, 10 seconds...
-
January 29th, 2006, 05:14 AM #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.
Similar Threads
-
[Smily Entry 1] - NodeDraw 1
By Smily in forum 25 Line AS ContestReplies: 13Last Post: February 28th, 2008, 06:00 AM -
[DBarbarian Entry 5] - Particle Clock
By dbarbarian in forum 25 Line AS ContestReplies: 47Last Post: January 25th, 2007, 12:35 AM -
treatkor's entry
By treatkor in forum Footer Contest #2Replies: 14Last Post: July 6th, 2005, 03:57 PM -
Entry #1 Colombianking
By colombianking in forum Footer Contest #2Replies: 15Last Post: July 6th, 2005, 03:20 PM -
entry no.1
By farsite in forum Footer Contest #2Replies: 9Last Post: July 4th, 2005, 04:18 PM

Reply With Quote



Bookmarks