Be a Supporter!
Response to: Question about Flash Icons. Posted December 16th, 2008 in Game Development

well, if you are using a background, or anything, for that matter, that its alpha is less than 100, it is slightly transparent and it cannot be accepted

Response to: attach moive instance names Posted December 16th, 2008 in Game Development

anybody?!?!?!

Response to: Need Flash Progammer Posted December 16th, 2008 in Game Development

ok, but i am still learning stuff, so it is not going to be me doing script for 4 hours, that 4 hours may include 1/2 hour of learning script.

Response to: whats wrong with this loop Posted December 16th, 2008 in Game Development

This:

for[i=0;i<=_root.gunarylt.length-1;i++){

should be this:

for<strong><em>(</em></strong>i=0;i<=_root.gunarylt.length-1;i++){
Response to: Need Flash Progammer Posted December 16th, 2008 in Game Development

never mind me then!

Response to: attach moive instance names Posted December 16th, 2008 in Game Development

suppose if mc2 was inside of mc1, if I did this script,

attachMovie("mc1","mc1",_root.getNextHighestDepth())

it would copy mc1 and mc2, but give a instance name to mc1 only. How do I give an instance name to mc2 too?
Thanks for any help.

Response to: Need Flash Progammer Posted December 16th, 2008 in Game Development

im kinda interested, i started AS this summer, and have learned alot. I have been doing some tests for my abilities(becuase when i do tests, i learn more than just trying to learn about it) and my latest one is a defense game(no plan to finish).

Response to: First "game" Posted December 16th, 2008 in Game Development

thats not really a game, it hase three options and the clicking of the options has some issues

attach moive instance names Posted December 16th, 2008 in Game Development

so if i had an mc called mc1 and i had a mc inside of mc1 that is called mc2, how would i be able to give orders to both mc1 and mc2 if i attach movie to them. if i just attach mc1, mc2 does not have an instance name so it cannot be talked to.
Help!

Response to: Plz Help I'm A Newbie Posted December 14th, 2008 in Game Development

http://www.newgrounds.com/collection/fla shtutorials.html
every thing you need is on there

Response to: when speed = 2; Posted December 14th, 2008 in Game Development

pixels. it can be changed through modify>document>ruler units

Response to: td22 Posted December 14th, 2008 in Game Development

At 12/14/08 04:32 PM, Jucom wrote: Where have I seen this code...

oh right! on a website, it was a tutorial!

Wow, you cant even make a correct code with a tutorial to follow?

My god, stop using actionscript!

i changed the code form the tut so it could shoot at an interval instead of everytime the previous bullet was removed. i know it is the if statement of the deleting script that is not working, but i don't know how to make it work.

Response to: td22 Posted December 14th, 2008 in Game Development

thanks for the help, here is the code.
added comments to the code, it is now 150 lines:

bc = 1000;
base_range = 300;
clicked = false;
can_be_placed = false;
placed = false;
firing = false;
attachMovie("path", "path", _root.getNextHighestDepth());
attachMovie("cant_build_part1", "cant_build_part1", _root.getNextHighestDepth(), {_x:20, _y:0});
attachMovie("cant_build_part2", "cant_build_part2", _root.getNextHighestDepth(), {_x:20, _y:120});
attachMovie("cant_build_part3", "cant_build_part3", _root.getNextHighestDepth(), {_x:120, _y:80});
attachMovie("cant_build_part4", "cant_build_part4", _root.getNextHighestDepth(), {_x:120, _y:40});
attachMovie("cant_build_part5", "cant_build_part5", _root.getNextHighestDepth(), {_x:200, _y:40});
attachMovie("cant_build_part6", "cant_build_part6", _root.getNextHighestDepth(), {_x:60, _y:220});
attachMovie("cant_build_part7", "cant_build_part7", _root.getNextHighestDepth(), {_x:60, _y:260});
attachMovie("cant_build_part8", "cant_build_part8", _root.getNextHighestDepth(), {_x:100, _y:300});
attachMovie("cant_build_part9", "cant_build_part9", _root.getNextHighestDepth(), {_x:320, _y:80});
attachMovie("cant_build_part10", "cant_build_part10", _root.getNextHighestDepth(), {_x:360, _y:80});
attachMovie("cant_build_part11", "cant_build_part11", _root.getNextHighestDepth(), {_x:400, _y:0});
for (var j:Number = 1; j<12; j++) {
	_root["cant_build_part"+j]._alpha = 0;
}
attachMovie("range", "range", _root.getNextHighestDepth(), {_width:base_range, _height:base_range});
attachMovie("base", "base", _root.getNextHighestDepth());
//array for checkpoint
waypoint_x = new Array(40, 140, 140, 220, 220, 80, 80, 340, 340, 420, 420);
waypoint_y = new Array(140, 140, 60, 60, 240, 240, 320, 320, 100, 100, -20);
delay = 25;
new_monster = 0;
monsters_placed = 0;
onEnterFrame = function () {
	//placing "monsters"
	if (monsters_placed<25) {
		new_monster++;
	}
	if (new_monster == delay) {
		monsters_placed++;
		new_monster = 0;
		min = attachMovie("minion", "minion"+monsters_placed, _root.getNextHighestDepth(), {_x:40, _y:-20});
		min.alive = true;
		min.point_to_reach = 0;
		min.speed = 3;
		min.health = 2;
		min.onEnterFrame = function() {
			//movement for monsters
			dist_x = waypoint_x[this.point_to_reach]-this._x;
			dist_y = waypoint_y[this.point_to_reach]-this._y;
			if ((Math.abs(dist_x)+Math.abs(dist_y))<3) {
				this._x = waypoint_x[this.point_to_reach];
				this._y = waypoint_y[this.point_to_reach];
				this.point_to_reach++;
			}
			angle = Math.atan2(dist_y, dist_x);
			this._x = this._x+this.speed*Math.cos(angle);
			this._y = this._y+this.speed*Math.sin(angle);
			this._rotation = angle/Math.PI*180-90;
			//hitests
			//not working
			for (var i:Number = 1; i<=20; i++) {
				if (_root["bullet"+i].hitTest(this)) {
					trace(1);
				}
			}
			//not working
			if (bullets.hitTest(this)) {
				bullets.removeMovieClip();
				min.health -= 1;
				if (min.health<=0) {
					this.removeMovieClip();
				}
			}
		};
	}
};
//firing
int1 = setInterval(function () {
	if (placed) {
		//get enemy in front of the pack
		for (var i:Number = 1; i<=monsters_placed; i++) {
			if (_root["minion"+i].alive == true) {
				target = i;
				//figure out the distance
				distance_from_turret_x = gun1._x-_root["minion"+target]._x;
				distance_from_turret_y = gun1._y-_root["minion"+target]._y;
				//if enemy is in range
				if (Math.sqrt(distance_from_turret_x*distance_from_turret_x+distance_from_turret_y*distance_from_turret_y)<base_range/2) {
					i = monsters_placed+1;
					//resetting bullet count if too large
					if (bc>1019) {
						bc = 1000;
					}
					//get angle for gun, which is then passed down to the bullet   
					dir = Math.atan2(distance_from_turret_y, distance_from_turret_x);
					gun1._rotation = int((dir*360/(2*Math.PI))-90);
					//gets a new bullet
					bullets = duplicateMovieClip("bullet", "bullet"+bc, _root.getNextHighestDepth());
					bc++;
					//makes sure gun is on top of the bullets at all times
					gun1.swapDepths(_root.getNextHighestDepth());
					//to see if bullets touch edge of screen
					if ((bullets._x<0) or (bullets._y<0) or (bullets._y>400) or (bullets._x>500)) {
						bullets.removeMovieClip();
					}
				}
			}
		}
	}
}, 250);
//to keep the base following the mouse when it is not placed yet
base.onEnterFrame = function() {
	if (!placed) {
		this._x = _root._xmouse;
		this._y = _root._ymouse;
		_root.range._alpha = 100;
		can_be_placed = true;
		if ((_root.cant_build_part1.hitTest(this)) || (_root.cant_build_part2.hitTest(this)) || (_root.cant_build_part3.hitTest(this)) || (_root.cant_build_part4.hitTest(this)) || (_root.cant_build_part5.hitTest(this)) || (_root.cant_build_part6.hitTest(this)) || (_root.cant_build_part7.hitTest(this)) || (_root.cant_build_part8.hitTest(this)) or (_root.cant_build_part9.hitTest(this)) || (_root.cant_build_part10.hitTest(this)) || (_root.cant_build_part11.hitTest(this))) {
			_root.range._alpha = 0;
			can_be_placed = false;
		}
	}
	//to hide or display the range mc when clicked on  
	if (placed) {
		base.onPress = function() {
			if (!clicked) {
				range._alpha = 100;
				clicked = true;
			} else if (clicked) {
				range._alpha = 0;
				clicked = false;
			}
		};
	}
};
//to keep the range follwoing the mouse when it is not placed yet
range.onEnterFrame = function() {
	if (!placed) {
		this._x = _root._xmouse;
		this._y = _root._ymouse;
	}
};
//if you click and the base is not ontop of the path, it then is ready too shoot, and doesn't follow the mouse anymore
onMouseDown = function () {
	if ((can_be_placed) && (!placed)) {
		placed = true;
		//applys the gun mc to the base
		attachMovie("gun1", "gun1", _root.getNextHighestDepth());
		gun1._x = _root.base._x;
		gun1._y = _root.base._y;
		range._alpha = 0;
	}
};
Response to: td22 Posted December 14th, 2008 in Game Development

here is the code that is not working, but you need to see everything to figure out why.
Should i post every thing? (140 lines of code)
//not working
for (var i:Number = 1; i<=20; i++) {
if (_root["bullet"+i].hitTest(this)) {
trace(1);
}
}
//not working
if (bullets.hitTest(this)) {
bullets.removeMovieClip();
min.health -= 1;
if (min.health<=0) {
this.removeMovieClip();
}
}

td22 Posted December 14th, 2008 in Game Development

for this file at http://spamtheweb.com/ul/upload/2608/488 45_td22.fla im having trouble doing some hittests. Have a look at my script and you will see what the script is. (marked by a comment) Could anybody help me just a bit?
Thanks

Response to: Snow Posted December 12th, 2008 in Game Development

could i see the file? (spamtheweb.com)

Response to: AS just didnt work for game Posted December 12th, 2008 in Game Development

i can't even test this out. it says that "there are no test devices currently selected" when i press Crtl+Enter. Is this a weird phone format or something?

why does it come out at an angle? Posted December 12th, 2008 in Game Development

here is an example of a test i was doing. it automatically shoots at the target until the target's health is 0. It seems that every time the bullet comes out of the gun, it is a little bit off, crooked.
here is the file
http://spamtheweb.com/ul/upload/2408/557 81_test2.fla
thanks to anybody who helps

Response to: Quicky Posted December 10th, 2008 in Game Development

onClipEvent(enterFrame){
if (awesome){
nextFrame();
} else {
stop();
}
}

well, for the if statement you have to have something like "if(awesome==something){//do this)" otherwise the loop will always do the nextFrame command

example:
onClipEvent(enterFrame){
if(awsome==false){
nextFrame()
}else{
gotoAndStop(2)
}
}

Response to: Quicky Posted December 10th, 2008 in Game Development

stop(); 
onClipEvent(load){
if (var awesome==true){ 	
NextFrame(); 
}else{
 stop();
}
}
Response to: My bullets are all wrong. Posted December 10th, 2008 in Game Development

i could help you. what is the problem exactly?

Response to: removing a mc Posted December 10th, 2008 in Game Development

figured it out:

_root.mc.onPress = function() {
	_root.mc.swapDepths(_root.getNextHighestDepth())
	_root.mc.removeMovieClip();
};

Thanks every one!

removing a mc Posted December 10th, 2008 in Game Development

_root.mc.onPress = function() {
_root.mc.removeMovieClip();
};
why doesn't this work? I'm trying to remove a movie clip in as2 (the code is in the frame).

Response to: transmitter Posted December 5th, 2008 in Game Development

this is as2 :|

Response to: transmitter Posted December 5th, 2008 in Game Development

i guess what i am really saying that my removeMovieClip function is not working. Any help?

Response to: Sponsorship Questions Posted December 5th, 2008 in Game Development

i would be glad to input on your creation!

Response to: flash is f*cking up Posted December 5th, 2008 in Game Development

an example would be nice

transmitter Posted December 5th, 2008 in Game Development

pretty much if you click on one of the mcs, its variable "transmit" is changed form false to true and it should delete the movie clip. it only does trace(1) though so i know it is not because of the for loops.

var ListenerObject:Object = new Object();
ListenerObject.onMouseUp = function(eventObj:Object) {
	trace(4);
	for (var f:Number = 1; f<6; f++) {
		for (var g:Number = 1; g<6; g++) {
			if (_root["c"+f+"_"+g].transmit == true) {
				trace(1);
				_root["c"+f+"_"+g].removeMovieClip();
			}
		}
	}
};
Mouse.addListener(ListenerObject);
Response to: Grow A Tree Collab Posted November 30th, 2008 in Game Development

well, im a programmer, but it depends on what this is about. the other grow a tree submission here at newgrounds(number 1) was just a timer going though different frames, or perhaps it was only animated, no real AS. what is the project going to include?

Response to: breaking if statement Posted November 30th, 2008 in Game Development

anybody? please! should i use an arry that is defined by the random numbers?
:(:(:(:(:(:(