Recent posts by evan999333 on Kongregate

Flag Post

Topic: Game Programming / How To Use Regular Expressions

Wow! I was totally over thinking it, thank you feartehstickman that works like a charm. I ended up figureing out how to do part 2 but just for fun I’ll post what it is and what I did.

Basicly I want it so when I click it will add an addition row 1 from the end on the old Vector

Ex.


[1,1,1,1,1,
1,0,0,0,1,
1,0,0,0,1,
1,0,0,0,1,
1,1,1,1,1]

Becomes

[1,1,1,1,1,1,
1,0,0,0,0,1,
1,0,0,0,0,1,
1,0,0,0,0,1,
1,1,1,1,1,1]

Here is what I came up with

private function addExtraTileToRight(e:MouseEvent):void
{
compensateForSpliceOffSet = 0
vectorLength = tileVector.length
// aEW = Add Extra Width
for (var aEW=0; aEW<vectorLength; aEW++)
{
if (aEW!=1)
{
if (aEW%totalTileToMakeWidth == 1)
{
// Add New Line As 0
tileVector.splice(aEW-2+compensateForSpliceOffSet, 0, 0);
compensateForSpliceOffSet++;
}
}
}
// Update The Level Width
totalTileToMakeWidth++;
// Make New Top Tile A Border
tileVector[totalTileToMakeWidth-2] = 1
// Make New Bottom Tile A Border
tileVector.splice((vectorLength-1+compensateForSpliceOffSet+compensateForSpliceOffSet), 0, 1);
// Runs your function and updates the text
updateLevelTextBox()
}

Thanks again.

Now its time to do the same thing but deleting a row.

However if anyone who understands how the RegExp functions and could explain it in simple terms somehow I would appreciate it for learning purposes.

 
Flag Post

Topic: Game Programming / How To Use Regular Expressions

Before I begin I would like to point out that I would much prefer to find a way to do this with a vector, but the example I found uses an Array. I would also like to say that I have looked at various sites and a lot of the information about “RegExp” is very confusing and that is why I have come to the forum.

I hope to accomplish 2 things.

First, I want to convert a Vector (or Array) from a single string of numbers into a string with appropriate breaks.


