Be a Supporter!
Coding for beginners? Posted February 11th, 2014 in Programming

Hey guys, I was wondering if you can recommend any actionscript 3 tutorials for beginners like myself who moved from using as2 to as3. If you can recommend me any books or websites that will give me a lot of knowledge of using actionscript 3, that would be great! It's been a while I've been coding and half the stuff I used to code were youtube tutorials and the bad thing about it is, it gave the users the code but really didn't give a step by step on what that particular action does (a little confuse on using booleans) So it would be helpful if you can recommend books, websites, and I know theres a link in the newgrounds website but it isn't enough for me. Thanks for the help

Javascript; Plays music Posted May 21st, 2013 in Programming

Can somebody help me on how I make a class when the user opens the application up it plays the music that's in the folder? Because I'm very new to javascript so if you don't mind telling me how to do this it would be great!

Response to: Boxing Game Help! Posted April 18th, 2013 in Game Development

see i was going to go that way but its just way too simple. I will try out Flashdevelop when my computer parts come in. Is it way different from Flash pro? I mean does Flashdevelop offer as3?

At 4/18/13 12:00 AM, MSGhero wrote:
At 4/17/13 11:58 PM, NoFatAsiansPlz wrote: AS3, yeah ... you're not the first person to tell me that. I'm sticking to AS2 until I can afford as3... Thing is (off topic) how can I earn over 200 bucks to buy and download Flash CS3, I'm pratically running this game on macromedia flash 8
Just get flashdevelop. It's free and better than flash pro for coding.

If you want one to play after another, play the first one, wait for the animation to finish (check the current frame), then play the next one. Or just place the right punch animation after the left punch one in the movieclip so you don't have to worry about it.
Response to: Boxing Game Help! Posted April 17th, 2013 in Game Development

AS3, yeah ... you're not the first person to tell me that. I'm sticking to AS2 until I can afford as3... Thing is (off topic) how can I earn over 200 bucks to buy and download Flash CS3, I'm pratically running this game on macromedia flash 8

At 4/17/13 11:52 PM, MSGhero wrote:

Second, it would benefit you to switch to AS3.

Response to: Boxing Game Help! Posted April 17th, 2013 in Game Development

When the user clicks the mouse it will have a 50% chance that it will play the left or right punch animation. Plus i didn't say I pasted the javacode onto the game did I? The first one I did, the second I didn't. Hes just demonstrating it to me. So yes, what you just said I want the fist to play once after another.

At 4/17/13 11:52 PM, MSGhero wrote: First of all, what he's telling you isn't actionscript at all, it's Java (so stop copying it and read what he's saying). Second, it would benefit you to switch to AS3.

You keep saying you want it to "either" play left or right. What does "either" mean? Do you want it to randomly pick a direction? Do you want it to play both at once or one after another?
Response to: Boxing Game Help! Posted April 17th, 2013 in Game Development

You know, I tried your methods none of them are working. I tried figuring it out and when I tried fixing it. More errors keep popping up. AS2 is a pain in the ass

At 4/17/13 11:19 PM, PMMurphy wrote: Also if you keep getting the "not inside the class" error.

Put your stack trace error report on here so i can look at it. I may ask you to show me code.

A stack trace error looks something like this.

java.lang.NullPointerException
at Algorithm.crossover(Algorithm.java:136)
at Algorithm.evolvePopulation(Algorithm.java:38)
at Swarm.act(Swarm.java:24)
at greenfoot.core.Simulation.actActor(Simulation.java:565)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:523)
at greenfoot.core.Simulation.runContent(Simulation.java:213)
at greenfoot.core.Simulation.run(Simulation.java:203)

This is the stupid error im getting that im too lazy to fix cuz i don't feel like figuring it out. I am prolly just gonna delete the program.

But basically show me your stack trace, it should look like that.
Response to: Boxing Game Help! Posted April 17th, 2013 in Game Development

alright but the problem is.
The "Static boolean val" giving a error which is Attribute used outside class. Same goes for the public void.

At 4/17/13 11:01 PM, PMMurphy wrote: OOOOOOOOOOOOOOOOOOOOOOOOOHHHHHHHHHHHH

static boolean val;
public void punch()
{
if(val)
{
punchLeft();
} else {
punchRight();
}
val = !val;
}

That will make you punch left and right alternating 50% of the time in a sequential order.
Response to: Boxing Game Help! Posted April 17th, 2013 in Game Development

