Be a Supporter!
Response to: Mouse Panning X/y Limits? Posted April 20th, 2012 in Game Development

Yes... I have one. But it does not contain information about the specific things I need to know for this project...

Response to: Mouse Panning X/y Limits? Posted April 20th, 2012 in Game Development

Well, I mean, I can't just read about AS3 and know it... yes, books can help me. But I need to actually need to experiment with the stuff and actually do it before I REALLY know it.

Response to: Mouse Panning X/y Limits? Posted April 20th, 2012 in Game Development

I'm self-taught and I'm not going to get a damn thing out of reading an AS3 book. I look up things I don't know how to do, copy the code, then play around with it and learn it.

Mouse Panning X/y Limits? Posted April 20th, 2012 in Game Development

I can pan around both axis with the mouse, that's working beautifully (I just copied the code off some site, though, and I only half understand it). The problem is, the pan won't stop and it goes outside the MC limits. I've been fighting with Flash for the last couple hours and absolutely nothing I've tried has done a thing. Does anyone know how to fix this? Thanks in advance.

Here's the code:

function panThisImage(target:MovieClip, speed:Number, speed1:Number, dir:int) {
	var mousePercent:Number=mouseX/stage.stageWidth;// In the center of stage width
	var mousePercent1:Number=mouseY/stage.stageHeight;// In the center of stage height

	// MouseMove handler for image panning
	stage.addEventListener(MouseEvent.MOUSE_MOVE, panImage);
	target.cacheAsBitmap=true;

	function panImage(E:MouseEvent):void {
		var mSpeed:Number;
		var mSpeed1:Number;
		mousePercent=mouseX/stage.stageWidth;
		mousePercent1=mouseY/stage.stageHeight;
		if (dir==1) {
			mSpeed=1-mousePercent;
		} else {
			mSpeed=mousePercent;
		}
		if (dir==1) {
			mSpeed1=1-mousePercent1;
		} else {
			mSpeed1=mousePercent1;
		}
		target.destX = Math.round(-((target.width-stage.stageWidth) * mSpeed));
		target.destY = Math.round(-((target.height-stage.stageHeight) * mSpeed1));


		if (target.hasEventListener(Event.ENTER_FRAME)) {
			target.removeEventListener(Event.ENTER_FRAME, del);
		}
		target.addEventListener(Event.ENTER_FRAME, del);

	}
	function del(E:Event):void {
		if (Math.abs(target.x-target.destX)<=1) {
			target.x=Math.round(target.destX);
			target.removeEventListener(Event.ENTER_FRAME, arguments.callee);
		} else {
			target.x += (target.destX-target.x) * (speed / 100);
		}
		if (Math.abs(target.y-target.destY)<=1) {
			target.y=Math.round(target.destY);
			target.removeEventListener(Event.ENTER_FRAME, arguments.callee);
		} else {
			target.y += (target.destY-target.y) * (speed1 / 100);
		}
	}

}

panThisImage(myBackground, 7, 7, 0);
Response to: Edd Gould, 1988-2012 Posted March 28th, 2012 in NG News

I can't believe he died...
He was always one of my favourite animators, incredibly talented and definitely a big inspiration for me. He was way too young to die...
Newgrounds will never be the same without him. RIP Edd.

Response to: Mcs And Objects That Want To Be Mcs Posted March 28th, 2012 in Game Development

Well damn. Can't believe that never occurred to me ._. Thanks. xD


I don't actually know if this is possible. But can you make an object equal a movie clip?
Here's what I mean. I have 12 different movieclips drawn out. I have a random number variable and whatever number it generates, I want it to addChild the respective movieclip. The movieclips are all supposed to be called to the same x and y positions, so I was wondering, could I make some object/variable/thing initially equal the movieclip, then addChild that object/variable/thing? Maybe you can't do that, but I'm trying to make my code as clean as possible. xD

Response to: Character jump as3,character falls! Posted March 27th, 2012 in Game Development

