Actionscript Tennis

THIS IS ABSOLUTLEY AWESOME !!!

it is good to see the evolution of it all !! it looks great at the moment keep up the match !

:p: pimp daddy E1kO

umm i dont really see what pom’s 4th volley did… can someone explain what it did?

*Originally posted by Scootman *
**umm i dont really see what pom’s 4th volley did… can someone explain what it did? **

It added the afterburner effect (the flames that come out the back of the ship).

Would any of you be interested in starting another ASTennis match of a more abstract nature?

-Al

Sure Al, go ahead, start the thread :slight_smile:
Oh, and Fla checked out :slight_smile:

thats weird… when i run it i only see part of the ship in the top left corner… and when i move the whole screen moves… no afterburner or anything

oh wait now i see it… i have to maximize the screen to see it though…

yeah, i have to fix my volley sometime. I made it so the movie moves instead of the ship, like a side scroller. I’m going to make the ship move instead.

is that why it stays stuck in the top left corner?

I’m trying to modify this, as a matter of fact, but for some reason, the stars don’t appear at the right place :-\

Only general edits, nothing real new:

StageDim = {width:Stage.width, height:Stage.height}; // Stage Dimensions (renamed by sen 7/15)
/****************
* Volley #6
* Author:	Ilyas
* Date:	08/03
* General edits...
****************/
MovieClip.prototype.move = function () {
	if ( this._x > 0 ) this._x -= this.speed ;
	else {
		this._x = StageDim.width + 20 ;
		this._y = random (StageDim.height);
	}
}
/****************
* Volley #1
* Author:	Ahmed
* Edit:		pom (makeCircle proto) 7/17
* Date:	7/15
****************/
container = []; // contains circles created by createCircle
MovieClip.prototype.makeCircle = function ( size, col, alpha ) {
	this.moveTo ( 0, 0 ) ;
	this.lineStyle ( size, col, alpha ) ;
	this.lineTo ( .45, .15 ) ;
}
this.createEmptyMovieClip("BackgroundLayer", 99)
for(i=0; i<15; i++) {
	clip = BackgroundLayer.createEmptyMovieClip("mc"+i, i);// create an empty clip to contain the circle
	clip.makeCircle (size=10+Math.random()*30, 0xff0000,100); // define random linestyle 
	(new Color (clip)).setTransform ({ga:70+random(30),ba:0,ra:70+random(30)}) ;
	clip._x = Math.random()*StageDim.width ; // position circle based on Stage Dimensions
	clip._y = Math.random()*StageDim.height;
	container.push(clip); // add circle clip to container
	clip.speed = size / 5 ;
}
this.BackgroundLayer.createEmptyMovieClip ( "DeepSpace9", -100 ).beginFill ( 0, 100 ) ;
edges = [{x:0, y:0}, {x:StageDim.width, y:0}, {x:StageDim.width, y:StageDim.height}, {x:0, y:StageDim.height}] ;
for ( var p=0; p < edges.length; p++ )
	this.BackgroundLayer.DeepSpace9[p == 0 ? "moveTo" : "lineTo"](edges[p].x, edges[p].y);
/****************
* Volley #2
* Author:	Senocular
* Date:	7/15
****************/

// create a clip at depth 100 as an "object layer" with more managable
// depths using ObjectLayer.depth++ to prevent overlapping
// in ObjectLayer create a spaceShip clip and define an outline for it
this.createEmptyMovieClip("ObjectLayer", 100).createEmptyMovieClip("spaceShip", ObjectLayer.depth++).outline = [[91,19],[31,-35],[-26,-20],[-76,-45],[-98,-43],[-60,-13],[-77,-4],[-76,9],[-58,15],[-31,15],[-53,47],[-20,43],[34,2],[75,20],[91,19]];
// drawOutlines: draws lines defined by points in an array in a movieclip
// allows optional lineStyle and fillStyle parameters
MovieClip.prototype.drawOutlines = function(points, lStyle, fStyle){
        if (lStyle != undefined) this.lineStyle.apply(this, lStyle); // apply linestyle if passed
        if (fStyle != undefined) this.beginFill.apply(this, fStyle); // apply fillstyle if passed
        for (var i=0; i<points.length; i++){ // cycle through all the points in the array
                if (i) this.lineTo(points*[0],points*[1]); // use a line if not the first point
                else this.moveTo(points*[0],points*[1]);} // otherwise, move to the point if the first
        if (fStyle != undefined) this.endFill(); // end the fill if passed
};
// defines 'ship' in this timeline and draws its outlines with specified line and fill
(ship = ObjectLayer.spaceShip).drawOutlines(ObjectLayer.spaceShip.outline, [2,0,100], [0xbfbfbf,100]);

