At 7/13/09 05:56 AM, Vexagon wrote:
At 7/12/09 07:33 PM, knugen wrote:
You basically copied his code, but made it less dynamic. Stop being so obsessed with line count, read the two posts above your last one.
Yeah I know it doesn't run faster, I just prefer my codes to be as compact as possible. !keep the script scrollbar as big as possible!
Less lines with little or none impact on efficiency is always preferred, but making it your primary goal to produce code with as few lines as possible will you do you more harm than good.
Anyway, What the f*ck makes you think I copied his code?
Let's see..
var Player:Sprite = new Sprite();
Player.graphics.lineStyle(3, 0x000000, 1);
Player.graphics.beginFill(0x0066FF, 1);
Player.graphics.moveTo(15, 0);
for (var Rad:int = 0; Rad < 360; Rad++) Player.graphics.lineTo(15 * Math.cos(Rad / 57.2), 15 * Math.sin(Rad / 57.2));
Player.graphics.endFill();
addChild(Player);
Player.x = 275;
Player.y = 200;
Became:
var Vexagon:Sprite=new Sprite();
Vexagon.graphics.lineStyle (3,0x000000,100);
Vexagon.graphics.beginFill (0x0066FF,100);
Vexagon.graphics.moveTo (10,0);
for (var gr:int=0; gr<=360; gr+=60) {
Vexagon.graphics.lineTo (10*Math.cos(gr/57.2),10*Math.sin(gr/57.2));
}
addChild (Vexagon);
Vexagon.x=500;
Vexagon.y=250;
---
var UP:Boolean = false;
var DOWN:Boolean = false;
var LEFT:Boolean = false;
var RIGHT:Boolean = false;
Became:
var MovingLeft:Boolean=false;
var MovingRight:Boolean=false;
var MovingUp:Boolean=false;
var MovingDown:Boolean=false;
---
function KeyDown(e:KeyboardEvent):void {
switch (e.keyCode) {
case 38: UP = true; break;
case 40: DOWN = true; break;
case 37: LEFT = true; break;
case 39: RIGHT = true; break;
}
}
function KeyUp(e:KeyboardEvent):void {
switch (e.keyCode) {
case 38: UP = false; break;
case 40: DOWN = false; break;
case 37: LEFT = false; break;
case 39: RIGHT = false; break;
}
}
Became:
function IsMoving (e:KeyboardEvent):void {
switch (e.keyCode) {
case 65 :
MovingLeft=true;
break;
case 68 :
MovingRight=true;
break;
case 87 :
MovingUp=true;
break;
case 83 :
MovingDown=true;
}
}
function IsNotMoving (e:KeyboardEvent):void {
switch (e.keyCode) {
case 65 :
MovingLeft=false;
break;
case 68 :
MovingRight=false;
break;
case 87 :
MovingUp=false;
break;
case 83 :
MovingDown=false;
}
}
With your line count obsession you can probably calculate how much of "your" code is pretty much exactly like the one given to you above, my guess would be 60-70%. Case closed?
1. Would I learn to use AS3.0 by copying codes?
Probably not?
2. My structure is different, I made it look like my own old code.
The structure is basically the same, only slightly n00bified.
3. And I found out how you can make something follow your mouse, I could never have discovered how if I really copied that code.
I said that you basically copied it, that's pretty much fact (see above). You added a few lines of your own code and changed a couple of names for functions and variables, that does still fall under the "basically copied" description, don't you think? Also note that I never said you can't code for yourself, I only point out the obvious.