Recent posts by Aesica on Kongregate

Flag Post

Topic: Game Programming / Question about arrays

Yeah oops, forgot a period. I’ll edit my post. Anyway vectors are basically arrays, except they’re faster and can only be made up of the specified data type (Number in this case) rather than anything. If you’re more comfortable with arrays, you could certainly use one instead to get the same result, although I find the extra strictness nice because it makes things easier to debug.

 
Flag Post

Topic: Game Programming / Question about arrays

Simple data types (which includes numbers, ints, uints, etc) are always by value rather than by reference. Consider changing your approach to do away with individual powerFire, PowerIce, and powerElect variables entirely, because with an array (or vector) they’re really not needed at all. I usually approach such things like this:

// this is the closest you can get in AS3 to enumeration
private static const TYPE_FIRE:int = 0;
private static const TYPE_ICE:int = 1;
private static const TYPE_ELEC:int = 2;

private var power:Vector.<Number> = new <Number>[0, 0, 0];

// ...then, to access/change/etc:

power[TYPE_ICE] = 3; // setting ice's power to 3
 
Flag Post

Topic: Game Programming / [Solved] Rotation with bitmapData.draw blows

Thank you so much. All I've ever been able to do with matrices is get them to rotate based on upper-left registration, which is useless (but not as useless as clipRect!). I had no idea you could do what is basically moving them to the center, rotating, and then moving them back like that.

With the following changes, it works perfectly. :D

				iTempWidth = ssSpriteSheet.aSpriteRect[iAppearanceID].width;
				iTempHeight = ssSpriteSheet.aSpriteRect[iAppearanceID].height;
				bmpNew = new BitmapData(iTempWidth, iTempHeight, true, 0);
				bmpNew.copyPixels(ssSpriteSheet.bmpSpriteSheet, ssSpriteSheet.aSpriteRect[iAppearanceID], ZERO_POINT, null, null, true);
				oMatrix = new Matrix();
				oMatrix.translate(iTempWidth * -0.5, iTempHeight * -0.5);
				oMatrix.rotate((iNewDirection + 90) * PIForRadians);
				oMatrix.translate(iTempWidth * 0.5, iTempHeight * 0.5);
				bmpRotationCache = new BitmapData(iTempWidth, iTempHeight, true, 0);
				bmpRotationCache.draw(bmpNew, oMatrix);
 
Flag Post

Topic: Game Programming / [Solved] Rotation with bitmapData.draw blows

So I'm working on a thing that's primarily rendered through copyPixels and everything is smooth, fantastic, etc. However, I need to be able to rotate things--enemies, bullets, misc particles, whatever. This is where draw (my only real option?) comes in. Unfortunately, rotating with draw seems to be some kind of nightmare, which (according to my failed search attempts) I'm not alone in sharing and that I have yet to find a proper solution for. (maybe I just suck at searching?)

Anyway, I eventually came up with this, uh, "solution." I don't need to explain why it's a fairly disgusting one, and I'd really like to find a better way to do this.

		public function SetVelocity(iNewSpeed:Number, iNewDirection:Number):void
		{
			var bmpNew:BitmapData;
			var mNew:Bitmap;
			var mRotateMe:Sprite;
			var mOuterContainer:Sprite;
			var iTempWidth:int;
			var iTempHeight:int;
			
			if (bRotateWithDirection && iDirection != iNewDirection)
			{
				iTempWidth = ssSpriteSheet.aSpriteRect[iAppearanceID].width;
				iTempHeight = ssSpriteSheet.aSpriteRect[iAppearanceID].height;
				bmpNew = new BitmapData(iTempWidth, iTempHeight, true, 0);
				bmpNew.copyPixels(ssSpriteSheet.bmpSpriteSheet, ssSpriteSheet.aSpriteRect[iAppearanceID], ZERO_POINT, null, null, true);
				mNew = new Bitmap(bmpNew);
				mRotateMe = new Sprite();
				mOuterContainer = new Sprite();
				mRotateMe.addChild(mNew);
				mOuterContainer.addChild(mRotateMe);
				mNew.x = iTempWidth * -0.5;
				mNew.y = iTempHeight * -0.5;
				mRotateMe.x = iTempWidth * 0.5;
				mRotateMe.y = iTempHeight * 0.5;
				mRotateMe.rotation = iNewDirection + 90;
				bmpRotationCache = new BitmapData(iTempWidth, iTempHeight, true, 0);
				bmpRotationCache.draw(mOuterContainer, oMatrix);
			}
			
			iDirection = iNewDirection;
			iSpeed = iNewSpeed;
			vx = Math.cos(iDirection * PIForRadians) * iSpeed;
			vy = Math.sin(iDirection * PIForRadians) * iSpeed;
		}