/****************
* Volley #3
* Author:	thoriphes
* Date:	7/16
****************/

ship.accel = 1.01;
ship.decel = 0.99;
ship.maxvel = 10;
ship.vx = ship.vy = 0;
ship.onEnterFrame = function(){
	this._x += this.vx;
	this._y += this.vy;
	this.vx *= .96 ;
	this.vy *= .96 ;
};
Key.addListener(keyList = new Object());
keyList.onKeyDown = function () {
	ship.vx = Key.isDown(Key.RIGHT) ? ship.vx + (ship.vx <= ship.maxvel ? ship.accel : 0) : Key.isDown(Key.LEFT) ? ship.vx - (ship.vx >= -ship.maxvel ? ship.decel : 0) : ship.vx;
	ship.vy = Key.isDown(Key.DOWN) ? ship.vy + (ship.vy <= ship.maxvel ? ship.accel : 0) : Key.isDown(Key.UP) ? ship.vy - (ship.vy >= -ship.maxvel ? ship.decel : 0) : ship.vy;
}

/****************
* Volley #4
* Author:	pom
* Date:	7/17
****************/
afterBurner = ship.createEmptyMovieClip("Afterburner",99); // container clip
col = 0xff0000 ; // base color of the flame
for ( var i = 0; i < 20 ; i++ ) {
	// We make a bunch of small clips that get red little by little
	var clip = afterBurner.createEmptyMovieClip ( "b" + i, i ) ;
	clip.makeCircle ( size = 5 + 10*Math.cos ( a+= .15 ), col += 0x001000, 20 ) ;
	clip.makeCircle ( size + 10, 0xffff00, 10 ) ;
	clip._x = -90 -3 * i ;
	clip._y = 5 ;
}
afterBurner.onEnterFrame = function () {
	// The afterburner is visible only when a key is pressed
	this._visible = Key.isDown(Key.UP) + Key.isDown(Key.DOWN) + Key.isDown(Key.RIGHT) ;
}

/****************
* Volley #5
* Author:	ahmed
* Date:	7/31
* Note:	run at 24 fps
****************/

MovieClip.prototype.repel = function() {
	this.dist = Math.sqrt((this._x-ship._x)*(this._x-ship._x)+(this._y-ship._y)*(this._y-ship._y))
	if (this.dist<=_root.rad) {
		this.force = (_root.rad-this.dist)/30
		this._x = this._x+10*this.force*(this._x-ship._x)/this.dist
		this._y = this._y+10*this.force*(this._y-ship._y)/this.dist
	}
}
_root.rad = 150
for(i=0; i<container.length; i++) container*.onEnterFrame = function() { 
	this.repel() ;
	this.move () ;
}
//this.onEnterFrame = function (){trace (ship._x);}[/As]

Hoi

is the game still on?

i what to join in too
[SIZE=1]most of the battles are design things [/SIZE]
but this is AS :}

Well, yeah, no problem, the last volley was done yesterday :slight_smile:

ok i will see if i can add some thing :}

Here :}