I'm still confuse..
Thing is all I want it to do is only one button which is the LEFT CLICK
when i click the left clicker it will either punch LEFT or RIGHT.
The whole symbol is called "fist" and when you click into the symbol there are two more symbols inside of it. One symbol is left fist and the other is right fist. Those two symbols inside the Fist symbol is the animation of it when the user clicks the LEFT CLICKER. I don't want 2 separate buttons i just want one. Now how the heck do i do that. I can only make it work by playing the left fist because this is what i put so far.

onClipEvent (enterFrame)

{ Mouse.hide();

this._x = _root._xmouse;

this._y = _root._ymouse;
}
onClipEvent (mouseDown) {
this.leftfist.gotoAndPlay(1);

}

when the mouseDown comes in, i want it either play leftfist or rightfist.... Now a other question is, does the || (or) method work on as2? Because I tried (this.leftfist.gotoAndPlay(1) || this.rightfist.gotoAndPlay(1)). Both of them punch at the same time but i want it to play the animation one at a time.

Response to: Invisible platform!?!!?! Posted April 17th, 2013 in Game Development

At 4/15/13 01:38 PM, Gimmick wrote: uguu, too many _roots x_x
1) I'd advise you use AS3 dude, AS2's time's run out.

Where the hell do I download the newest flash for free huh? Flash is so expensive x.x

Boxing Game Help! Posted April 16th, 2013 in Game Development

Hey, i'm in a stump here. How do I be able to make the fist punch left or either right. Do I have to do a random method for this?
I'm using actionscript 2 and what I put onto the fist is

onClipEvent (enterFrame)

{ Mouse.hide();

this._x = _root._xmouse;

this._y = _root._ymouse;

}

onClipEvent (mouseDown) { this.gotoAndPlay(2); }

Response to: Attacking Help. Posted March 7th, 2013 in Game Development

At 3/7/13 05:42 AM, flashMan wrote: ok so you have a sword in a char movie.

what is attack for. also coding in movie clips = bad

I have a movie clip in a movie clip inside a movieclip... I don't know how to explain this but
It's Char -> Attack -> and on the last frame theres this sword movieclip and if the enemy gets hit with that then it disappears..
How do I do that?

Attacking Help. Posted March 6th, 2013 in Game Development

Alright so I got the attacking function to work but the problem is the enemy won't disappear when the character hits that last frame on the attacking animation. Lemme break it up the problem to make it sound a little easier to understand.

I have 4 frames in the character (walking,jumping,stand,attack) and when you click on the frame for the attack. I have a sword at the very end which I put a instance name for it called "sword". After that I go to my enemy and his actions are

onClipEvent (enterFrame) {
if (_root.char.attack.sword.hitTest(this)) {
_root.score += 10;
unloadMovie(this);
}
}

So I test it out and the enemy doesn't disappear at all. Is it possible to make that "If" statement? I mean I'm not understanding the _root a lot. How do I fix this problem?

Response to: AS2 - Door help Posted March 3rd, 2013 in Game Development

At 3/3/13 11:39 PM, NoFatAsiansPlz wrote:
At 3/2/13 07:44 AM, FlyingColours wrote:
At 3/2/13 01:49 AM, NoFatAsiansPlz wrote:
So how do I set this up? Do I make this into a deprecate layer and then make doors with the assigned name?
Layers don't really matter. As long as the instance names of the doors match the ones in the code, it will work. :)
Alright it worked but theres a problem, the frames spaz out on me and it keeps switching different frames back and forth.

actually scratch that, how do I set the X and Y coordinates depending on what door the player chooses?

Response to: AS2 - Door help Posted March 3rd, 2013 in Game Development

At 3/2/13 07:44 AM, FlyingColours wrote:
At 3/2/13 01:49 AM, NoFatAsiansPlz wrote:
So how do I set this up? Do I make this into a deprecate layer and then make doors with the assigned name?
Layers don't really matter. As long as the instance names of the doors match the ones in the code, it will work. :)

Alright it worked but theres a problem, the frames spaz out on me and it keeps switching different frames back and forth.

Response to: AS2 - Door help Posted March 2nd, 2013 in Game Development

var doorClips:Array = [firstDoor, secondDoor, thirdDoor, fourthDoor, fifthDoor];
var roomFrames:Array = [2, 4, 6, 3, 7];
onEnterFrame = function(){
for (var i:String in doorClips){
if(Key.getCode() == 69 && doorClips[i].hitTest(character)){
gotoAndStop(roomFrames[i]);
}
}
}

