Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.18 / 5.00 3,534 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.80 / 5.00 4,200 ViewsYes... I have one. But it does not contain information about the specific things I need to know for this project...
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.
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.
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);
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.
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
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
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! :)
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
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.
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.
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.