Any thoughts on how to rotate things via draw in a way that avoids kind of ridiculous, bloated nonsense?
 
Flag Post

Topic: Rise of Mythos / Make a Card (Discussion)

Just showing my World of Warcraft pride! Because boredom, etc:

 
Flag Post

Topic: Game Programming / Will it be possible to export AS3 to HMTL5?

My only real complaint is that dealing with XML objects in haxe is utterly loathesome compared to AS3's fairly-graceful E4X implementation. While I found this, the performance numbers for flash are nothing to write home about.
 
Flag Post

Topic: Game Programming / Best Way to format numbers? (show in thousands, millions, etc.)

Originally posted by Draco18s:

Use switch rather than if…else if… blocks.

Besides personal preference, is there really a reason to favor switch over if/else if blocks when possible? I always thought switch statements compiled into if/else, but I could be wrong. Besides, switch generally feels like a less-flexible if/else block, so I never use it. That aside, Ace_Blue’s array method is what I’d favor for this particular example anyway, only with a vector instead of array.

Edit: Isn’t it considered bad practice to have multiple return statements in the same function?

 
Flag Post

Topic: Game Programming / Will it be possible to export AS3 to HMTL5?

Originally posted by AMD_Paulius_J:

Aesica, have you used it? and maybe you could explain in short terms what does openfl do? because as i understand it’s not a plugin for flash, it’s a separate platform which uses Haxe as it’s primary language. But i want to find out if it will be possible to create games in flash IDE and export them to HTML5, mainly because building in flash IDE is extremely efficient.

Doh, player_03 beat me to it. While I don’t use the flash IDE at all and can’t speculate on how it will feel or work from that perspective, in FlashDevelop, it’s quite similar to working with traditional AS3 with only a few minor quirks. (UInt instead of uint, public function new() instead of public function MyClass(), for example.) Accessing your assets seems a little weird at first too, but then again I think flash CS users do it differently than FD users anyway, so who knows?

 
Flag Post

Topic: Game Programming / Will it be possible to export AS3 to HMTL5?

In a sense, yes.

 
Flag Post

Topic: Game Programming / 3D model search engine

That’s really cool. Seriously. :D However, I do want to say this…

Originally posted by Draco18s:

Really sweet. My only suggestion is to not add more content to the bottom of the page as you scroll down. There’s a point at which the browser will become unresponsive, so it limits how deep a search a user can perform and there is no workaround.


I couldn’t agree more. It really bothers me that the latest trend in web development is to keep piling on more content as the user reaches the bottom of a page rather than giving the user a reliable means to flip between page 1, 2, 3, …n etc.

 
Flag Post

Topic: Game Programming / [Solved] Textfield doesn't show.

Declaring a textformat directly through the constructor is fine, I use embedded fonts and do it like that all the time. antiAliastType just makes it look prettier. OP, it likely has to do with your embed tag—I notice right away you don’t have entries for fontName or mimeType. If you copypast Kewry’s embed code and then replace the relevant fields with your own data, it should work.

Also, try setting the text after you get everything else all set up how you want it.

 
Flag Post

Topic: Game Programming / Suggest a game!

Originally posted by Draco18s:
Originally posted by AntonioS2740:
Originally posted by player_03:

Suggesting ideas is not going to lead to getting more games. Ideas are a dime a dozen. If you really want more games, make them yourself.

This thread is to suggest games. Please do not get mad.

because suggestions are dumb. No one is going to take up your idea just because you suggested it. I have 10,000 ideas for games already, as does*every other developer.* none of them is going to go, "yeah, i like that guy’s suggestion more. "

Not only this, but I (and this is likely true of every single developer out there) am more interested in bringing my ideas to life than someone else’s.

 
Flag Post

Topic: Game Programming / How can you get Developer

Originally posted by darkjonas8:

Please dont just upload troll game just so you can call yourself a dev…

This is why I wish the “D” tag wasn’t even visible.

 
Flag Post

Topic: Rise of Mythos / another inventory page

^ Unless those pages are being given to us for free, this influx of inventory bloat events combined with 2 new inventory pages to buy, row by row, is racketeering at its finest.

 
Flag Post

Topic: Game Programming / GiTD Timing

Doubt I’ll do it this time around—I mean I usually don’t, even though I mean to. I’m very slowly working on a rather ambitious bullet hell shooter (last one I think I’ll make, actually) and also, November has this that I’d like to participate in.

 
Flag Post

Topic: Rise of Mythos / [Devs] Worldboss needs more than 2 opening times

Time-gated content isn’t popular in most civilized countries. When will china realize that?

 
Flag Post

Topic: Rise of Mythos / Fan Game