So how do I set this up? Do I make this into a deprecate layer and then make doors with the assigned name?

AS2 - Door help Posted February 28th, 2013 in Game Development

Alright i know many of you animators and programmers out there will recommend me to ditch AS2 and go to AS3 but i will as soon i get my first game done. Anyways I'm having trouble on doors for my platform game, how do I excute a event if the character is on the door symbol and if I press the E or up arrow, it will take me to a certain frame?

Response to: Level Unlock Help Posted February 17th, 2013 in Game Development

At 2/16/13 11:56 PM, FlyingColours wrote: Sorry! I meant this:

onEnterFrame = function (){
if(char.hitTest(whatever)) {
gotoAndStop("Lvl1Done");
if(got < 1){
got= 1;
}
}
}

That way, you won't 'relock' the levels you've completed when you replay a level.

Thanks for the help dude :)

Level Unlock Help Posted February 16th, 2013 in Game Development

Alright so I decided to have the player beat the level to make the "Level2" button appear in the "Levels" scene but I don't know how to do that. So far I tried doing this if the player completes the level. This is AS2 by the way.

onClipEvent(enterFrame) {
if(_root.char.hitTest(this)) {
_root.gotoAndStop("Lvl1Done"); }
got= 1;
}

then for the button on the "Levels" scene I put this
on(release) {
if (got == 1) {
gotoAndStop("level2");
}
}


I been looking around newgrounds and youtube for platform tutorials that takes you to step 1 where they talk about what each code means. So far I come across with a lot of great tutorials but the problem is that its a copy and paste tutorial -__- and they rarely talk about what each piece of the code means. Can somebody sent me a link for a great site for a noob programmer? I want to start programming my own games in flash and I think its a good start for my video game design career.

Enemy disappears if it hits this Posted January 17th, 2012 in Game Development

I'm having problems on how I make an enemy AI move and disappear if the player is by and presses the space button for the attack. I don't even know what to start with or how, I tried looking for tutorials and everything and no hope :\

Response to: Code explanation? Posted January 17th, 2012 in Game Development

At 11/28/11 05:37 PM, BlackMist75 wrote: I understand some of it! like

onClipEvent(load){
//declare variables
}
onClipEvent (enterFrame){ //this is for movie clips only
if (Key.isDown(Key.RIGHT)){
this._x += variable;
}
}

I understand that, I just want the code to make an animation play when you hit a key

I had the same problem as you but try this

onClipEvent (enterFrame) {
	if (Key.isDown(Key.LEFT)) {
		this._x -= 10;
		this.gotoAndStop(2);
		this._rotation = 90;
	} else if (Key.isDown(Key.RIGHT)) {
		this._x += 10;
		this.gotoAndStop(2);
		this._rotation = -90;
	} else {
		if (Key.isDown(Key.UP)) {
			this._y -= 10;
			this.gotoAndStop(2);
			this._rotation = 0;
		} else if (Key.isDown(Key.DOWN)) {
			this._y += 10;
			this.gotoAndStop(2);
			this._rotation = 0;
		} else {
			this.gotoAndStop(1);
		}
	}
}
Response to: Plays animation on multiple keys? Posted January 17th, 2012 in Game Development

onClipEvent (enterFrame) {

if (Key.isDown(Key.LEFT)) {
this._x -= 10;
this.gotoAndStop(3);
else if(Key.isDown(Key.RIGHT)) {
this._x += 10;
this.gotoAndStop(3);
} else {
this.gotoAndStop(1);
}
}

Thanks! now I learn something new :)

Make this do attacking animation Posted January 17th, 2012 in Game Development

I have a big problem with this script that I can't even fix it myself. I tried doing a lot of different ways to do it but it won't do any cause to it. Here's my whole code and I'm trying to make the space button do an attack, but when I tried testing it out, it won't do it.