/****************
* Volley #7
* Author:	Master64
* Date:	8/4
****************/
MovieClip.prototype.fire = function(){
	if(this.count > 100) this.count = 0 ; 
	shot = this._parent.createEmptyMovieClip("shot"+this.count++,this.count+200);
	shot.makeCircle(5,0xff6600,100);
	shot._y = ship._y+19; shot._x = ship._x+91;
	shot.onEnterFrame = function(){this._x += 12}
}
this.onEnterFrame = function () {
	this.interval++;
	if (Key.isDown(Key.SPACE) && this.interval > 7) {ship.fire(); this.interval = 0;}
}

it adds a gun :wink:

NICE! :beam:

thanks but i cheated a bit :beam:

with

shot._y = ship._y+19; shot._x = ship._x+91;

but…:geek:

so how is going to add the nexted piece??

to do my volley i had to edit master64’s volley… is that allowed?

StageDim = {width:Stage.width, height:Stage.height}; // Stage Dimensions (renamed by sen 7/15)
/****************
* Volley #6
* Author:	Ilyas
* Date:	08/03
* General edits...
****************/
MovieClip.prototype.move = function () {
        if ( this._x > 0 ) this._x -= this.speed ;
        else {
                this._x = StageDim.width + 20 ;
                this._y = random (StageDim.height);
        }
}
/****************
* Volley #1
* Author:	Ahmed
* Edit:		pom (makeCircle proto) 7/17
* Date:	7/15
****************/
container = []; // contains circles created by createCircle
MovieClip.prototype.makeCircle = function ( size, col, alpha ) {
        this.moveTo ( 0, 0 ) ;
        this.lineStyle ( size, col, alpha ) ;
        this.lineTo ( .45, .15 ) ;
}
this.createEmptyMovieClip("BackgroundLayer", 99)
for(i=0; i<15; i++) {
        clip = BackgroundLayer.createEmptyMovieClip("mc"+i, i);// create an empty clip to contain the circle
        clip.makeCircle (size=10+Math.random()*30, 0xff0000,100); // define random linestyle
        (new Color (clip)).setTransform ({ga:70+random(30),ba:0,ra:70+random(30)}) ;
        clip._x = Math.random()*StageDim.width ; // position circle based on Stage Dimensions
        clip._y = Math.random()*StageDim.height;
        container.push(clip); // add circle clip to container
        clip.speed = size / 5 ;
}
this.BackgroundLayer.createEmptyMovieClip ( "DeepSpace9", -100 ).beginFill ( 0, 100 ) ;
edges = [{x:0, y:0}, {x:StageDim.width, y:0}, {x:StageDim.width, y:StageDim.height}, {x:0, y:StageDim.height}] ;
for ( var p=0; p < edges.length; p++ )
this.BackgroundLayer.DeepSpace9[p == 0 ? "moveTo" : "lineTo"](edges[p].x, edges[p].y);
/****************
* Volley #2
* Author:	Senocular
* Date:	7/15
****************/

// create a clip at depth 100 as an "object layer" with more managable
// depths using ObjectLayer.depth++ to prevent overlapping
// in ObjectLayer create a spaceShip clip and define an outline for it
this.createEmptyMovieClip("ObjectLayer", 100).createEmptyMovieClip("spaceShip", ObjectLayer.depth++).outline = [[91,19],[31,-35],[-26,-20],[-76,-45],[-98,-43],[-60,-13],[-77,-4],[-76,9],[-58,15],[-31,15],[-53,47],[-20,43],[34,2],[75,20],[91,19]];
// drawOutlines: draws lines defined by points in an array in a movieclip
// allows optional lineStyle and fillStyle parameters
MovieClip.prototype.drawOutlines = function(points, lStyle, fStyle){
        if (lStyle != undefined) this.lineStyle.apply(this, lStyle); // apply linestyle if passed
        if (fStyle != undefined) this.beginFill.apply(this, fStyle); // apply fillstyle if passed
        for (var i=0; i<points.length; i++){ // cycle through all the points in the array
                if (i) this.lineTo(points*[0],points*[1]); // use a line if not the first point
                else this.moveTo(points*[0],points*[1]);} // otherwise, move to the point if the first
        if (fStyle != undefined) this.endFill(); // end the fill if passed
};
// defines 'ship' in this timeline and draws its outlines with specified line and fill
(ship = ObjectLayer.spaceShip).drawOutlines(ObjectLayer.spaceShip.outline, [2,0,100], [0xbfbfbf,100]);

