Recent posts by BadEgg on Kongregate

Subscribe to Recent posts by BadEgg on Kongregate

avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / Logical OR help

Also, something which hasn’t been discussed yet is the word “inclusive” at the end of the author’s comment which seemed to be causing you a bit of confusion.

The word inclusive wasn’t referring to whether xPosition is between 0 – 100 or including these values. The || (OR-operator) in AS3 returns true if statement A = true or statement B = true or A & B = true, it is inclusive because it allows for any combination of A & B to be true so long as at least one of them is true.

By contrast, try researching XOR (exclusive OR). XOR returns true only if A = true or B = true. If A & B = true then it returns false because it only wants either one or the other to be true. Note: AS3 doesn’t have a logical XOR operator, although it does have a bitwise one.

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / Deeper Topic (part 4): Examples and advanced techniques

I love these posts you’ve been doing, compositional programming really does seem like the way forward. I’m now playing around with the ideas you outlined in your post to see what I can do with them

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / GiTD [#32] Voting finished! [imp2]

No, I’m thinking that the player still shoots as well (like in the current version), and the cannon acts as a secondary weapon to help you.

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / GiTD [#32] Voting finished! [imp2]

Thanks for the feedback that everyone’s given on my game, all of it seems really constructive and I agree with all the criticisms. I think I will try making a 2nd version at some point in the future which will develop the idea further by making the goal not to collect as many orbs as you can but instead to stay alive for as long as possible by avoiding touching the enemies, I’m thinking that the Beacon which you pile the orbs into is a cannon which uses the orbs you collect as ammunition to shoot the enemies.

Also more enemy types/powerups blah blah blah…you know, the standard improvements.

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / GiTD [#32] Voting finished! [imp2]

1st – nutter666 – BodyBagger I liked how much work had gone into the art although the gameplay did get quite dull after a couple of rounds due to how simplistic it was.

2nd – I_love_you_lots – Collectron It’s a nice game and I found it fun playing through the few levels that were there. However, I did feel like the collection element was kind of forced in there by not allowing the player to advance to the next level until everything had been picked up.

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / GiTD [#32] Entries and Discussion

Ok, I’ve now uploaded my finished entry for this contest: http://www.kongregate.com/games/BadEgg/klecter

Good luck to everyone else who’s submitting, I’ve enjoyed playing your games so far.

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / GiTD [#32] Entries and Discussion

Originally posted by I_love_you_lots:
Originally posted by BadEgg:

This is my entry so far…. http://www.fastswf.com/DjfX1hs

Still needs work on the graphics in quite a few places and I’m planning for the beacon gradually building up an increasing glow as you drop more orbs on it but other than that I think I’m pretty much there, unless anyone can point out anything I’ve overlooked.

This is actually quite fun. Graphics could be revised though. I also find it humorous, how happy the player looks vs how mean the enemies are :P

Here’s an update from me. A couple-o-tutorial levels (without the tutorial part.) Not quite sure what I’m gunna have my guy collect, I suppose I’ll stick with face-parts.

|INSTRUCTIONS|

ASWD to move, jump down chutes to switch level, hold W while adjacent to a ceiling to magnetize your head.

Thanks for the feedback, I’m glad you liked the gameplay, that’s what I’ve been mainly focusing on. I know that the graphics could do with some work, but with the amount of time I had to work with (and my extremely limited art skills this was the best I could manage

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / GiTD [#32] Entries and Discussion

This is my entry so far…. http://www.fastswf.com/DjfX1hs

Still needs work on the graphics in quite a few places and I’m planning for the beacon gradually building up an increasing glow as you drop more orbs on it but other than that I think I’m pretty much there, unless anyone can point out anything I’ve overlooked.

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / GiTD [#32] Entries and Discussion

@nutter666, the artwork on your game is looking really nice, it actually looks like a proper game.

I’m at the point on mine where I’ve completed the gameplay, so now I need to do the boring bit aka. building the menus, GUI etc. Replacing the squares and circles with actual graphics (or whatever I can throw together with my pre-school art skills). This may be the first ever GiTD that I’ve started and completed on time!

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / GiTD [#32] Entries and Discussion

Been so long since I last came on here. I’m definitely going to submit something for this, been spending most of today trying to get something together.

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / End of file occured error

skyboy, I love you. I never realised that you should (or even could) escape byte arrays, but that seems to have solved the issue completely! Why must it always be the little things that cause the biggest headaches?

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / End of file occured error

Rest of loading code:

private function mazeReceived(e:Event):void{
	_loader.removeEventListener(Event.COMPLETE, mazeReceived);
	trace(e.target.data.length);
	var b:ByteArray = ByteArray(e.target.data);
	var a:Array = extractMazeGrid(b);
	dispatchEvent(new MazeEvent(MazeEvent.SET_MAZE, a));
}

private function extractMazeGrid(b:ByteArray):Array{
	var gridSize:Point = new Point(b.readShort(), b.readShort());
	var a:Array = new Array(gridSize.x);
	var startPos:Point = new Point(b.readShort(), b.readShort());
	var endPos:Point = new Point(b.readShort(), b.readShort());
	var currentByte:int = nextByte(b);
	var endian:uint = 128;
	for(var i:uint = 0; i < a.length; i++){
		a[i] = new Array(gridSize.y);
		for(var j:uint = 0; j < gridSize.y; j++){
			if(currentByte >= endian){
				currentByte -= endian;
				a[i][j] = 1;
			}else{
				a[i][j] = 0;
			}
			if(endian == 1){
				endian = 128;
				currentByte = nextByte(b);
			}else{
				endian /= 2;
			}
		}
	}
	a[startPos.x][startPos.y] = 3;
	a[endPos.x][endPos.y] = 4;
	return a;
}

private function nextByte(b:ByteArray):int{
	var byte:int = b.readByte();
	if(byte < 0){
		byte += 256;
	}
	return byte;
}
 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / End of file occured error

@skyboy, the content type of my urlrequest = ‘application/octet-strem’, so presumably that means it’s base8. This was the only way I could get the data to transmit.

@seneksis, yeah, it seems to be loosely based on size. I can never get a large maze (say 100×100) to load but small ones (30×30 for example) generally will. It’s not that a particular maze will sometimes load and sometimes not, some mazes always load, and the rest just dont.

Code for receiving data:

private function mazeRequest():void{
	var urlVars:URLVariables = new URLVariables();
	urlVars.startInd = _currentPage.x;
	urlVars.endInd = _currentPage.y;
	urlVars.mazeLabel = _list.getItemAt(_list.selectedIndex).label;
	var webcall:URLRequest = new URLRequest("my php file");
	webcall.data = urlVars;
	
	_loader = new URLLoader();
	_loader.dataFormat = URLLoaderDataFormat.BINARY;
	_loader.addEventListener(Event.COMPLETE, mazeReceived);
	_loader.load(webcall);
}
 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / WeaponMaker Class + Bullets

Wouldn’t a simple solution be to just pass a class reference for the bullet, then every time the gun shoots, just do something like:

var newBullet:Bullet = new this[myGun.bulletRef](xVel, yVel);
 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / End of file occured error

Hi, wondering if anyone has experienced the problem I’m currently struggling with. I’ve got a simple maze game which allows users to save mazes either to their computer through shared object, or to a mysql database. To do this, the maze is condensed down to a byte array and gets sent out to a php file which adds the maze to the database.

Everything seems to work fine except that often when I retrieve files from the database they have a few bytes missing, ie. was 1288 when I sent it off, but when it comes back its only 1281. This is causing me a lot of problems with errors etc. Any advice on how to resolve the problem?

Incidentally, I know that the problem doesn’t lie in my reading/writing of byte arrays as it works perfectly for shared objects. Also, I’m pretty sure the problem doesn’t stem from when I send the data out from flash as I’ve got my php script echoing the data back to flash and that’s showing as the right length.

Any advice greatly appreciated
James

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / Optimization idea

The main benefit that I can see of adding them to a seperate container rather than just removing them is that you can iterate through all objects with

for(var i:int = numChildren - 1; i >= 0; i--){
     if(getChildAt(i) is not visible){
          otherContainer.addChild(getChildAt(i));
     }
}

rather than having to go through numerous arrays I have for different object types and having to check whether they are currently added or removed.

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / Optimization idea

@Wordblind, surely the event issues you would be avoiding is the fact that if an object is not part of the display list then any events it dispatches will not be received by its parent. In the example you used, you had the event listener added to the object that is actually doing the dispatching, in my case that would result in hundreds of listeners as each brick would have its own listener to listen for if it needs to be destroyed. If you had those listeners added to the Test class then surely your output would look far more like the following:

removed
removedFromStage
added
addedToStage
------------
removed
removedFromStage
added
addedToStage
 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / [AS2] Code not working

it looks like there’s some inconsistency in your references to exps:

_root.exps += 1;

if(exps = 10){ (Also note that in this line of code you are using the assignment operator rather than the comparison operator)

Assignment operator:
var x:uint = 10;
var y:uint = 6;
x = y;
//x is now 6 as it has been assigned y’s value

Comparison operator:
var x:uint = 10;
var y:uint = 6;
trace(x==y); shows false because 6 does not equal 10

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / Optimization idea

hmm, skyboy’s idea seems really interesting, thanks for that. So basically I just have a unrendered container object, each frame i do checks in my gamescreen to check the display rect of any objects overlap with the view area, if not then addchild them into this. Also check for the opposite in the container ie. if object rect does overlap with screen rect then add them back into gamescreen.

However, i guess this does mean i need to duplicate all my event listeners doesn’t it ie.

addEventListener(Brick.DESTROY, onEnemyShoot, true);
_dummyContainer.addEventListener(Brick.DESTROY, onEnemyShoot, true);

Just out of curiosity, why would the blitting idea not work? I can understand how that could be very inefficient if i was rendering the entire blitted canvas, but if i were to use scrollRect to only render the part that is on screen then surely that would be saving the cpu some work.

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / Huge Exportation Time : Fatality ?

And even without the music in you’re still getting these long export times? I’m currently working on a game where there are a lot of graphics, without the music it’s currently about 3 meg and that still only takes about 20 seconds at the most.

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / Optimization idea

Hi there, in my current project I’ve been noticing a tiny bit of lag once I start building levels of any reasonable size. The game is a platformer and as such there are a lot of bricks being used. I’ve come up with a couple of I could go about optimizing and just wanted to run them by people to get their opinions on what would be the best approach:

1) My original idea was to blit all the bricks right at the beginning of the level to reduce the amount of graphical objects I’m dealing with down from several hundred to 1 big one. The one problem I have with this is that I do also have moving bricks which would be mean I would need to do keep redrawing the areas immediately surrounding them which would be a hassle, so alternatively, I’ve thought I could blit only the bricks incapable of moving (the vast majority) and then leave the rest to be handled as they have been so far.

2) remove any objects not within the viewing area from the display list. I must admit I’m quite skeptical about this one because although I dont know much about the internal workings of flash, I would have thought they would already be performing checks to not bother rendering what wouldn’t appear on screen. Plus this could play havok with the logical side of things as it could disrupt events from being dispatched.

So there’s my 2 main optimization ideas, I’d just like some input from people on which would be the best way to go, how much of a performance increase I might expect and maybe even any alternative suggestions before I start adding further clutter to my code.

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / Huge Exportation Time : Fatality ?

Once you get music in there the export time really seems to shoot up, for that reason I tend to leave adding music until the very end of a project so I only have to sit through a few of those horrendously long loads.

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / Catching ALL Events

Thanks for all the responses, many people seem to have mentioned just removing the enter_frame listener, or something to that effect, which is a method that I am already familiar with and not really a fan of, the reason being that simply removing one listener is rarely enough since the game will still respond to mouse/keyboard input. Plus, in my opinion, there is no reason that the objects controlling the actual gameplay of the game need to be aware of whether the game is paused, it is much more elegent to just stop new information from reaching them.

Since it appears that there is no way of detecting all events which pass through a specific point, I’m having to compromise and look at alternative ways of doing this.

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / Catching ALL Events

Hi people, I’ve been looking to build a pause class which would allow me to really easily pause games. My way of doing this is to have a class which you set as the parent of whichever object it is you want to pause, and then when the pause class gets ‘activated’, it simply stops all events from passing through it by calling the Event.stopPropogation() method.

However, the one flaw in this is that I can’t find any way of catching all events that pass through an object and the only alternative would be to make the user provide an array of every different event type that would need to be listened for and then have the class create an event listener for each of these types…..and since this is meant to be a time-saver, that doesn’t sound too appealing.

So, anyone know a way of doing this? Or is it simply not possible?

Thanks
James

 
avatar for BadEgg BadEgg 611 posts
Flag Post

Topic: Game Programming / Making a story game

You could use just about any program you wanted to do that, the flash IDE is pretty good for that kind of thing though. have your picture, add a couple of buttons, whichever button the user clicks, gotoAndStop to a different frame.

Please note that I am not advocating using such methods for game creation, the only reason I’m suggesting it to you is because you seem like quite a n00b and this will be the easiest way to create that kind of game you want to make. However, if you decide to publish your game, expect it to get mostly very negative reviews since the majority of players are very bored of that kind of gameplay.