You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!

Author Search Results: 'asgrunt'

We found 164 matches.


<< < > >>

Viewing 1-30 of 164 matches. 1 | 2 | 3 | 4 | 5 | 6

1.

None

Topic: "calling" mc after attachmovie()?

Posted: 07/28/09 01:41 PM

Forum: Flash

when attaching the monsters store a ref in an array. Later on do the hittest by looping through the array; you don't need to re-calculate the instance names


2.

None

Topic: Array/Variable Help

Posted: 07/28/09 01:31 PM

Forum: Flash

hm, it seems to me that you don't need to bump this one since you already got the answer (posts of animan and neo). I.e. take neo's code (be aware: there is a = missing inside the if), put in a return inside that same if to leave everything after finding the search term and you are done.


3.

None

Topic: hitTest Question

Posted: 07/27/09 07:49 AM

Forum: Flash

hittest allways needs a specific target - although you can put all objects (without the one that does the hittest itself) in one single mc and then do a collision test with that one.


4.

None

Topic: Is this feasible

Posted: 07/27/09 07:46 AM

Forum: Flash

in principle, there is no limit to the number of game areas as long as you build them dynamically (i.e. map layout previously saved in xml or txt) or load them as external swf.


5.

None

Topic: Random # generator AS2?

Posted: 07/27/09 07:39 AM

Forum: Flash

you fool :P

no need to insult people who try to help

However, its a good idea to point out that with negative numbers Math.ceil is the method to chose (instead of int)

I was referring to your post which I think is a good point (before that no one was talking about negative numbers but in many situations we may need one). Sorry for my poor English - because of that you did misread my post (English is not my native language)


6.

None

Topic: Random # generator AS2?

Posted: 07/27/09 06:12 AM

Forum: Flash

he was talking about as2 (int outdated) and about positive numbers (int is the same as Math.floor). However, its a good idea to point out that with negative numbers Math.ceil is the method to chose (instead of int)


7.

None

Topic: (AS2) Problems with weapon swing.

Posted: 07/27/09 06:07 AM

Forum: Flash

don't understand exactly what you want:

1. should it play only when the previous attack animation has ended?
2. or should the anim play everytime from the first frame when someone hits space?

instance hero has frame based anim, inside heros' timeline the second frame has a marker "attacking"

frame script _root:

code re 1:

//stops hero anim
hero.stop();
//sets initial state
hero.bAttack = false;
hero.onEnterFrame = function() {
//if the anim has ended flash will go back to frame 1 to start over
//in that one case bAttack is true and the actual frame is 1
//now stop since you don't want to run the anim endless
	if (this.bAttack && this._currentframe == 1) {
		this.bAttack = false;
		this.stop();
	}
//on space look if there is no attacking anim playing
//could also be done by controlling the actual frame > 1
//if no anim the play the anim
	if (Key.isDown(Key.SPACE) && !this.bAttack) {
		this.gotoAndPlay("attacking");
		this.bAttack = true;		
	}
};

re 2. simpler if you want to play on every space:

hero.stop();
hero.onEnterFrame = function() {
	if (this._currentframe == 1) {
		this.stop();
	}
	if (Key.isDown(Key.SPACE)) {
		this.gotoAndPlay("attacking");	
	}
};

the first if can be deleted if you use a frame script inside of hero at the last frame of its attack anim:

this.bAttack = false;
this.gotoAndStop(1);


8.

None

Topic: Flash Top Down Shooter Help As2

Posted: 07/27/09 05:14 AM

Forum: Flash

responding to your pm:

I don't know how Enclave does move. So for testing purpose do the following:

- open a new file
- put an mc on the stage at _root and give it the instance name Enclave. The graphic inside that mc should point to the right (go into symbol editing mode and change the content if necessary).
- put another mc to the stage (instance VaultDweller)
- frame script _root:

//basically this is the same as the snippet I've posted above
function rotate(pWho:MovieClip, pPointTo:MovieClip) {
	var nDistX:Number = pPointTo._x-pWho._x;
	var nDistY:Number = pPointTo._y-pWho._y;
	var nAngle:Number = Math.atan2(nDistY, nDistX)*(180/Math.PI);
	pWho._rotation = nAngle;
//this is only necessary if the rotation function isn't called in an enterFrame
	updateAfterEvent();
}
//only for testing: clicking on Enclave makes it draggable
Enclave.onPress = function() {
	this.startDrag();
//calls above function to calculate the new rotation once for the click
	rotate(this,VaultDweller);	
//calls the function from now on everytime the mouse does move
	this.onMouseMove = function() {
		rotate(this,VaultDweller);	
	};
};
//stop dragging and rotating when the mouse is released
Enclave.onRelease = Enclave.onReleaseOutside =function(){
	this.stopDrag();
	delete this.onMouseMove;
}
//call the function once at the beginning
rotate(Enclave,VaultDweller);

