Be a Supporter!
Response to: Walk Cycle Difficulties Posted June 10th, 2010 in Game Development

Walk cycles for sprites? That's even simpler than easy!

Go to Newgrounds Flash Tutorials They got some really good spriting tutorials, check them out.

Response to: The Copter - Game Help Posted June 9th, 2010 in Game Development

I'll try speeding up the pace of the game.

The graphics will certainly be improved.

And I want the enemies to randomly spawn from every side just outside the stage.

Thanks for the review... sort of though.

Response to: How do I make a level select Posted June 9th, 2010 in Game Development

Do it like this

var level1:Boolean = true;
var level2:Boolean = false;
var level3:Boolean = false;
...

if (char.hitTestObject(level1Goal)) {
level2 = true;
gotoAndStop("LevelSelect");
}

if(level2) {
level2_button.gotoAndStop("Unlocked")
}

I think that should work.

The Copter - Game Help Posted June 9th, 2010 in Game Development

Alright so I'm working on this game with a copter, the engine's almost ready but It still needs a few adjustments. Here's the game prototype in Super-Pre-Alpha-Beta-Omega-Testing-Phase . A, S, D to shoot and Arrow Keys to fly.

The game is in AS3 and I have lots of external classes, the main timeline doesn't have that much code.

What I need is to make enemies spawn from all sides behind the stage, I haven't found any comfortable way to achieve that.

Also can you tell me what you like about the game engine so far, what could be improved (how?) and what you don't like.

All help and criticism will be very much appreciated, thanks!

Response to: How do I do jumping in a sidescroll Posted June 9th, 2010 in Game Development

At 6/9/10 11:40 AM, HDXmike wrote:
At 6/9/10 11:29 AM, potatopower wrote: I am thinking about goin and getting a cracked cs3
Go dig a hole out in the woods, jump inside and just lay there, lay there and die.

Asshole.

As to the problem, can I see your .fla or .swf I'm still not sure what's going on in your flash.

Response to: How do I do jumping in a sidescroll Posted June 9th, 2010 in Game Development

Well, I need more info, is it AS2 or AS3 and what have you got so far.

Response to: How to keep the player in the cente Posted June 8th, 2010 in Game Development

Just use a vCam and point the vCams position to the characters position, like this.

vCam.x = char.x /* Assuming that the vCam has the instance "vCam" and the character has the instance "char" */
vCam.y = char.y

Search Google for flash vCam!

Response to: PlayerMc frames - Change? Posted June 8th, 2010 in Game Development

At 6/8/10 01:25 PM, Rapelsin wrote: Well if you want the char to face the direction he's moving towards just do this.

