# The AS Battle Game

**URL:** <https://forum.kirupa.com/t/the-as-battle-game/33453>\
**Category:** Uncategorized\
**Created:** [October 19, 2003, 7:01pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453 "2003-10-19T19:01:21Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![denacioust](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@denacioust](https://forum.kirupa.com/u/denacioust)\
**Post date:** [October 19, 2003, 7:01pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/1 "2003-10-19T19:01:21Z")

</div>

In this battle/game you post something and then someone works out the AS for that effect okay they then post what they want the others to work out.

First challenge: Work out how to throw something and make them land back on the ground again. like in defen your castle (BTW I already know how to do this but I want yous to give it a go)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 19, 2003, 7:58pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/2 "2003-10-19T19:58:09Z")

</div>

does it have to be reflected from anywher, does it have to fly in x and y direction, or simply accellerate the ball with your cursor and make it come with gravity? AS only or predrawn flash allowed?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 19, 2003, 8:07pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/3 "2003-10-19T20:07:11Z")

</div>

```auto
ground_pos = 300 ;

this.createEmptyMovieClip("canon", -50) ;
canon.lineStyle(1, 0, 100) ;
canon.beginFill(0, 100) ;
canon.lineTo(50, 0) ;
canon.lineTo(50, 50) ;
canon.lineTo(0, 50) ;
canon.endFill() ;
canon._y = ground_pos - 50 ;

this.createEmptyMovieClip("projectile", -49)._visible = 0 ;
projectile.lineStyle(10, 0, 100) ;
projectile.lineTo(.45, .15) ;

gravity = 2 ;
function throwProjectile () {
	var dx = _xmouse - start_x ;
	var dy = _ymouse - start_y ;
	var force = Math.sqrt (dx*dx+dy*dy) ;
	var angle = Math.atan2 (dy, dx) ;
	dep ++ ;
	var mc = projectile.duplicateMovieClip ("p"+dep, dep) ;
	mc._x = canon._x ;
	mc._y = canon._y ;
	mc.vx = -dx / 3 ;
	mc.vy = -dy / 3 ;

	mc.onEnterFrame = function () {
		this._x += this.vx ;
		this._y += this.vy ;
trace(this.vy); this.vy += gravity ;
		if (this._y > ground_pos) {
			this._y = ground_pos ;
			delete this.onEnterFrame ;
		}
	}
}
canon.onPress = function () {
	start_x = _xmouse ;
	start_y = _ymouse ;
}
canon.onRelease = canon.onReleaseOutside = throwProjectile ;

```

Click the canon, and release.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 19, 2003, 8:08pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/4 "2003-10-19T20:08:55Z")

</div>

OK, so I want the next one to set up a target that you have to reach, horizontal or vertical, with an accurate collision test if possible 🙂

And I want planes to fly over, dropping bombs occasionally, , and people running on the ground, and… :trout:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 19, 2003, 9:03pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/5 "2003-10-19T21:03:01Z")

</div>

@dencioust: was that what you intended?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 20, 2003, 10:56am UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/6 "2003-10-20T10:56:35Z")

</div>

Yeah, I wasn’t too sure either, I don’t know that ‘Defend your castle’ thing :-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 20, 2003, 2:05pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/7 "2003-10-20T14:05:38Z")

</div>

hey, this sounds like fun. I’m in.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 20, 2003, 6:24pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/8 "2003-10-20T18:24:17Z")

</div>

ouch! (to myself:"…remember: always google first if you find something you don’t know…")

