Someone to help to improve my puzzle script???? Team wanted!!!!

2 posts

Flag Post

ok here is part of my script, i need to improve how to stop the pieces going out of the screen and to speed up my rotation script… for start this a very complicated script to do… the reason is because a friend from college help me to do it, with a start script teached by a proffessor, it take us a lot of job to finish the script to make the pieces join with style and the rotation, but off course we have a lot of bugs, and my friend “Trhinithus” for it get famous sometime, have a lot of job now and he say to me the better is to share my work and join with someone to improve the script, make motion to it, and give some better effect, intro, loades, graphics etc…. some preview of my script…. if anyone wants to contact me…. post here and then i give you mi mail…

function Gran(con, x0, y0, x1, y1, Norm, rand, h, t) {
	var dx = (x1 - x0);
	var dy = (y1 - y0);
	var xc = (x0 + dx / 2);
	var yc = (y0 + dy / 2);
	var tx;
	var ty;
	var l = Math.sqrt((dx * dx + dy * dy));
	var dlx = h / l * dy / 10;
	var dly = h / l * dx / 10;
	Norm *=  cut;
	with (con) {
		lineTo((xc - dx / 10), (yc - dy / 10));
		switch (t) {
		case 0 :
			ty = yc + Norm * 2.5 * dly;
			if (ty > y0) {
				ty = y0;
			}
			if (ty > y1) {
				ty = y1;
			}
			if (ty < _parent.box_y0) {
				_parent.box_y0 = ty;
			}
			break;
		case 3 :
			tx = xc - Norm * 2.5 * dlx;
			if (tx > x0) {
				tx = x0;
			}
			if (ty > x1) {
				tx = x1;
			}
			if (tx < _parent.box_x0) {
				_parent.box_x0 = tx;
			}
		}
		if (Norm != 0) {
			lineTo(((xc - dx / 10) - rand * Norm * dlx), ((yc - dy / 10) + rand * Norm * dly));
			curveTo(((xc - 0.20000000000000001 * dx) - Norm * 2.5 * dlx), ((yc - 0.20000000000000001 * dy) + Norm * 2.5 * dly), (xc - Norm * 2.5 * dlx), (yc + Norm * 2.5 * dly));
			curveTo(((xc + 0.20000000000000001 * dx) - Norm * 2.5 * dlx), ((yc + 0.20000000000000001 * dy) + Norm * 2.5 * dly), ((xc + dx / 10) - rand * Norm * dlx), ((yc + dy / 10) + rand * Norm * dly));
			lineTo((xc + dx / 10), (yc + dy / 10));
		}
		lineTo(x1, y1);
	}
}
function CreatePieEx(pie) {
	pie.box_x0 = 10000;
	pie.box_y0 = 10000;
	with (pie) {
		maska.clear();
		f_la.clear();
		f_la.lineStyle(2, 268435455, 100);
		f_la._alpha = 100;
		maska.lineStyle(0, 0, 100);
		maska.beginFill(0, 100);
		obvod.clear();
		obvod.lineStyle(0, 0, 100);
		var i = 0;
		while (i < countP) {
			with (s_pie[i]) {
				maska.moveTo(x0, y0);
			

963 lines of script code …. :) hard work….

 
Flag Post

Use a Rectangle Class, getBounds() of your puzzle piece, calculate the centre, set registration point, then use Rotate.

Don’t know why you’ve got things like curveTo and crazy stuff like that. Whooaa.

Well just my view. If I were doing that I’d look in that direction for a start.maybe its not something you want, but hey :)

On a side note, I’m very impressed with how you managed to get the pieces and the shapes. – thumbs up – maybe I’ll figure it out someday.