Be a Supporter!
is this right? Posted July 8th, 2009 in Game Development

trace("dotx: "+root["dot_"+a].x)
so when i have this trace, the compiler reports this error: TypeError: Error #1010: A term is undefined and has no properties.
but when i trace dot.x, it comes out to be 10. how is root["dot_"+a].x wrong(a is defined)?
oh and its as3
thanks for the help

Response to: can't find the window Posted July 8th, 2009 in Game Development

i just discovered that all the tabs in help are not working for me, should i contact adobe?

Response to: can't find the window Posted July 7th, 2009 in Game Development

please help, i keep on clicking on the Flash Help button and nothing is coming up or poping up or anything. where is the panel?

can't find the window Posted July 7th, 2009 in Game Development

in flash cs4 professional, i click on help>flash help and i don't see any windows pop up like they did in flash 8, is there a tab that stores that window until i click on it?
Ask for more clarification if needed. thanks everyone!

Response to: completely new to as3 Posted July 7th, 2009 in Game Development

thanks of ton
so they replaced _root with stage?
that's interesting...

completely new to as3 Posted July 7th, 2009 in Game Development

i was wondering how to determine if the stage has been clicked. from what i know of as3 so far, i can only put together this:

stop();
function clickedframe(event:MouseEvent):void {
	trace("you clicked the screen");
}
this.addEventListener(MouseEvent.MOUSE_DOWN, clickedframe);

could somebody help me?
thanks

Response to: How to with flash 8 Posted June 27th, 2009 in Game Development

Modify>document>fps

Response to: Backwards-button Posted June 17th, 2009 in Game Development

At 6/17/09 01:53 PM, Rockhetnu wrote: is there A code for a button that plays the movie back wards?

i dont think so, but what you could do is create two clips, one is forward and one is backward(modify>timeline>reverse frames) and have a button that goes to the frame where the reverse movie starts.


Hey, I was wondering if someone could point me to a tutorial that teaches how to upload a picture into the swf like in this game:

It lets you choose the face of the guy you are "torturing". Does the script import the picture in the library and then into the timeline? Thanks for any help.

Response to: empty movieclip not deleting Posted May 25th, 2009 in Game Development

it works!
-changed the create empty movieclip
-took out the with
-changed the delete to removeMovieClip
Thanks for the help, everyone!!

Response to: empty movieclip not deleting Posted May 25th, 2009 in Game Development

nether one of those work


_root.onMouseDown = function() {
	starty = _root._ymouse;
	startx = _root._xmouse;
	line = this.createEmptyMovieClip("line", _root.getNextHighestDepth());
	_root.onMouseMove = function() {
		with (line) {
			this.clear();
			this.moveTo(startx, starty);
			this.lineStyle(2, 0x777777, 100);
			this.lineTo(_root._xmouse, _root._ymouse);
		}
		
	};
};
_root.onMouseUp = function() {
	delete _root.onMouseMove;
	delete _root.line
	
};

This is my code for the program here: http://spamtheweb.com/ul/upload/250509/3 8823_game.php
For some reason the delete _root.line doesn't work. Any suggestions?


So I have this array and the length property of it doesn't seem to be working when i make it have one number, the length is that number:

var primary:Array = new Array(5);
trace(primary.length)//outputs 5

but when i have two numbers in it, the length property works:

var primary:Array = new Array(5,0);
trace(primary.length)//outputs 2

What am I doing wrong?

horror game experiment Posted April 19th, 2009 in Game Development

So i am doing this experiment with a horror game. I want to know how to see if the player has touched the light of the enemy. here is the swf: http://spamtheweb.com/ul/upload/190409/4 0554_survival.php
here is the code:

torch_power = 500;
torch_step = 100;
torch_angle = 363;
torch_angle_step = 150;
walk_speed = 3;
radius = 8;
var waypoint_x:Array = new Array(250, 415, 415, 250);
var waypoint_y:Array = new Array(290, 290, 200, 200);
_root.attachMovie("ground", "ground", _root.getNextHighestDepth());
_root.attachMovie("environment", "environment", _root.getNextHighestDepth());
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:250, _y:200});
_root.attachMovie("enemy", "enemy", _root.getNextHighestDepth(), {_x:250, _y:220});
_root.createEmptyMovieClip("light", _root.getNextHighestDepth());
//movement
player.onEnterFrame = function() {
	if (Key.isDown(Key.LEFT)) {
		this._x -= walk_speed;
	}
	if (Key.isDown(Key.RIGHT)) {
		this._x += walk_speed;
	}
	if (Key.isDown(Key.UP)) {
		this._y -= walk_speed;
	}
	if (Key.isDown(Key.DOWN)) {
		this._y += walk_speed;
	}
	while (_root.environment.hitTest(this._x, this._y+radius, true)) {
		this._y--;
	}
	while (_root.environment.hitTest(this._x, this._y-radius, true)) {
		this._y++;
	}
	while (_root.environment.hitTest(this._x-radius, this._y, true)) {
		this._x++;
	}
	while (_root.environment.hitTest(this._x+radius, this._y, true)) {
		this._x--;
	}
	dist_x = this._x-_root._xmouse;
	dist_y = this._y-_root._ymouse;
	angle = -Math.atan2(dist_x, dist_y);
	this._rotation = angle/(Math.PI/180);
};
enemy.point_to_reach = 0;
enemy.speed = 2;
enemy.onEnterFrame = function() {
	//movement
	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))<this.speed) {
		this._x = waypoint_x[this.point_to_reach];
		this._y = waypoint_y[this.point_to_reach];
		if (this.point_to_reach>=waypoint_x.length-1) {
			this.point_to_reach = 0;
		} else {
			this.point_to_reach++;
		}
	}
	ang = Math.atan2(dist_y, dist_x);
	this._x = this._x+this.speed*Math.cos(ang);
	this._y = this._y+this.speed*Math.sin(ang);
	//light
	light.clear();
	light.beginFill(0xffffff, 100);
	light.lineStyle(1, 0xffffff);
	light.moveTo(this._x, this._y);
	for (x=0; x<=torch_angle; x += (torch_angle/torch_angle_step)) {
		ray_angle = 0/(Math.PI/180)-90-(torch_angle/2)+x;
		ray_angle = ray_angle*(Math.PI/180);
		for (y=1; y<=torch_step; y++) {
			if (environment.hitTest(this._x+(torch_power/torch_step*y)*Math.cos(ray_angle), this._y+(torch_power/torch_step*y)*Math.sin(ray_angle), true)) {
				break;
			}
		}
		light.lineTo(this._x+(torch_power/torch_step*y)*Math.cos(ray_angle), this._y+(torch_power/torch_step*y)*Math.sin(ray_angle));
	}
	light.lineTo(this._x, this._y);
	light.endFill();
	ground.setMask(light);
};

look here for info on the tutorial i used: http://www.emanueleferonato.com/2007/09/
26/create-a-survival-horror-game-in-flas h-tutorial-part-1/

thanks for any help,
kylelyk

Response to: looking for AS3 help Posted April 12th, 2009 in Game Development

your game needs to have two steps to solving a bounce off a wall or brick. the first is to have a while loop run until you ball is completely out of the wall/bricks. Then you need to have an algorithm to figure out which way to go next, by switching the x or y velocities.

if you need more help, pm me.
hope this helps

Response to: dots exercise! Posted April 12th, 2009 in Game Development

thank you so much!!!!! i didn't even think of that. i bet if i change that one line, it would solve the problem!

Response to: dots exercise! Posted April 12th, 2009 in Game Development

dots = 4;
space = 40;
//row
for (a=1; a<=dots; a++) {
	//column
	for (b=1; b<=dots; b++) {
		dot = attachMovie("dot", "dot_"+((a-1)*dots+b), _root.getNextHighestDepth());
		dot._x = b*space;
		dot._y = a*space;
	}
}
//prepare the array
//0=open
//1=closed
lines = dots*((dots-1)*2);
var lineHolder:Array = new Array();
for (c=0; c<lines; c++) {
	lineHolder[c] = 0;
}
//draw lines and give code
linecount = 0;
for (d=1; d<=dots*dots; d++) {
	column = d%dots;
	if (column<1) {
		column = dots;
	}
	row = Math.floor((d-1)/dots)+1;
	//to the left
	if (column>1) {
		line = attachMovie("line", "line_"+linecount, _root.getNextHighestDepth());
		line._x = _root["dot_"+d]._x-space/2;
		line._y = _root["dot_"+d]._y;
		linecount++;
		programming(line);
	}
	//to the bottom  
	if (row<dots) {
		line = attachMovie("line", "line_"+linecount, _root.getNextHighestDepth());
		line._rotation = 90;
		line._x = _root["dot_"+d]._x;
		line._y = _root["dot_"+d]._y+space/2;
		linecount++;
		programming(line);
	}
}
function programming(mc) {
	mc._alpha = 20;
	mc.id = linecount-1;
	mc.onRollOver = function() {
		if (lineHolder[this.id] == 0) {
			this._alpha = 50;
		}
	};
	mc.onRollOut = function() {
		if (lineHolder[this.id] == 0) {
			this._alpha = 20;
		}
	};
	mc.onMouseDown = function() {
		this._alpha = 100;
		//lineHolder[this.id] = 1;
	};
}
dots exercise! Posted April 12th, 2009 in Game Development