Even if the games are free to play, web games (flash, html5, etc) are still considered commercial products because so many sites offer ad revenue sharing. (Kong does) If you steal assets from a source you do not own (such as this game) you could run into legal troubles if the developers decide to go after you.

A few more things:

1) RPGs are more work than you think. Good luck with that.

2) The world really doesn't need another tower defense game. Seriously. :|
 
Flag Post

Topic: Game Programming / My games Sphere With Elements

Harsh (but well-meaning) constructive criticism incoming!

1) The writing needs some serious work. I know many flash devs don't speak english as a native language, but it's still important for your audience to be able to understand what's being said in the game, and that it makes for an enjoyable read.

2) Oh my, that font. I know it's tempting to use fancy fonts because "they look cool" however in this case, it makes your dialog sequences harder to read. Titles and such are fine in fancy fonts, but you want heavy amounts of text to be displayed in something players can read more easily and thus, more quickly.

3) So the game itself is a breakout clone. That's fine for a first game, however the physics seem off. Rather than the trajectory being modified by the angle at which it hits the paddle, where it hits the paddle seems to be what determines the direction the ball is going to travel in. It's pretty easy to set up straight up-and-down bounces. Hitting blocks (and the ceiling) seems to cause the same thing to happen.

4) The goal of a given level isn't clear. I filled up my element-bar-thingy and the game kept going. Then, after fulfilling some unknown objective, I finished the level?

5) The shiny gold buttons seem somewhat out of place with the rest of the game's art style.
 
Flag Post

Topic: Rise of Mythos / [to devs] make inventory bigger

With all these stupid collection events creating insane amounts of inventory bloat, there’s really no reason to keep our inventory limited to only 2 pages. The devs, given how money-hungry they are, should be all over this because more pages to unlock = more gold consumption.

 
Flag Post

Topic: Rise of Mythos / Params Error?

Does it happen when the server select screen comes up? I had that happen when I set my browser to block third party cookies. Just make an exception to allow gamefuse.com to set them and it should work.

 
Flag Post

Topic: Game Programming / [Solved] Serialization sucks - HALP!

Wait, nevermind. After much digging around, I found that adding the registerClassAlias line seen below into my game-loading function solved it:

		public static function LoadGame(iSlotID:uint):Boolean
		{
			var bReturn:Boolean = false; // if fails to load, return false
			
			var soLoad:SharedObject = SharedObject.getLocal(LOCAL_PATH_SPECIFIC + iSlotID.toString(), "/");
			var baLoad:ByteArray = soLoad.data.byteArray as ByteArray;
			
			if (baLoad)
			{
				registerClassAlias("VecChapterData", Vector.<ChapterData> as Class);
				baLoad.position = 0;
				oSaveData = baLoad.readObject();
				
				bReturn = true;
			}
			else
			{
				NewGame(iSlotID);
				trace("save data not found - init new game");
			}
			
			return bReturn;
		}

What bothers me is that I have no idea why this works, or why any of the other vectors reserialized just fine despite being even more complicated. Specifically, the player data vector, for example, is full of vectors of items, and the items actually have vectors of additional properties. So if anyone can venture a guess, or if anyone knows why that single line of black magic code works (and precisely how it works) I’d love to know. Other than that, this seems to be resolved.

 
Flag Post

Topic: Game Programming / [Solved] Serialization sucks - HALP!

So yeah, this is still a problem. If I write my bytearray to a sharedobject, and then reread it from that sharedobject without closing the game, everything reserializes just fine. If I write it, close the game, run it again, and then try to read the bytearray, everything reserializes except for that one class. It doesn’t seem to care if I comment out the 2D vector, either. Anyone have any ideas at all?

 
Flag Post

Topic: Game Programming / GiTD #44 - *Contrats I_love_you_lots/dragon_of_celt s*

I missed my chance to vote, but since there were so few votes anyway, my vote would’ve decided the winner. Too much responsibility!

 
Flag Post

Topic: Game Programming / How early in development should I upload my game?

To here? As good as you can possibly make it if you’re serious about making your game and having it succeed.

If you want to upload a partially-finished game for feedback from select people, other developers, etc, some place like flash game license might be a better choice. When you upload a game to kongregate, the state it’s in at the time you upload it pretty much determines its fate as either a success story or something doomed to obscurity.

 
Flag Post

Topic: Game Programming / [Solved] Serialization sucks - HALP!

Yeah, ChapterData is the only serialized object that utilizes multi-dimensional vectors. You know, now that I think about it, I’m pretty sure I had this same problem way back when I first started learning AS3, but since I was still a noob, I chalked it up as not knowing what I was doing. I think I eventually ended up having to store the data another way, and since I’m running into this problem again, maybe it’s just a limitation in AS3’s architecture—something it can’t deal with. Time to try rearranging data.