again, you need to be more specific since I don't know what you try to accomplish or what exactly does not work. Maybe post something more of your code ...


9.

None

Topic: Random # generator AS2?

Posted: 07/27/09 04:51 AM

Forum: Flash

int is outdated since Flash 5. Instead you can use Math.floor:

Math.floor(Math.random()*5) does give a number between 0 and 4

int and Math.round are not the same:

Math.round(Math.random()*5) returns between 0 and 5, int is like Math.floor.

The numbers you get are not really random but calculated (therefore pseudorandom number generator). However, its looks random enough for our applications


10.

None

Topic: Function Not Repeating

Posted: 07/26/09 06:43 AM

Forum: Flash

if you just paste this code into another file and put a mc with an instance name of "red" into it, it does work (though of course the dups can't move, they just hang around at _y = 0). So there must be something else involved. Look at your other code, maybe something attached to red.


11.

None

Topic: Point-and-click adventure games?

Posted: 07/25/09 07:01 PM

Forum: Flash

hah - did never realize that there seems to be not tut on Flash adventure games. A long time ago you could find a Flash game engine called f.a.c.e for building online your own adventure games. Unfortunately, the site face.com is no longer available, the engine seems to be gone. Some stuff could still be found by wayback (i.e. the documentation - but German only).

Another one was (partly?) ported from Lingo to AS and is called lassie (yes, like that heroic dog strolling through silly adventures in TV in the last millennium): http://lassie.gmacwill.com/lower.php?sec tion=news&page=index. Maybe that does help.

re movement that could give some ideas (_root, frame script, instance "player", reg point center bottom)

var nMaxRange:Number = Stage.height;
var nMinScale:Number = 60;
var nScaleFactor:Number = (100-nMinScale)/nMaxRange;
var nSpeed:Number = 12;
function initGame(){
	player._y = Stage.height;
	player.onEnterFrame = moving;
	this.onMouseDown = goHere;
}
function goHere() {
	var nDistX:Number = _xmouse-player._x;
	var nDistY:Number = _ymouse-player._y;
	player.aClick = [_xmouse, _ymouse];
	var nAngle:Number = Math.atan2(nDistY, nDistX)*180/Math.PI;
	player.nTempoX = Math.cos(nAngle*(Math.PI/180))*nSpeed;
	player.nTempoY = Math.sin(nAngle*(Math.PI/180))*nSpeed;
};
function moving() {
	var nDistX:Number = this.aClick[0]-this._x;
	var nDistY:Number = this.aClick[1]-this._y;
	this._x += this.nTempoX;
	this._y += this.nTempoY;
	if (Math.abs(nDistX)<=Math.abs(this.nTempoX)) {
		this.nTempoX = 0;
		this._x = this.aClick[0];
	}
	if (Math.abs(nDistY)<=Math.abs(this.nTempoY)) {
		this.nTempoY = 0;
		this._y = this.aClick[1];
	}
	player._xscale = player._yscale=nMinScale+player._y*nScaleFactor;
}
initGame();

click anywhere on the stage and the player will move to that spot.

Assuming you want to do freeform (against iso), moving upwards/downwards does scale the player (fakes depth). You need to take care of obstacles (some pathfinding algo necessary, look at gotoandplay.it for a*, use a pre calculated way map or dumb pathing by simply changing the horiz (or vert) direction when colliding) and of the depth if the player should go behind some obejcts. For inventory look at freeactionscript.com

falling now asleep (in Germany its past midnight)


12.

None

Topic: Function Not Repeating

Posted: 07/25/09 04:14 AM

Forum: Flash

setInterval(duplication(),200);

first arg is wrong: function with brackets invokes that function immediately. If you want to pass it as arg use:

setInterval(duplication,200);

Furthermore, you should store a ref to the inerval. Otherwise you won't be able to delete it if needed


13.

None

Topic: Function Not Repeating

Posted: 07/25/09 02:43 AM

Forum: Flash

For some reason, if you name the function "dupe" it won't work but if you change it it works.

It couldn't work because its name wasn't unique: the mc has the same name.


14.

None

Topic: Help with remove MC? (as2)

Posted: 07/24/09 05:20 PM

Forum: Flash

or put every particle into an holder mc and delete that one to get rid of all particles, i.e.:

- frame script at _root:

var mParticles:MovieClip, mParticle:MovieClip;
var nMaxParticles:Number = 400;
mParticles = this.createEmptyMovieClip("particleHolde r",this.getNextHighestDepth());
for(var i:Number = 0; i < nMaxParticles; i++){
mParticle = mParticles.attachMovie(particleLinkage,"
p"+i,i);
//maybe do something with mParticle, i.e. initialize some vars for movement
}

if you still needs to/want to ref the particles in an array, you could do it by arrayName.push(mParticle)

if you want to stay with duplicateMovieClip then use the mc.duplicateMovieClip method instead of the global function. The method does return a ref to the duplicated object which can be pushed into the array without using eval:

var aParticles:Array = [];

for ... (see above){
aParticles.push(dot.duplicateMovieClip("
dot" + depth, depth));
depth++;
}


15.

None

Topic: infinite drag/drop AS help needed.

Posted: 07/24/09 02:04 AM

Forum: Flash

must appear within on/onClipEvent handler

does mean that you are trying to write a frame script as an object script. In that case you need to click first into a frame (in the time line) and then write your script in the code editor (sorry, havn't look at elis code which you seem to use). Don't use object scripts any more, they are much more inflexible than frame scripts.


16.

None

Topic: game not working

Posted: 07/24/09 02:00 AM

Forum: Flash

take a chair and sit in the bright sun for at least 8 hours. Now test your game and it might work.

To be sincere: you don't understand the code you posted nor the code el-presidente gave you. In that case it would be better to learn at least some basic scripting. Then come back and look at both posts: in the first one at the first line (import statement) and in the second one at the first and second line (Boolean and while).


17.

None

Topic: doing direction and speed

Posted: 07/23/09 08:59 AM

Forum: Flash

I get the feeling you're constantly trying to find problems with it.

No, the reason why I press this issue is simply to learn. Your first answer was

Math.ceil the value if you don't want a 0.

which didn't work. I tried different ways - nope. Why should I not ask for the right code then?


18.

None

Topic: doing direction and speed

Posted: 07/23/09 08:22 AM

Forum: Flash

1. speed = Math.ceil(Math.random()*range)*2-range;

does give: -3, -1, 1, 3, 5, but no 2, 4, -2, -4 (and no 0 which is fine but it lacks the afore mentioned numbers)

2. speed = Math.ceil((Math.random()*(range*2)))-ran ge;

everything between -4 and 5 (including 0)

3. speed = Math.ceil((Math.random()*(range*2))-rang e);

everything between -4 and 5 (including 0)

4. speed = Math.ceil((Math.random())*(range*2))-ran ge;

the same

nothing against low speed, but if you get 0 for both directions, there wouldn't be any movement at all. In your example it would be interesting to see, if any object hangs at the cursor forever.

sorry, can't find the right pos for doing a ceil so please show me the right code.


19.

None

Topic: doing direction and speed

Posted: 07/23/09 06:31 AM

Forum: Flash

as long as the random number can equal range, the subtraction of range does result in 0. Math.ceil doesn't help


20.

None

Topic: doing direction and speed

Posted: 07/23/09 04:34 AM

Forum: Flash

speed = (Math.random() * (range * 2)) - range;

does include 0 which results in a very slow speed


21.

None

Topic: doing direction and speed

Posted: 07/23/09 02:12 AM

Forum: Flash

myXdirection = myYdirection = -1*range+random(range);
Now you get only negative numbers. And the values for x and y are always equal.

If the first direction code was working, take it and multiply by a 1 or -1:

var nDir:Number = 1 - Math.round(Math.random()*1)*2;

does give either 1 or -1.

A better way would be to use frame scripts instead of object scripts and Math.random() instead of random().


22.

None

Topic: Game Tutorial Collab

Posted: 07/22/09 02:21 AM

Forum: Flash

http://spamtheweb.com/ul/upload/210709/3 5388_tut.php

ha ha, nice parody of a game tut. Uhm, wait - you are not joking?


23.

None

Topic: Game Tutorial Collab

Posted: 07/21/09 03:42 AM

Forum: Flash

1. be fair to the people here at newgrounds: if this is your 4th collab and you didn't finish even one then don't do another one

2. to do a game tutorial collab is a good idea (at least in principle) but you should take care of its quality. Don't let people just code something somehow

- give some advice on how to code, i.e.: no object scripts; use a simple framework (i.e. code blocks: import, vars, functions, init)
- use classes for repetetive tasks (or: don't use classes at all)
- insclude some theory your work is based on (i.e. steering behavior: what is it? Why is it useful? What kind of behaviors are possible? Then go on to the specific steering behavior you want to talk about)

3. to do a game tutorial collab on a specific type of game is a better idea since you can focus on one subject and handle it in depth instead of getting lost in 1001 subjects, i.e.:

- tile based games:
- what is it?
- some infos on the history and relevance of tile based games (non-Flash and Flash) to get some background knowledge
- kind of tiles (rect, hex, iso, ...)
- maps (organising data, ...)
- some basic enemy ai
- sprite sheets, blitting
- automatically generate levels
- level editor (how to use an existing one like mappy, how to code your own)
- at least one complete game (including how to write a simple game design doc)
- further sources (from the famous tonypa to gamedev.com etc.)

4. or you could deal with subjects that are relevant to many games without focusing on one sepcific game type (like random, physics, trigo, ai, wayfinding, spawning and so on).

Yes, I know, there are tuts on all these subjects out there in the web (and even here on newgrounds). But this is true of almost every game that will be included in this collab. In that case either give up or do a collab that is better than many tuts you may find with google.


24.

None

Topic: Flash Top Down Shooter Help As2

Posted: 07/21/09 01:59 AM

Forum: Flash

please be more specific: what exactly didn't work? I.e., if you need the mc permanently look at another mc the proposed code should go into an enterFrame event


25.

None

Topic: Fading in and Out

Posted: 07/20/09 03:53 PM

Forum: Flash

... or you did use a dynamic textfield which unfortunately is very sensitive to certain anims (alpha, scale, rotation). In its properties window you need to include all the characters you want to show


26.

None

Topic: Creating a 2D shooting script?

Posted: 07/20/09 05:25 AM

Forum: Flash

1. if you got the code from another place you should ask there for help
2. you got the error because Flash couldn't find the class file (wrong name, wrong path or not existing at all)
3. to attach it without using a class file something like that will do (frame script _root):

var mMissile:MovieClip;
var nMissileSpeedY:Number = 12;
var aMissiles:Array = [];

every time you need to attach a missile:

mMissile = yourTargetMC.attachMovie(exportName, instanceName, yourTargetMC.getNextHighestDepth());
aMissiles.push(mMissile );

and for the moving:

someInstance.onEnterFrame = function() {
	for (var i:Number = 0; i<aMissiles.length; i++) {
		aMissiles[i]._y += nMissileSpeedY;
	}
};

27.

None

Topic: Spawning enemies

Posted: 07/20/09 04:45 AM

Forum: Flash

AS2:

var nSpawnTime:Number = 1000;//time in milli sec
var nInterval:Number = setInterval(this,"spawnEnemy",nSpawnTime);
function spawnEnemy(){
//attaching the enemy mcs
}

every 1000 milli sec this will invoke the function spawnEnemy()
to get rid of that just do a clearInterval(nInterval);


28.

None

Topic: classic tapping action in flash

Posted: 07/20/09 04:02 AM

Forum: Flash

don't know the game you are talking about, but the code in the previous post can't work at all.

In order to detect a key press you either need an onEnterFrame or (better) an event listener. Frame script:

var oKey:Object = new Object();
oKey.onKeyDown = function() {
	var nKey:Number = Key.getAscii();
//your if statements here
}
oKey.onKeyUp = function() {
	i = 0;
};
Key.addListener(oKey);

btw, Key.getASCII() returns a number not a string (97 is "a", 115 is "s").


29.

None

Topic: Flash Top Down Shooter Help As2

Posted: 07/20/09 03:27 AM

Forum: Flash

somewhat strange code ...

much simpler with atan2:

var nDistX:Number = VaultDweller._x-Enclave._x;
var nDistY:Number = VaultDweller._y-Enclave._y;
var nAngle:Number = Math.atan2(nDistY, nDistX)*(180/Math.PI);
Enclave._rotation = nAngle;

The graphics inside of Enclave must point to the right.

Good luck with your fallout game (loving the fallout series)


30.

None

Topic: Finding the X, Y of a point?

Posted: 07/14/09 02:12 AM

Forum: Flash

to get the corner points of an instance mc at _root (frame script):

var oCorners: Object = mc.getBounds();
trace("top left: " + oCorners.xMin + "/" + oCorners.yMin);
trace("bottom right: " + oCorners.xMax + "/" + oCorners.yMax);

getBounds gives you the bounding rect of the mc with its top left and bottom right points.

then you need to calculate its pos according to the main frame (s link in previous post).


All times are Eastern Standard Time (GMT -5) | Current Time: 09:39 AM

<< < > >>

Viewing 1-30 of 164 matches. 1 | 2 | 3 | 4 | 5 | 6