/****************
* Volley #3
* Author:	thoriphes
* Date:	7/16
****************/

ship.accel = 1.01;
ship.decel = 0.99;
ship.maxvel = 10;
ship.vx = ship.vy = 0;
ship.onEnterFrame = function(){
        this._x += this.vx;
        this._y += this.vy;
        this.vx *= .96 ;
        this.vy *= .96 ;
};
Key.addListener(keyList = new Object());
keyList.onKeyDown = function () {
        ship.vx = Key.isDown(Key.RIGHT) ? ship.vx + (ship.vx <= ship.maxvel ? ship.accel : 0) : Key.isDown(Key.LEFT) ? ship.vx - (ship.vx >= -ship.maxvel ? ship.decel : 0) : ship.vx;
        ship.vy = Key.isDown(Key.DOWN) ? ship.vy + (ship.vy <= ship.maxvel ? ship.accel : 0) : Key.isDown(Key.UP) ? ship.vy - (ship.vy >= -ship.maxvel ? ship.decel : 0) : ship.vy;
}

/****************
* Volley #4
* Author:	pom
* Date:	7/17
****************/
afterBurner = ship.createEmptyMovieClip("Afterburner",99); // container clip
col = 0xff0000 ; // base color of the flame
for ( var i = 0; i < 20 ; i++ ) {
        // We make a bunch of small clips that get red little by little
        var clip = afterBurner.createEmptyMovieClip ( "b" + i, i ) ;
        clip.makeCircle ( size = 5 + 10*Math.cos ( a+= .15 ), col += 0x001000, 20 ) ;
        clip.makeCircle ( size + 10, 0xffff00, 10 ) ;
        clip._x = -90 -3 * i ;
        clip._y = 5 ;
}
afterBurner.onEnterFrame = function () {
        // The afterburner is visible only when a key is pressed
        this._visible = Key.isDown(Key.UP) + Key.isDown(Key.DOWN) + Key.isDown(Key.RIGHT) ;
}

/****************
* Volley #5
* Author:	ahmed
* Date:	7/31
* Note:	run at 24 fps
****************/

MovieClip.prototype.repel = function() {
        this.dist = Math.sqrt((this._x-ship._x)*(this._x-ship._x)+(this._y-ship._y)*(this._y-ship._y))
        if (this.dist<=_root.rad) {
                this.force = (_root.rad-this.dist)/30
                this._x = this._x+10*this.force*(this._x-ship._x)/this.dist
                this._y = this._y+10*this.force*(this._y-ship._y)/this.dist
        }
}
_root.rad = 150
for(i=0; i<container.length; i++) container*.onEnterFrame = function() {
        this.repel() ;
        this.move () ;
}
//this.onEnterFrame = function (){trace (ship._x);}
/****************
* Volley #7
* Author:	Master64
* Edit:	Ahmed on 8/5
* Date:	8/4
****************/
MovieClip.prototype.fire = function(){
	if(this.count > 100) this.count = 0 ; 
	shot = this._parent.createEmptyMovieClip("shot"+this.count++,this.count+200);
	shot.makeCircle(5,0xff6600,100);
	shot._y = ship._y+19; shot._x = ship._x+91;
	shot.onEnterFrame = function(){
		/* begin ahmed's edit */
		// loop through all 'starships' and hitTest them
		for(var i=0; i<container.length; i++) {
			if (this.hitTest(container*)) {
				// if bullet hits a starship, delete startship, bullet, and reference in array 
				container*.removeMovieClip(); 
				container* = null; 
				this.removeMovieClip();
		}
		}
		/* end ahmed's edit */
		this._x += 12
		}
}
this.onEnterFrame = function () {
	this.interval++;
	if (Key.isDown(Key.SPACE) && this.interval > 7) {ship.fire(); this.interval = 0;}
}