onClipEvent (load) {
	var grav:Number = 0;
	// gravity
	var speed:Number = 9;
	// how fast you walk
	var jumpHeight:Number = 11;
	// how high you jump
	var slow:Number = .7;
	// sets water falling speed
	var slowspd:Number = speed/1.5;
	// sets water walking speed
	var setspeed:Number = speed;
	var scale:Number = _xscale;
	var ex:Number = 5;
	// makes hitTests better, change for a closer hitTest (warning, more buggy if smalle, less real if further)
	this.gotoAndStop(2);
}
onClipEvent (enterFrame) {
	grav++;
	_y += grav;
	while (_root.ground.hitTest(_x, _y, true)) {
		_y--;
		grav = 0;
	}
	if (_root.water.hitTest(_x, _y, true)) {
		if (grav>0) {
			grav *= slow;
		}
		speed = slowspd;
	} else {
		speed = setspeed;
	}
 

	if (Key.isDown(68)) {
		//if (Key.isDown(68)) means if "D" key is down move the mC at a speed of 'speed 
		_x += speed;
		_xscale = scale;
		//_xscale = scale; turns the mC 
		if (_root.ground.hitTest(_x, _y+3, true)) {
			this.gotoAndStop(1);
			//it goes and plays the walking animation
		} else {
			this.gotoAndStop(2);
		}
	} else if (Key.isDown(65)) {
		_x -= speed;
		_xscale = -scale;
		if (_root.ground.hitTest(_x, _y+3, true)) {
			this.gotoAndStop(1);
		} else {
			this.gotoAndStop(2);
		}
	} else {
		if (_root.ground.hitTest(_x, _y+3, true) && !Key.isDown(79) && !Key.isDown(73)) {
			this.gotoAndStop(3);
		}
	}
	if (Key.isDown(79) && !Key.isDown(87) && !Key.isDown(65) && !Key.isDown(68) && !Key.isDown(73)) {
		this.gotoAndStop(5);
	}
	if (Key.isDown(73) && !Key.isDown(87) && !Key.isDown(65) && !Key.isDown(68) && !Key.isDown(79)) {
		this.gotoAndStop(4);
	}
	if (Key.isDown(87) && _root.ground.hitTest(_x, _y+3, true)) {
		grav = -jumpHeight;
		_y -= 4;
		this.gotoAndStop(2);
	}
	if (_root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/2), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/6), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-_height, true)) {
		_x -= speed;
	}
	if (_root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/2), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/6), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-_height, true)) {
		_x += speed;
	}
	if (_root.ground.hitTest(_x, _y-_height-15, true)) {
		grav = 1;
	}
}
onClipEvent (enterFrame) {
	if (Key.isDown(Key.SPACE)) {
		attacking = true;
	}
	if (attacking){
		this.gotoAndStop(attacking);
		} else {
			this.gotoAndStop(stand);
}
}
Response to: Health Bar (as Seen In Sonny) Posted January 15th, 2012 in Game Development

First make a health bar and convert it into a symbol then make the animation on the health bar going down. Then you do the if and then statement.


I need somebody to fix this for me or basically explain whats wrong with it. Because right now I'm learning to script codes myself without copy and pasting crap, and when I try to make keys to do different animations when the user presses them. It doesn't play the animation at all.

onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
this._x -= 10;
this.gotoAndStop(3);
} else {
this.gotoAndStop(1);
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x += 10;
this.gotoAndStop(3);
} else {
this.gotoAndStop(1);
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
this._y -= 10;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.DOWN)) {
this._y += 10;
}
}

Please reply D: and also can somebody teach me how to code a wall?

Need help on Attacking code. Posted January 15th, 2012 in Programming

Okay, I need to know how I can make my character attack if I press the space button.. This is what I done so far inside the attacking animation of the character

onClipEvent (enterFrame){
if(Key.isDown(Key.SPACE)){
this._x = _root.char._x
this._y = _root.char._y
this.gotoAndPlay(attack);
}
else
{
this._y = _root.char._y
this._x = _root.char._x
this.gotoAndPlay(stand);
}
}


Hey newground users,
I'm a big noob on doing flash games, and I want to have a tutorial on making a enemy for platformer games because I got the movement,animation,and platform set but not the enemys because I want my platform game to be able to have enemys where u can jump on them and they die or press a certain key to attack the enemy and they lose health. I tried searching all over the web and theres no answer.
SO i'm asking you guys. Please :( I really want to know so i can have a little head start of game designing on flash

Enemies ? Help! Posted January 22nd, 2011 in Game Development

Hey,
I'm really new at this flash 8 thing. Its been like a week I been doing flash and I'm making a platform game, and I want to know how to add enemies in the game. I want me character to jump on the enemy like in super mario

How Do I add Enemies? Posted January 21st, 2011 in Programming

Hey,
I'm really new at this flash 8 thing. Its been like a week I been doing flash and I'm making a platform game, and I want to know how to add enemies in the game. I want me character to jump on the enemy like in super mario