USERNAME:
PASSWORD:
Save Info!
Logging in…
This topic is 1 page long.
[ Profile | Posts | Contact ]
Posted at: 11/3/09 10:31 PM
Sign-Up: 10/13/07
Posts: 276
To represent vectors in AS3, is it anything like this? v={ p0:{x:10, y:5}, vx:2, vy:1 };
BOOM HEADSHOT
Posted at: 11/3/09 10:56 PM
Sign-Up: 10/17/09
Posts: 295
Do you want to draw the vector? Cod here's a good tutorial on how to draw them > Drawing Vectors
Why don't you just make an array? var v:Array = newArray(10, 5, 2, 1);
Posted at: 11/3/09 11:21 PM
No, i understand how to draw lines, thanks anyway. I'd usually use an array but this gives no errors. var v={p0:{x:10, y:5},vx:2,vy:1}; What is it?
Posted at: 11/3/09 11:36 PM
Sign-Up: 08/21/05
Posts: 2,374
At 11/3/09 11:21 PM, kizza0 wrote: No, i understand how to draw lines, thanks anyway. I'd usually use an array but this gives no errors. var v={p0:{x:10, y:5},vx:2,vy:1}; What is it?
It's just an object with an object and two variables attached.
AS:Main
Posted at: 11/3/09 11:39 PM
At 11/3/09 11:36 PM, Fion wrote: At 11/3/09 11:21 PM, kizza0 wrote: No, i understand how to draw lines, thanks anyway. I'd usually use an array but this gives no errors. var v={p0:{x:10, y:5},vx:2,vy:1}; What is it?It's just an object with an object and two variables attached.
How would you locate those variables? would it be v.p0.x, v.p0.y, v.vx & v.vy?
Posted at: 11/3/09 11:41 PM
At 11/3/09 11:39 PM, CloudEater wrote: How would you locate those variables? would it be v.p0.x, v.p0.y, v.vx & v.vy?
Yeah:
var v ={p0:{x:10, y:5},vx:2,vy:1}; trace(v.p0.x); //outputs 10 trace(v.p0.y); //outputs 5 trace(v.vx); //outputs 2 trace(v.vy); //output 1
Posted at: 11/3/09 11:52 PM
At 11/3/09 11:41 PM, Fion wrote: Yeah
That's good. Would this work in AS2?
Posted at: 11/3/09 11:56 PM
At 11/3/09 11:52 PM, CloudEater wrote: That's good. Would this work in AS2?
Certainly would.
Posted at: 11/4/09 01:35 AM
Sign-Up: 09/10/04
Posts: 3,613
flash.geom.Vector3D, exactly what you wanted, and implemented in native code for that extra speed boost.
Each time someone abuses hittest, God kills a kitten. Please, learn real collision testing.
All times are Eastern Standard Time (GMT -5) | Current Time: 04:26 PM
<< Back