fine :wink:

Editing a volley is absolutely fine, of course! :slight_smile:

And Master64, if I may say, it would be better not to use the _root.onEnterFrame :b:

ok i will make new MC with the onEnterFrame and so not getting in the way :wink:


StageDim = {width:Stage.width, height:Stage.height}; // Stage Dimensions (renamed by sen 7/15)
/****************
* Volley #6
* Author:	Ilyas
* Date:	08/03
* General edits...
****************/
MovieClip.prototype.move = function () {
        if ( this._x > 0 ) this._x -= this.speed ;
        else {
                this._x = StageDim.width + 20 ;
                this._y = random (StageDim.height);
        }
}
/****************
* Volley #1
* Author:	Ahmed
* Edit:		pom (makeCircle proto) 7/17
* Date:	7/15
****************/
container = []; // contains circles created by createCircle
MovieClip.prototype.makeCircle = function ( size, col, alpha ) {
        this.moveTo ( 0, 0 ) ;
        this.lineStyle ( size, col, alpha ) ;
        this.lineTo ( .45, .15 ) ;
}
this.createEmptyMovieClip("BackgroundLayer", 99)
for(i=0; i<15; i++) {
        clip = BackgroundLayer.createEmptyMovieClip("mc"+i, i);// create an empty clip to contain the circle
        clip.makeCircle (size=10+Math.random()*30, 0xff0000,100); // define random linestyle
        (new Color (clip)).setTransform ({ga:70+random(30),ba:0,ra:70+random(30)}) ;
        clip._x = Math.random()*StageDim.width ; // position circle based on Stage Dimensions
        clip._y = Math.random()*StageDim.height;
        container.push(clip); // add circle clip to container
        clip.speed = size / 5 ;
}
this.BackgroundLayer.createEmptyMovieClip ( "DeepSpace9", -100 ).beginFill ( 0, 100 ) ;
edges = [{x:0, y:0}, {x:StageDim.width, y:0}, {x:StageDim.width, y:StageDim.height}, {x:0, y:StageDim.height}] ;
for ( var p=0; p < edges.length; p++ )
this.BackgroundLayer.DeepSpace9[p == 0 ? "moveTo" : "lineTo"](edges[p].x, edges[p].y);
/****************
* Volley #2
* Author:	Senocular
* Date:	7/15
****************/

// create a clip at depth 100 as an "object layer" with more managable
// depths using ObjectLayer.depth++ to prevent overlapping
// in ObjectLayer create a spaceShip clip and define an outline for it
this.createEmptyMovieClip("ObjectLayer", 100).createEmptyMovieClip("spaceShip", ObjectLayer.depth++).outline = [[91,19],[31,-35],[-26,-20],[-76,-45],[-98,-43],[-60,-13],[-77,-4],[-76,9],[-58,15],[-31,15],[-53,47],[-20,43],[34,2],[75,20],[91,19]];
// drawOutlines: draws lines defined by points in an array in a movieclip
// allows optional lineStyle and fillStyle parameters
MovieClip.prototype.drawOutlines = function(points, lStyle, fStyle){
        if (lStyle != undefined) this.lineStyle.apply(this, lStyle); // apply linestyle if passed
        if (fStyle != undefined) this.beginFill.apply(this, fStyle); // apply fillstyle if passed
        for (var i=0; i<points.length; i++){ // cycle through all the points in the array
                if (i) this.lineTo(points*[0],points*[1]); // use a line if not the first point
                else this.moveTo(points*[0],points*[1]);} // otherwise, move to the point if the first
        if (fStyle != undefined) this.endFill(); // end the fill if passed
};
// defines 'ship' in this timeline and draws its outlines with specified line and fill
(ship = ObjectLayer.spaceShip).drawOutlines(ObjectLayer.spaceShip.outline, [2,0,100], [0xbfbfbf,100]);