I guess he meant that  
[http://www.ebaumsworld.com/castle.html](http://www.ebaumsworld.com/castle.html)

(anyway I guessed something like that before (only the castle thing was irritating)  
@pom: you’d better be fast now!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 20, 2003, 7:11pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/9 "2003-10-20T19:11:44Z")

</div>

I felt free to add some features like boucing  
[AS]yarray = [];  
xarray = [];  
createEmptyMovieClip(“ball”, 100);  
\_root.ball.lineStyle(40,0, 100);  
\_root.ball.moveTo(19.5, -20);  
\_root.ball.lineTo(20.5, -20);  
\_root.ball.\_x = 255;  
createEmptyMovieClip(“earth”, 50);  
earth.lineStyle(1, 0x009900, 100);  
earth.lineTo(800, 0);  
earth.lineTo(800, -1000);  
earth.moveTo(0, 0);  
earth.lineTo(0, -1000);  
earth.\_y = 600;  
\_root.ball.onPress = function() {  
\_root.ball.startDrag(false, 0, -1000, 800-\_root.ball.\_width/2, earth.\_y);  
drag = true;  
};  
\_root.ball.onRelease = \_root.ball.onReleaseOutside=function () {  
\_root.ball.stopDrag();  
drag = false;  
};  
\_root.onEnterFrame = function() {  
if (drag != true) {  
yarray = [\_root.ball.\_y];  
xarray = [\_root.ball.\_x];  
\_root.ball.\_y += \_root.ball.vy;  
\_root.ball.\_x += \_root.ball.vx;  
\_root.ball.vy = (\_root.ball.vy_49)/50+1;  
\_root.ball.vx = (\_root.ball.vx_49)/50;  
if (\_root.ball.\_y\>earth.\_y) {  
\_root.ball.\_y = earth.\_y;  
\_root.ball.vy = -Math.floor(\_root.ball.vy/3)  
\_root.ball.vx=\_root.ball.vx_9/10  
}  
if (\_root.ball.\_x\>\_root.earth.\_width-\_root.ball.\_width/2) {  
\_root.ball.\_x = \_root.earth.\_width-\_root.ball.\_width/2;  
\_root.ball.vx = -Math.floor(\_root.ball.vx/3)  
\_root.ball.vy=\_root.ball.vy_9/10  
}  
if (\_root.ball.\_x\<0) {  
\_root.ball.\_x = 0;  
\_root.ball.vx = -Math.floor(\_root.ball.vx/3)  
\_root.ball.vy=\_root.ball.vy\*9/10  
}  
}  
};  
\_root.onMouseMove = function() {  
if (drag == true) {  
xarray.unshift(\_root.ball.\_x);  
yarray.unshift(\_root.ball.\_y);  
if (xarray.length\>3) {  
xarray.splice(3, xarray.length-3);  
yarray.splice(3, yarray.length-3);  
}  
\_root.ball.vx = (xarray[0]-xarray[2])/3;  
\_root.ball.vy = (yarray[0]-yarray[2])/3;  
}  
};[/AS]

😃 too late pom

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 20, 2003, 7:34pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/10 "2003-10-20T19:34:30Z")

</div>

I think bit101 is always a good inspiration for things you want others to do :azn:  
try redo the privot point thing  
[http://www.bit-101.com/lab.html](http://www.bit-101.com/lab.html)  
**11. oktober 02**

@pom: asking bit is NOT allowed!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 21, 2003, 8:36am UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/11 "2003-10-21T08:36:56Z")

</div>

That’s not what I had in mind… All right! 😃

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 21, 2003, 11:43am UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/12 "2003-10-21T11:43:59Z")

</div>

confused me too. 😃

btw: how about a new rule:  
if no one get’s one fitting to the demanded task, the person who set up the task has to offer an own one, within 2 days.  
If he is abled to do that, he earns one point.  
after that anyone availible dan take over and set up a new task.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 21, 2003, 5:08pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/13 "2003-10-21T17:08:46Z")

</div>

Played around with pom’s code a bit …