so for a programming exercise, i am making the game dots, which can be found here: http://www.addictinggames.com/dots.html

i am just making the game interface and the rollover and rollout options work, but when i click on one of the lines, it makes all of the lines black instead of just one.

here is the swf: http://spamtheweb.com/ul/upload/120409/3 4306_dots.php
here is the fla: http://spamtheweb.com/ul/upload/120409/3 4358_dots.fla

i think its because i do a for loop to create all of the lines, so maybe the script is getting messed up from that, idk.
thanks to anyone that helps.

Response to: Have a game idea, have no maker Posted March 23rd, 2009 in Game Development

I'm interested, I've been screwing around with making prototype card games. I just have the as part for making the card arrays and shuffling it, no visual things or anything. i don't completely understand the rules though.

registration point? Posted March 19th, 2009 in Game Development

any way to set the registration point of a movie clip using as2?(the movie clip is put into workspace by the attachMovie method)
Thanks

Response to: $$$AS programmer needed$$$ Posted March 19th, 2009 in Game Development

At 3/19/09 10:31 PM, Zuggz wrote: Post examples of the type of work you will be doing.

exactly, i want to know!!!! ;)

Response to: arrays in for loops Posted March 15th, 2009 in Game Development

Problem fixed, i changed the deck name from cards to deck, but i fogot to change on instance of it in the script.
Thanks for everybody's help

Response to: arrays in for loops Posted March 15th, 2009 in Game Development

i took out the if statement if(v==0){ so that it would run a total of 49 times. what i output i come out with was this:
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
43
undefined
undefined
undefined
48
39
undefined
32
50
25
undefined
51
undefined
44
21
45
29
undefined
19
41
46
24
18
33
49
undefined
47
15
undefined
31
35

why is it so random?

Response to: arrays in for loops Posted March 15th, 2009 in Game Development

well, i trace the columns and they all come out undefined, i'm not sure if its the trace or the columns that is the problem.

arrays in for loops Posted March 15th, 2009 in Game Development

so i have this script that is supposed to take the last "card" from the "deck" into each column, but when i trace that column and its component, i see that none are defined

var columns:Number = 7;
var length:Number = 7;
//the problem is probably in the next 4 lines somewhere, but i don't know how to fix it.
//its not the deck that the problem, it work fine, i think it is the way i introduced the new columns that
//is screwing the program up
var column:Array = new Array
for (h=0; h<columns; h++) {
	column[h] = new Array
}
for (v=0; v<length; v++) {
	if (v == 0) {
		for (u=0; u<columns; u++) {
			column[u][v] = deck.pop();
			trace(column[u][v])//this is the trace i am talking about
		}
	}
}
Response to: % sign Posted March 10th, 2009 in Game Development

At 3/10/09 07:00 PM, Zuggz wrote: gets the reminder

you mean remainder right?

Response to: Wanna be my partner? Posted March 10th, 2009 in Game Development

i don't know, i don't have anything to do this week anyway. i don't completely understand what this is about though.

do you want someone to teach you stuff?

% sign Posted March 10th, 2009 in Game Development

what does the % sign do in AS2?
Thanks

Response to: Rpg Collison Posted February 17th, 2009 in Game Development

well if its as2 you want...
if(_root.player.hitTest(_root.bullet)){
_root.player.gotoAndStop(DIEING FRAME)
}

For that hittest, it will check if the player's box (the blue outline when you select your player) is hitting the bullet's box. if you need something more accurate, use the ._x and ._y properties of both movieclips to determine if the bullet is close enough to touch the player without using a hittest.

Hope this helps!

Response to: 3d in Flash CS4 Posted February 17th, 2009 in Game Development

At 2/17/09 08:43 PM, Jereminion wrote: damn i was excited about hearing this but it was a sad day when it denied me when it found out i was coding in as2

so in cs4 can you not use as2?