private var tileVector:Vector. = Vector.([1,1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,1,1,1,1]

or

private var tileVector:Vector. = Vector.([1,1,1,1,1,
1,0,0,0,1,
1,0,0,0,1,
1,0,0,0,1,
1,1,1,1,1]

Should output in a textbox as

1,1,1,1,1,
1,0,0,0,1,
1,0,0,0,1,
1,0,0,0,1,
1,1,1,1,1

I found this thread http://stackoverflow.com/questions/1531384/converting-an-array-into-a-string-in-as3 and an example on that thread is


var a:Array=[[0,0,0,0,0,0],[1,1,1,1,1,1],[2,2,2,2,2,2],[3,3,3,3,3,3],[4,4,4,4,4,4],[5,5,5,5,5,5]];
var columns:int=11;//columns count
trace(a.toString().replace(new RegExp(“(.{”+columns+"})(,?)“,”g"),“$1\n”));

I tried using this for my example above (both making it a Vector and Array) however my Vector/Array was 50 characters per row instead of 5 and 21 columns. What I found was that the “columns” var seemed completely arbitrary. Putting in 21 columns for my Vector output my vector with a break every 10 numbers. I tried putting in the row count of 50 and that didn’t work either, but from playing around I found out that putting in 100 for the “columns” outputted what I want. The problem however is that part 2 of what I hope to accomplish involves the row length getting larger so a static 100 wont work.

What I hope is that someone can help me figure out some kind of formula (using RegExp or not) that will be able to output my Vector (or an Array) as a string with breaks depending on a variable width (number of characters per line) of the Vector (or Array.)

As another note (if it helps) the Vector (or Array) will always be 21 lines but as I said the number of characters per line is going to become variable in part 2 of this problem.

Thank you in advance for any help of suggestions you can provide.

 
Flag Post

Topic: Game Programming / [AS3] RIGHT_MOUSE_UP

The point of it being added to the stage is that because of what this function does. The RIGHT_MOUSE_DOWN can move the mapHolder image off the screen so the RIGHT_MOUSE_UP function needs to fire when the right mouse button is released anywhere on the file. Additionally I have tested it when there is no other item on the frame blocking the mouse from hitting the direct stage and it also doesn’t explain how what I currently have works when launched in the swf from the folder but not when I test movie in flash. I think the only explanation is that something is messed up with flash player somewhere.

 
Flag Post

Topic: Game Programming / [AS3] RIGHT_MOUSE_UP

Oh well I just discovered that if I launch the swf from the folder and not as a test movie in flash it works fine… What the heck could cause it to work fine when launched as a swf as oppose to tested in flash and what do you think I could to do fix this?

I also found this reply to a thread http://stackoverflow.com/questions/12175515/as3-mouseevent-right-mouse-up-doesn’t-work but using older versions doesn’t change it in flash player I’v tried from 10.3-11.7

Hrmmmmmm.

 
Flag Post

Topic: Game Programming / GiTD #36 Concluded, congratulations Moocowsgomoo!

There have been as many votes as days of voting thus far. What’s happening with the GitD?

There wasn’t that many entries for this one. Personally I didn’t find this theme that interesting but I can’t say much about that as I didn’t bother to think up any suggestions for the theme thread when it was made. I hope I’ll be able to give a few good ones for #37 and take part in it.

 
Flag Post

Topic: Game Programming / [AS3] RIGHT_MOUSE_UP

Player if I do that exactly 1 trace of “rightMouseDown” outputs.

If I comment out the others to find which statement it is, the statement that works is unsurprisingly


stage.addEventListener(MouseEvent.RIGHT_MOUSE_DOWN, onMouseEvent);

Much like the only one that works in my other document. Very strange that it’s working this way.

 
Flag Post

Topic: Game Programming / [AS3] RIGHT_MOUSE_UP

I actually do have a background image but I did not know that mouseEvents don’t register on an empty stage. The image was not added through code however it was just placed on the stage. I tried adding from the library instead and this had no change on the result.

Any other ideas?

 
Flag Post

Topic: Game Programming / [AS3] RIGHT_MOUSE_UP

From some reason I cant get a function to fire after the right mouse button is up.

// Removes The Right Click Screen
stage.addEventListener(MouseEvent.RIGHT_CLICK, function(e:Event){});
// Right Mouse Up Function That's Not Working
stage.addEventListener(MouseEvent.RIGHT_MOUSE_UP, rightMouseIsUp);
// Diffrent Function Added To A Sprite That Happens on RightMouseDown and works just fine
mapHolder.addEventListener(MouseEvent.RIGHT_MOUSE_DOWN, startMapDrag)	
private function startMapDrag(e:MouseEvent):void
{
	trace("Works") // This does output
	currentlyDraggingMap = true
	mapHoldDragStartX = stage.mouseX + mapHolder.x
	mapHoldDragStartY = stage.mouseY + mapHolder.y
	mapHolder.addEventListener(MouseEvent.MOUSE_MOVE, mouseMapMovement)
}	
private function rightMouseIsUp(e:MouseEvent):void
{
	trace("Why Wont This Trace") // Doesn't Output
	if(currentlyDraggingMap == true)
	{
		mapHolder.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMapMovement)
		currentlyDraggingMap = false
	}
}

Is there some other way I have to go about this. I have the right mouse down happening on the object but when it is moved it is possible for the mouse to not be released over that same object so I need the RIGHT_MOUSE_UP to fire whenever and wherever the right-mouse is released on the stage.
 
Flag Post

Topic: Game Programming / Mochi Leaderboards Rules

Alright cool thats what I thought but I wanted to make sure, thank you.

 
Flag Post

Topic: Game Programming / Mochi Leaderboards Rules

I don’t really know what forum is most applicable for a questions like this but I figure one with a lot of people who have uploaded games would do.

When uploading a game we have to check a box that mentions that “your games does not contain Mochiads, CPM, etc” But are we allowed to upload games to Kongregate with the various Mochi API’s such as analytics tracking and leaderboards?

 
Flag Post

Topic: Game Programming / Map Construction

Awhile back I posted the source for some a* code that used a 1 dimensional array, you might be able to gather somewhat of an understanding from it. Or at least check out this link http://www.policyalmanac.org/games/aStarTutorial.htm if you want to get started on your own. I had to re read the info there about 3 or 4 times but then it all clicked.
http://www.kongregate.com/forums/4-game-programming/topics/333826-a-star-pathfinding-as3-example

 
Flag Post

Topic: Collaborations / I am a programmer looking for a talented Vector artist.

Hello, my name is Evan and I have been using flash for over nine years and programming with Actionscript 3 for over four years.

Quite a few months ago I used this forum to find a partner who was dedicated enough, patient enough, and experienced enough to help me create a great game called Loot Hero, which we completed and are currently looking for sponsorship for. (If you would like to view this game a trial version is availble on this page https://www.fgl.com/view_game.php?from=dev&amp;game_id=29440)

Unfortunately he is going to school and will be unable to help me with the development of my next game, so I am seeking an artist who can equal or exceed my previous partners amazingness, and I know your out there!

The game I will be developing is an ambitious project that I expect to take several months to complete. A lot can happen in that time for me and yourself, and so I ask that you please not respond to this thread unless you are prepared to make a commitment to the creation and more importantly the completion of this game.

Features and overview of the game:
Action/Rpg – I will be implementing a weapon and spell system that will force the player to make a choice when choosing what weapon to use, not based solely on stats, but also on the way they act. For instance a hammer might attack slower but knock enemies back, a sword might attack faster and have only a moderate knockback, and a dagger would attack very quickly but be unable to knock back enemies. This a basic explanation of a feature that can be expanded to piercing weapons causing enemies to bleed, while bludgeoning weapons could stun enemies for a short time.
As for the Rpg portion I am very creative and I have experience writing quests and creating worlds from my passion of being a Dungeons and Dragons Dungeon Master, I feel confident in creating an interesting story that will make players want to finish the game.

Tile based – The game will be tile based which means that as an artist you will be tasked with making not tens, but hundreds of different tile variations to fit stylistically with the locations of the adventure, as well as background to fill up the empty space and set the tone for the area the player is in.

Enemy Variety – Fighting the same enemy over and over is never fun and I plan on stretching my limits with the AI in this game. Loot Hero had some interesting looking enemies and very cool looking bosses, each with their own strength and weaknesses, and some with special abilities. I believe that I will be able to use my ideas from my experience creating Loot Hero to create interesting encounters on every screen, you job will be to create the visuals of enemies and special effects.

Loot and Crafting – If you checked out the link to Loot Hero, you can probably tell that I like game with lots of items. This game is no exception. Although note very enemy may drop and item in this game I plan to implement randomly generated loot using a rarity system similar to loot hero, but I will include special effects of weapons such as lifesteal, improved knockback, elemental damage, etc. I also hope to implement a crafting system, and although I have never attempted a crafting system in a game before I look forward to the challenge.

UI and Animation – Personally I dislike programming User Interfaces and although I have experience creating them, I will rely on your artistic experience to influence the development of the UI, creating a system that will keep the players attention in the right areas at the right times. As for animation, I have used flash for many years and in that time I believe I have become somewhat capable with the majority of the animation tools flash as to offer, however I am looking for someone who feel very comfortable with creating their own animation in flash.

Vector – This is very important I am only seeking a partner who is a vector artist for this project.

If you have read this far I thank you for taking the time to do so, and if you think that you have the experience, dedication, and patience to develop hundreds, possible thousands of art assets to finish this project, I promise you to make you pixels do things that result in a great game.

If you are interested please email me at evanasand@gmail.com with a portfolio of examples of your artwork or past projects.

In addition to whats above I would like to stress that although the game, and its features will be designed by me, I would like to hear your thoughts and additions throughout the development process, by no means and I asking for you to just be a machine that pumps out art that I want. I was surprised by the stunning creativity of my previous partner every time he sent me his work. I also of course am not asking you to do this for free, a sizeable percentage of the game sponsorship will be split between us, the exact amount will be discussed through email after I view your portfolio and get to know you.

Finally I would like to make it clear that I will not be requiring any artwork for at least 3 more weeks while I continue to create the framework for the game, thats not to say that if you message me with an amazing portfolio earlier than that, that we can’t get started.

- Evan999333 Programmer – Pargamer

 
Flag Post

Topic: Game Programming / Question about Keyframes/Tweens

Alright thank you.

 
Flag Post

Topic: Game Programming / Question about Keyframes/Tweens

Alright well that answers the question really. Single frames require less work than tweens, thank you.

I have experimented with coding tweens and it always looks really messy, and it usually is pretty unnecessary but I just wanted to figure out which would be better to use as my current project involves many objects moving on the screen that are animated, but the animation looks the same when I use a tween and when I don’t. Even though its not noticeable either way at this stage it could come into affect later and I’d like to use the better practice.

Thanks again Ace_Blue

Bonus Questions:

For fading wouldn’t it be better to code something like “object.alpha -= 0.01” than do an animation/tween.

As for NineFiveThree, out of curiosity – what application is it better to use tweens over single frames in?

 
Flag Post

Topic: Game Programming / Question about Keyframes/Tweens

Is there any advantage to using tweens over a purely frame by frame animation or vise versa. Does one or the other tend to make flash work harder and slow it down?

 
Flag Post

Topic: Game Programming / GiTD #34 Has begun, the theme is "Creation/destruction"

I did some brainstorming and came up with a pretty cool idea I think. I don’t know if it will win, but if I finish it, it will be fun!

 
Flag Post

Topic: Game Programming / [AS3] Tile Based HitTestPoint Strange Effect

Well the gravity accumulates. The variable "falling " is set to true every frame and gravity only stops growing and gets reset to 0 when the player is hitting a top side of a tile. If you are suggesting that I make gravity have a constant base value highers than the speed of the player that would mean that flash is executing the while statement of y— to move the player up many more times per frame and although thats not a big deal now it could slow down the game with more objects using the same code.

I really think the problem lies in the fact that I need to use the +1 and -1 to make that slight extra offset for the player, but I have no idea why.

 
Flag Post

Topic: Game Programming / [AS3] Text Input Guidance

Create a new .fla document and in properties under class put the word “Main”

Create a input text box near the top with the instance name “playerNameText”

Create another text box but set this to “dynamic text” and give it the instance name “playerNameDisplayText”

Now create a new .as file and save it in the same location as your .fla and put the following code in.

package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	public class Main extends Sprite
	{
		var playerName:String
		public function Main()
		{
			createDoneButton();
			playerNameText.text = "<Insert Player Name>"
		}
		private function createDoneButton():void
		{
			var doneButton:Sprite = new Sprite();
			addChild(doneButton);
			doneButton.graphics.lineStyle(3,0x000000);
			doneButton.graphics.beginFill(0x0000FF);
			doneButton.graphics.drawRect(0,0,100,100);
			doneButton.graphics.endFill();
			doneButton.x = stage.stageWidth / 2 - doneButton.width / 2;
			doneButton.y = stage.stageHeight / 2 - doneButton.height / 2;
			doneButton.buttonMode = true
			doneButton.addEventListener(MouseEvent.CLICK, doneButtonClicked)
		}
		private function doneButtonClicked(e:MouseEvent):void
		{
			playerName = String(playerNameText.text)
			playerNameDisplayText.text = "Your Name: "+playerName
		}
	}
}

Now test your movie.

The code above made a big square in the middle, you can type whatever you want into the “input” text box and when you press the button that text is saved into the “playerName” variable and put into the dynamic text box.

It really quite simple – I hope this helped.

 
Flag Post

Topic: Game Programming / [AS3] Tile Based HitTestPoint Strange Effect

I just made a little tile based grid and put all the tiles into a movieclip called “levelHolderVar”

I then created a player with some simple keyboard movement and I have this as an onEnterFrame event.

var currentObject:Object = playerVar;
			if (currentObject.jumping == true && currentObject.canClimbNow == false)
			{
				currentObject.y -=  currentObject.jumpingSpeed;
				if (currentObject.jumpingSpeed > -12)
				{
					currentObject.jumpingSpeed--;
				}
			}
			if (currentObject.falling == true && currentObject.jumping == false)
			{
				if (currentObject.gravity < 15)
				{
					currentObject.gravity++;
				}
				currentObject.y +=  currentObject.gravity;
			}
			// Player Start Falling Always
			currentObject.falling = true;
			// While Statements Are Wall Collision Detection
			// Collide With Top Side
			while (levelHolderVar.hitTestPoint(currentObject.x, currentObject.y + currentObject.radius-1, true))
			{
				currentObject.y--;
				currentObject.falling = false;
				currentObject.jumping = false;
				currentObject.gravity = 0;
			}
			// Collide With Bottom Side
			while (levelHolderVar.hitTestPoint(currentObject.x, currentObject.y - currentObject.radius, true))
			{
				currentObject.y++;
				// Stops The Jump Short
				currentObject.jumpingSpeed = 0;
			}
			// Collide With Right Side
			//trace(currentObject.falling)
			while (levelHolderVar.hitTestPoint(currentObject.x - currentObject.radius+1, currentObject.y, true))
			{
				currentObject.x++;
			}
			// Collide With Left Side
			while (levelHolderVar.hitTestPoint(currentObject.x + currentObject.radius, currentObject.y, true))
			{
				currentObject.x--;
			}

The result is this
http://www.fastswf.com/YRCZTgs
(AD to move W to jump)

Looks alright but the problem is if you go up the ramp sloping down to the left the player slides down, while on the right side the player does not slide down (which I want.)

I found out that by changeing the


// Collide With Top Side
while (levelHolderVar.hitTestPoint(currentObject.x, currentObject.y + currentObject.radius-1, true))
{

To


// Collide With Top Side
while (levelHolderVar.hitTestPoint(currentObject.x, currentObject.y + currentObject.radius, true))
{

(Removeing the -1)
I can make the player not slide down either slope
http://www.fastswf.com/V0FazHE

But this makes it so the player is 1px above the normal flat tiles.

Does anyone know what I can do to make the player not slide down the left slope, or what did I do that made the player not slide down the right slope, or why I need to add the off set of -1px and +1 px for the top and left side collisions in the first place?

 
Flag Post

Topic: Game Programming / GiTD #34 Has begun, the theme is "Creation/destruction"

I think

Originally posted by VBCPP:
-No Controls

Would be an interesting challenge.

 
Flag Post

Topic: Game Programming / GiTD Rule Change Voting! Voting ends 7/7/13 6PM GMT

I think G is the best option but it should be paired with D if I had to pick one I’d leave it at G but I think that getting feedback on a game is the most important part.

 
Flag Post

Topic: Game Programming / [AS3] mouseEnabled Just Doesn't Work

I can’t really post the whole code, as much of it doesn’t affect this problem.

I use object because I don’t know another way of creating a variable reference to the stage other than this. However I realized that I don’t need to make a variable reference in this manner and can just do stage.mouseChildren = false/true. I have no idea what made me think to make a reference to the stage in a variable form like that.

I use the vector because in the actual game there are many object that have the same code, I disabled it over the course of this thread, but now that its working for one its working for the whole vector.

I think that your examples helped me see how the mouseChildren actually works, so thank you NineFiveThree.

 
Flag Post

Topic: Game Programming / [AS3] mouseEnabled Just Doesn't Work

Well I’v managed to do something that made it work.

When creating the object that is added to the vector I send a reference to the stage into the class file of the object decaled as


public var parentObject:Object

When in the same class file I disable mouseChildren like this

parentObject.mouseChildren = false

The object is “ignored.”

Stragely enough I can’t simply do


parent.mouseChildren = false

Because it doesn’t work.

 
Flag Post

Topic: Game Programming / [AS3] mouseEnabled Just Doesn't Work

Like I said at the start of all this I tried using mouseChildren = false

I don’t get what is wrong with what I am doing. The only difference I can really see between the function of my code to yours is that you’re using drawn objects and I am using movieclips, but that shouldn’t make the enabled/disable not work.

 
Flag Post

Topic: Game Programming / [AS3] mouseEnabled Just Doesn't Work

I tried your example, and it works, my mouse registers as clicking the stage.

But in my game when I set an objects mouseEnabled to false, and i set up a trace statement and it traces as false, the object CAN still be clicked.

So ignoring the code I posted before, if I have an event on the object that had its mouseEnabled set to false, I can still click it and run that event.

(also both objects in the trace are the same because they are the exact same Object reference in the loop.)