View Full Version : How do i set up and create classes?
Sirisian
April 5th, 2005, 02:34 PM
does anyone know the format for setting up classes in AS? Also I was wondering if anyone knows if there is "type." A type in some programming languages is exactly like a class but its much easier to call into a program. Okay right now I just need to find out the format for classes so thx in advance.
senocular
April 5th, 2005, 02:47 PM
depends on your version of Flash.
See:
http://www.kirupa.com/developer/oop/index.htm (AS 1, Flash MX)
and
http://www.kirupa.com/developer/oop2/AS2OOPindex.htm (AS 2, Flash MX 2004)
Sirisian
April 5th, 2005, 03:32 PM
ok I figured out ok here's another thing. I have about 150 bullets at a time and about 100 walls which they can hittest. I have the bullets on precision hittest with my own httest function. Picture this every bullet for every pixel they move they check if they hit wall1 then wall2 ect. This happens for every bullet every pixel they move so If i used a class to hold the x,y , width, and height values of walls instead of getting the values of mc from the mc would that speed up the proccess. Idealy I'm referencing a set of variables from a large set of variables to speed up the time it would take for the bullets to test a httest for a wall. So instead of seeing if the bullets x and y are close to a wall it will test if the bullets x and y are within the classes same set of variables. Does this make sense?look here u'll understand
http://www.kirupa.com/forum/showthread.php?p=791380#post791380
Sirisian
April 5th, 2005, 03:46 PM
does this work? whats wrong
class cwall {
var x:Number = 0
var y:Number = 0
var width:Number = 0
var height:Number = 0
function cwall(vx:Number,vy:Number,vwidth:Number,vheight:Nu mber){
x=vx
y=vy
width=vwidth
height=vheight
}
}
Sirisian
April 5th, 2005, 03:47 PM
does flash mx use AS 2.0 or AS 1.0?
Sirisian
April 5th, 2005, 04:01 PM
ok just read up now i understand
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.