```auto

walls = [];
gravity = 2;
bulletsize = 10;
wallStickyNess = 1.7;
ground = {x:350, y:300};
bounce = gravity-(gravity/9);
MovieClip.prototype.makeCannon = function(sze, x) {
	with (this) {
		lineStyle(1, 0, 100);
		moveTo(-sze, -sze);
		beginFill(0, 100);
		lineTo(sze, -sze);
		lineTo(sze, sze);
		lineTo(-sze, sze);
		lineTo(-sze, -sze);
		endFill();
		_x = x;
		_y = ground.y-sze+bulletsize/2;
	}
};
MovieClip.prototype.makeBullet = function() {
	with (this) {
		_visible = 0;
		lineStyle(bulletsize, 0, 100);
		lineTo(.45, .15);
	}
};
MovieClip.prototype.makeWall = function(w, h, x, y) {
	walls.push(this);
	with (this) {
		lineStyle(0, 0, 100);
		moveTo(-w/2, -h/2);
		beginFill(0, 100);
		lineTo(w/2, -h/2);
		lineTo(w/2, h/2);
		lineTo(-w/2, h/2);
		lineTo(-w/2, -h/2);
		endFill();
		_x=x, _y=y;
	}
};
this.createEmptyMovieClip("canon", -50).makeCannon(25, ground.x);
this.createEmptyMovieClip("leftWall", -49).makeWall(10, 50, ground.x-200, ground.y-200);
this.createEmptyMovieClip("rightWall", -48).makeWall(10, 50, ground.x+200, ground.y-200);
this.createEmptyMovieClip("projectile", -47).makeBullet();
function throwProjectile() {
	dep++;
	var dx = _xmouse-start_x;
	var dy = _ymouse-start_y;
	var force = Math.sqrt(dx*dx+dy*dy);
	var angle = Math.atan2(dy, dx);
	var mc = projectile.duplicateMovieClip("p"+dep, dep);
	mc._x = canon._x;
	mc._y = canon._y;
	mc.xi = 3;
	mc.yi = 3;
	mc.vx = -dx/mc.xi;
	mc.vy = -dy/mc.yi;
	mc.hazHitWall = 0;
	mc.onEnterFrame = function() {
		this._x += this.vx;
		this._y += this.vy;
		this.vy += gravity;
		for (all in walls) {
			if (this.hitTest(walls[all])) {
				this.xi *= wallStickyNess;
				this.hazHitWall = 1;
				walls[all]._x>kanon._x ? this.vx=dx/this.xi : this.vx=-dx/this.xi;
			}
		}
		if (this._y>ground.y) {
			this.yi *= bounce;
			this.xi *= bounce;
			this._y = ground.y;
			this.vy = -dy/this.yi;
			this.hazHitWall ? this.vx=dx/this.xi : this.vx=-dx/this.xi;
			if (this.vy>-1) {
				delete this.onEnterFrame;
			}
		}
	};
}
canon.onPress = function() {
	start_x = _xmouse;
	start_y = _ymouse;
};
canon.onRelease = canon.onReleaseOutside=throwProjectile;

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 21, 2003, 5:57pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/14 "2003-10-21T17:57:32Z")

</div>

Hehe, I used hazHitWall (z is a s), but it got filtered … I’ll change it to hazHitWall.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 23, 2003, 1:17pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/15 "2003-10-23T13:17:47Z")

</div>

is there no one abled to do it, or just no one willing to do it?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 23, 2003, 6:39pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/16 "2003-10-23T18:39:05Z")

</div>

I am in too 😃

but… who had the last turn??? Voetsjoeba?

did he meet pom turms?  
Voetsjoeba: then say the next challenge 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 23, 2003, 7:10pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/17 "2003-10-23T19:10:13Z")

</div>

well, i just anounced myself to be the winner 😉  
(denacioust didn’t say anything more, Pom’s was a nice one, but he misunderstood the task (I did so too, until I found the game dena referred to) and Voetsjoeba’s was a change of Pom’s with some pinball elements added)

so if nobody else claims to be the winner 😉 , I do 😛

the task:  
try redo the privot point thing  
[http://www.bit-101.com/lab.html](http://www.bit-101.com/lab.html)  
11. oktober 02

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 24, 2003, 7:40pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/18 "2003-10-24T19:40:39Z")

</div>

Well I can’t test your codes coz I’m working on Flash 5.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 24, 2003, 8:14pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/19 "2003-10-24T20:14:53Z")

</div>

no problem, I swfed them, uploaded them and here are the links:  
[http://www.digitalhalo.de/kirupa/asbattlegame/Pom.swf](http://www.digitalhalo.de/kirupa/asbattlegame/Pom.swf)  
[http://www.digitalhalo.de/kirupa/asbattlegame/mine.swf](http://www.digitalhalo.de/kirupa/asbattlegame/mine.swf)  
[http://www.digitalhalo.de/kirupa/asbattlegame/Voetsjoeba.swf](http://www.digitalhalo.de/kirupa/asbattlegame/Voetsjoeba.swf)

I have hidden a little easteregg in mine

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 24, 2003, 8:36pm UTC](https://forum.kirupa.com/t/the-as-battle-game/33453/20 "2003-10-24T20:36:05Z")

</div>

Although Pom and VoetsJebas were good McGivers was the one I wanted so he wins. Next Go.Easy one. Try figure out how I done my footer

[Next page](https://forum.kirupa.com/t/the-as-battle-game/33453.md?page=2)