Add (assuming your char's instance is char)

char.rotation = // 0 for UP, 90 for LEFT, 180 for DOWN, 270 for LEFT

Simple as that.

I forgot, Add it to your Movement functions, under the named directions.

Response to: PlayerMc frames - Change? Posted June 8th, 2010 in Game Development

Well if you want the char to face the direction he's moving towards just do this.

Add (assuming your char's instance is char)

char.rotation =  // 0 for UP, 90 for LEFT, 180 for DOWN, 270 for LEFT

Simple as that.

Response to: x & y doesn't change on keyframes? Posted June 8th, 2010 in Game Development

Can you post the .fla, I'm not so sure I get the problem.

Response to: My school project: I'm confused Posted June 7th, 2010 in Game Development

Also you may want to improve the code a bit, make the player face where he's heading.

Add this to every KEY_DOWN function

PlayerMc.rotation = (0 = UP, 90 = RIGHT, 180 = DOWN, 270 = LEFT)

I'm in a helping mood in case you're wondering :D

Response to: My school project: I'm confused Posted June 7th, 2010 in Game Development

By the way, I just found out that you still have a little bug.

Change:

PlayerMc.x = -MoveSpeed;

to

PlayerMc.x -= MoveSpeed;

Have Fun!

Response to: My school project: I'm confused Posted June 7th, 2010 in Game Development

I found your problem.

PlayerMc.addEventListener(KeyboardEvent.KEY_DOWN, Down);
PlayerMc.addEventListener(KeyboardEvent.KEY_UP, Up);

That should be

stage.addEventListener(KeyboardEvent.KEY_DOWN, Down);
stage.addEventListener(KeyboardEvent.KEY_UP, Up);
Response to: My school project: I'm confused Posted June 7th, 2010 in Game Development

I found this while testing.

Scene 1, Layer 'Layer 3', Frame 1, Line 12 Warning: 1106: Empty statement found where block of code expected. Did you type ';' accidentally?

It still won't work though. I'm looking into it, shouldn't take long.

Response to: Mindblowing Flash HitTest problem Posted June 7th, 2010 in Game Development

At 6/6/10 10:28 PM, crapatflash wrote:
At 6/6/10 02:06 PM, Rapelsin wrote: You got any idea how to fix that, I'm not that big on AS :)
this post is completely unrelated, but i had to lol when you said that. yoiu've got code there that i can't even start to decipher, don't be so modest :P

Thing is I'm using another person's code, I think it was Grant Skinner's PixelPerfectCollisionDetection ported to AS3. The first code is me though :)

Response to: Mindblowing Flash HitTest problem Posted June 6th, 2010 in Game Development

At 6/6/10 01:50 PM, GustTheASGuy wrote: It looks like it only works in a rectangular area. You must be drawing a fixed part of the world to the bitmapdata you use for collision.

You got any idea how to fix that, I'm not that big on AS :)

Response to: Need an artist for my project. Posted June 6th, 2010 in Collaboration

At 6/6/10 01:19 PM, pierro118 wrote:
At 6/6/10 01:16 PM, Rapelsin wrote: Hey, I like to draw! I'd really like to try and make the art for this one, got any specifications where I should start?
Maybe by the logo? That could show me what you can do. As you saw in the description, it have to be 450x300 pixels and must look like a Phoenix Wright title.

The complete name of the game is "Phoenix Wright : Tails Abuse". Thanks for helping me out!

Alright, time to get creative! By the way it would be much easier to talk over real-time chat, is it MSN, ICQ or whatever, if that's okey with you.

Response to: Need an artist for my project. Posted June 6th, 2010 in Collaboration

Hey, I like to draw! I'd really like to try and make the art for this one, got any specifications where I should start?


This little problem blows, at least my mind. First of all here's my code.

import com.asgamer.helicopter.PixelPerfectCollisionDetection
import com.asgamer.helicopter.Helicopter
import flash.events.Event;

var heli:Helicopter = new Helicopter(stage);
			addChild(heli);

addEventListener(Event.ENTER_FRAME, frame)
			
		function frame (e:Event) {
	
	vCam.y = heli.y
	
	if ( PixelPerfectCollisionDetection.isColliding( heli, walls, this, true, 1))
	 {
		debug_txt.text = "Hit!"
	}
	else
	{debug_txt.text = "Not Hit!" }
}

And here's my prototype http://megaswf.com/view/1c312c72844d78df e72f6e61e757ed0e.html

The problem is that technically it should display "Hit!" whenever it touches any of the grey space, for some reason it won't work for the bigger block of grey in the bottom.

I'm using this PixelPerfect Detection.

package com.asgamer.helicopter
{
	import flash.display.BitmapData;
	import flash.display.BitmapDataChannel;
	import flash.display.BlendMode;
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.geom.Matrix;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	public class PixelPerfectCollisionDetection
	{
		/** Get the collision rectangle between two display objects. **/
		public static function getCollisionRect(target1:DisplayObject, target2:DisplayObject, commonParent:DisplayObjectContainer, pixelPrecise:Boolean = false, tolerance:Number = 0):Rectangle
		{
			// get bounding boxes in common parent's coordinate space
			var rect1:Rectangle = target1.getBounds(commonParent);
			var rect2:Rectangle = target2.getBounds(commonParent);
			// find the intersection of the two bounding boxes
			var intersectionRect:Rectangle = rect1.intersection(rect2);
			if (intersectionRect.size.length> 0)
			{
				if (pixelPrecise)
				{
					// size of rect needs to integer size for bitmap data
					intersectionRect.width = Math.ceil(intersectionRect.width);
					intersectionRect.height = Math.ceil(intersectionRect.height);
					// get the alpha maps for the display objects
					var alpha1:BitmapData = getAlphaMap(target1, intersectionRect, BitmapDataChannel.RED, commonParent);
					var alpha2:BitmapData = getAlphaMap(target2, intersectionRect, BitmapDataChannel.GREEN, commonParent);
					// combine the alpha maps
					alpha1.draw(alpha2, null, null, BlendMode.LIGHTEN);
					// calculate the search color
					var searchColor:uint;
					if (tolerance <= 0)
					{
						searchColor = 0x010100;
					}
					else
					{
						if (tolerance> 1) tolerance = 1;
						var byte:int = Math.round(tolerance * 255);
						searchColor = (byte <<16) | (byte <<8) | 0;
					}
					// find color
					var collisionRect:Rectangle = alpha1.getColorBoundsRect(searchColor, searchColor);
					collisionRect.x += intersectionRect.x;
					collisionRect.y += intersectionRect.y;
					return collisionRect;
				}
				else
				{
					return intersectionRect;
				}
			}
			else
			{
				// no intersection
				return null;
			}
		}
		/** Gets the alpha map of the display object and places it in the specified channel. **/
		private static function getAlphaMap(target:DisplayObject, rect:Rectangle, channel:uint, commonParent:DisplayObjectContainer):BitmapData
		{
			// calculate the transform for the display object relative to the common parent
			var parentXformInvert:Matrix = commonParent.transform.concatenatedMatrix.clone();
			parentXformInvert.invert();
			var targetXform:Matrix = target.transform.concatenatedMatrix.clone();
			targetXform.concat(parentXformInvert);
			// translate the target into the rect's space
			targetXform.translate(-rect.x, -rect.y);
			// draw the target and extract its alpha channel into a color channel
			var bitmapData:BitmapData = new BitmapData(rect.width, rect.height, true, 0);
			bitmapData.draw(target, targetXform);
			var alphaChannel:BitmapData = new BitmapData(rect.width, rect.height, false, 0);
			alphaChannel.copyChannel(bitmapData, bitmapData.rect, new Point(0, 0), BitmapDataChannel.ALPHA, channel);
			return alphaChannel;
		}
		/** Get the center of the collision's bounding box. **/
		public static function getCollisionPoint(target1:DisplayObject, target2:DisplayObject, commonParent:DisplayObjectContainer, pixelPrecise:Boolean = false, tolerance:Number = 0):Point
		{
			var collisionRect:Rectangle = getCollisionRect(target1, target2, commonParent, pixelPrecise, tolerance);
			if (collisionRect != null && collisionRect.size.length> 0)
			{
				var x:Number = (collisionRect.left + collisionRect.right) / 2;
				var y:Number = (collisionRect.top + collisionRect.bottom) / 2;
				return new Point(x, y);
			}
			return null;
		}
		/** Are the two display objects colliding (overlapping)? **/
		public static function isColliding(target1:DisplayObject, target2:DisplayObject, commonParent:DisplayObjectContainer, pixelPrecise:Boolean = false, tolerance:Number = 0):Boolean
		{
			var collisionRect:Rectangle = getCollisionRect(target1, target2, commonParent, pixelPrecise, tolerance);
			if (collisionRect != null && collisionRect.size.length> 0) return true;
			else return false;
		}
	}
}

Any help will be very much appreciated, thanks!

Response to: First Game!!! Posted June 6th, 2010 in Game Development

Aaand the point of this post is ... ?

Don't spam the board with crap please, thanks!

Response to: First Game!!! Posted June 6th, 2010 in Game Development

Aaand the point of this post is ... ?

Don't spam the board with crap please, thanks!

Response to: Animation Dots Posted June 6th, 2010 in Game Development

At 6/6/10 10:56 AM, JoeTheToucan wrote: Solved the problem. For some reason deleting a third layer I had which was a small white blob covering part of my image got rid of all the imperfections.

Thanks for the input though, man.

Glad you figured it out!

Response to: Animation Dots Posted June 6th, 2010 in Game Development

Have you tried re-animating, completely from scratch? Or you could try breaking or tracing the bitmap (Break: Mac OS - Cmd + B, Win - Ctrl + B Trace - Modify > Bitmap > Trace Bitmap)

Response to: Animation Dots Posted June 6th, 2010 in Game Development

First of all how did you animate it, it seems they are the dots of the pen tool.

Response to: As Quiz? Posted June 6th, 2010 in Game Development

At 6/5/10 11:23 PM, Nano256 wrote: Flash has a built in quiz: compiling.

If Flash throws errors at you when you export, then you made a mistake with the code.

Yes, Flash does have a quiz system, but I always like to make my own as it's not hard at all to create one. Miking your own also gives you more space for creativity. To my knowledge Quizes consist of only buttons so the coding shouldn't be that difficult, I recommend AS3.

Response to: flash side scrolling platformer Posted June 5th, 2010 in Game Development

Alright, I noticed you copied the platformer code from kirupa.org, not good. The main aim of tutorials is to help you learn, not to give you scripts to copy. I imagine you ripped the graphics from somewhere too. Anyway first step would be to learn AS3 coding, the world is moving to AS3 aswell. To get started google "as3 basics" or something like that. Then start off with easier games, like quizes and move on to more complex games like platformers.

Here's a quick example of simple AS3.

button.addEventListener(MouseEvent.CLICK, clicked)

function clicked (e:Event)
{
trace("Clicked!")
}

Now when you click the movie clip "button" the output panel should display "Clicked!"
It's not really that hard, I find it even more logical than AS2.
If you truly want to learn, then by the end of this day you can write something similiar in AS3. Make your mom proud!

Response to: As3: Keyboard Events For Newbies Posted June 1st, 2010 in Game Development

Thanks, it really helped understand the concept of Key Events. Thanks again!