I don't usually make that type of game, and when I say "don't usually," I mean, "never." But regardless, I'd try making the ground into a movie clip and hitTesting it.

if(noor.hitTestObject(ground)){
[whatever makes her stop];
}

Like that, probably

Response to: As3 Character Generator Help Posted March 24th, 2012 in Game Development

At 3/24/12 01:43 PM, ProfessorFlash wrote: Use groups for the traits and pick only one trait from the group. Set conflicting traits in the same group. You can have several groups, more than you the amount of traits you pick. Like you can have 9 groups, but only pick one trait from 3 groups. This will take some organizing from you, but definitely better idea than what the previous guy suggested with the booleans.

Oh damn, that's a really good idea. I'll just make an array for each group. Thanks! :)

Response to: As3 Character Generator Help Posted March 24th, 2012 in Game Development

At 3/24/12 12:47 PM, caseymacneil wrote: i would go about doing it like this, unless theres a shit ton of traits to pick from, then you could figure something out similar.

if (trait == unfriendly){
canPickFriendly = false
}

P.S. that's probably not your actual variable names so switch it about if thats even what your looking for.

Hmm, yeah, there is a shit ton of them. xP I was hoping there'd be a less tedious way, but if this works, I'll make myself do it. Thanks. xD

As3 Character Generator Help Posted March 24th, 2012 in Game Development

I'm trying to make a random character generator that I'll eventually develop into a bigger game. I've got it randomly generating the gender, name, likes, dislikes, blah blah blah. I've written out the personality traits and have made it so it can't repeat traits, but I need a way to make it so that if it picks a certain trait (e.g. "Friendly") it cannot pick other, conflicting traits (e.g. "Unfriendly"). I haven't searched much about this problem because really, I have no idea what to search. Does anyone have any suggestions as to how to go about this? Thanks.

Response to: (as3) Dynamically Removing Filters Posted August 2nd, 2011 in Game Development

Well, that's just telling me to use filters = null; which is what I already have and what isn't working.

This is all relevant code I have; maybe someone can detect a problem. (Also, just ignore my stupid function names. I pretty much just name them after the next word I hear in the song I'm listening to :\)

hint.addEventListener(MouseEvent.CLICK,manipulation);
function manipulation(event:MouseEvent){
	this.addChild(newHint);
	newHint.x = 121;
	newHint.y = 78;
	
	this.addChild(newX);
	newX.x = 350.9;
	newX.y = 100.0;

	var i:int = this.numChildren - 5;
	while(i > 0){
        i--;
    
        this.getChildAt(i).filters = BLUR;
	} 
	
	newX.addEventListener(MouseEvent.CLICK,traumst);
	function traumst(event:MouseEvent){
		removeChild(newHint);
		removeChild(newX);
		var i:int = this.numChildren - 5;
		while(i > 0){
		i--;
		
		this.getChildAt(i).filters = [];
		} 
	} 
}

Everything works perfectly except

var i:int = this.numChildren - 5;
while(i > 0){
i--;
		
this.getChildAt(i).filters = [];

and I have no compiler errors, the blur just simply doesn't go away when "newX" is pressed.

Response to: (as3) Dynamically Removing Filters Posted August 2nd, 2011 in Game Development

Well, the blur is already successful. I can get the background stuff to blur. I just can't get it to unblur...


Basically, the effect I'm going for is, you click on a button that calls an mc to the stage and blurs everything below it. When you click another button (that was also called), that mc (and button) is removed, as well as the blur filter.
I have this for the filter:

var BLUR:Array = [new BlurFilter(16, 16, 1)];

var i:int = this.numChildren - 5;
while(i > 0){
i--;
    
this.getChildAt(i).filters = BLUR;
}

I thought copying it and changing the last line to

this.getChildAt(i).filters = [];

would work, but, well, I wouldn't be here if it did...

Does anyone know how to do this? Thanks in advance.