/****************
* Volley #3
* Author:	thoriphes
* Date:	7/16
****************/

ship.accel = 1.01;
ship.decel = 0.99;
ship.maxvel = 10;
ship.vx = ship.vy = 0;
ship.onEnterFrame = function(){
        this._x += this.vx;
        this._y += this.vy;
        this.vx *= .96 ;
        this.vy *= .96 ;
};
Key.addListener(keyList = new Object());
keyList.onKeyDown = function () {
        ship.vx = Key.isDown(Key.RIGHT) ? ship.vx + (ship.vx <= ship.maxvel ? ship.accel : 0) : Key.isDown(Key.LEFT) ? ship.vx - (ship.vx >= -ship.maxvel ? ship.decel : 0) : ship.vx;
        ship.vy = Key.isDown(Key.DOWN) ? ship.vy + (ship.vy <= ship.maxvel ? ship.accel : 0) : Key.isDown(Key.UP) ? ship.vy - (ship.vy >= -ship.maxvel ? ship.decel : 0) : ship.vy;
}

/****************
* Volley #4
* Author:	pom
* Date:	7/17
****************/
afterBurner = ship.createEmptyMovieClip("Afterburner",99); // container clip
col = 0xff0000 ; // base color of the flame
for ( var i = 0; i < 20 ; i++ ) {
        // We make a bunch of small clips that get red little by little
        var clip = afterBurner.createEmptyMovieClip ( "b" + i, i ) ;
        clip.makeCircle ( size = 5 + 10*Math.cos ( a+= .15 ), col += 0x001000, 20 ) ;
        clip.makeCircle ( size + 10, 0xffff00, 10 ) ;
        clip._x = -90 -3 * i ;
        clip._y = 5 ;
}
afterBurner.onEnterFrame = function () {
        // The afterburner is visible only when a key is pressed
        this._visible = Key.isDown(Key.UP) + Key.isDown(Key.DOWN) + Key.isDown(Key.RIGHT) ;
}

/****************
* Volley #5
* Author:	ahmed
* Date:	7/31
* Note:	run at 24 fps
****************/

MovieClip.prototype.repel = function() {
        this.dist = Math.sqrt((this._x-ship._x)*(this._x-ship._x)+(this._y-ship._y)*(this._y-ship._y))
        if (this.dist<=_root.rad) {
                this.force = (_root.rad-this.dist)/30
                this._x = this._x+10*this.force*(this._x-ship._x)/this.dist
                this._y = this._y+10*this.force*(this._y-ship._y)/this.dist
        }
}
_root.rad = 150
for(i=0; i<container.length; i++) container*.onEnterFrame = function() {
        this.repel() ;
        this.move () ;
}
//this.onEnterFrame = function (){trace (ship._x);}
/****************
* Volley #7
* Author:	Master64
* Edit:	Ahmed on 8/5
* Date:	8/4
****************/
MovieClip.prototype.fire = function(){
        if(this.count > 100) this.count = 0 ;
        shot = this._parent.createEmptyMovieClip("shot"+this.count++,this.count+200);
        shot.makeCircle(5,0xff6600,100);
        shot._y = ship._y+19; shot._x = ship._x+91;
        shot.onEnterFrame = function(){
                /* begin ahmed's edit */
                // loop through all 'starships' and hitTest them
                for(var i=0; i<container.length; i++) {
                        if (this.hitTest(container*)) {
                                // if bullet hits a starship, delete startship, bullet, and reference in array
                                container*.removeMovieClip();
                                container* = null;
                                this.removeMovieClip();
                        }
                }
                /* end ahmed's edit */
                this._x += 12
        }
}
this_mc.createEmptyMovieClip("shotTime",98).onEnterFrame = function () {
this.interval++;
        if (Key.isDown(Key.SPACE) && this.interval > 7) {ship.fire(); this.interval = 0;}
}

there if that is ok :}