Recent posts by Lofi on Kongregate

Subscribe to Recent posts by Lofi on Kongregate

avatar for Lofi Lofi 46 posts
Flag Post

Topic: Game Programming / when is an object really removed?

ok. thanks a lot! :)

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Game Programming / when is an object really removed?

thanks for the lightningfast reply :)

is there a generic way to do this? my problem is that with eg:

function addEnemy() {
var charge1 = new Charge();
Game.main.spriteClip.addChild(charge1);
}

being called in my levelmanager, i don’t have access to “charge1” anymore.

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Game Programming / when is an object really removed?

When is an object removed and set to null?

To make it short, i create 3 movieclips:

var charge1 = new Charge();
Game.main.spriteClip.addChild(charge1);

var charge2 = new Charge();
Game.main.spriteClip.addChild(charge2);

var b = new LightningBeam( charge1, charge2);
Game.main.spriteClip.addChild(b);


LightningBeam connects charge1 and charge2. When charge1 gets destroyed, then LightningBeam should stop connecting charge1 and charge2, but it doesn’t.

In Charge() i remove the children with: parent.removeChild(this);

In LightningBeam i check whether the charges are null or not

if( charge1 == null || charge2 == null)
kill(); // remove the lightningbeam

However, even after charge1 or charge2 get destroyed, they still aren’t null. The only method that works is if i check

if( !parent.contains( charge1) || !parent.contains( charge2))
kill();

Am I doing something wrong with the null checks? It’s just a matter of understanding for me as the other solution works. I’m only afraid that the objects are still somewhere in memory and cost performance or sth.

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / large scrolling background (6000px height)

the level is 6000px in height, ie the pic

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / large scrolling background (6000px height)

yeah, that’s the obvious solution. but how to proceed then? simple image copying? and if so, how? or the gotoandstop solution with frames?

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / large scrolling background (6000px height)

my background has 6000px in height. afaik flash is limited to +/-2880px. what’s the preferred and performing way to deal with such large scrolling backgrounds in as3?

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / include another site, eg google maps

thanks, i’ll do. i’m planning anyway to pre-load several tiles. that way you can make a very long map. current limit so far is ~6000 pixel in height, more than that gives you a google api error

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / include another site, eg google maps

if anyone is interested, i’ve made a quick preview of how it could work. tbh, i kind of like the google earth integration, i think i’m going to build my game on that:

http://megaswf.com/view/ca8f1b8f1972d70e21b809421a386c06.html

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / include another site, eg google maps

found it. you have to register a key at google for your site and use it in the api. works like a charm :)

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / include another site, eg google maps

just for fun i’ve integrated google maps as scrolling background for my shoot em up. of course now i have the problem that the user can’t access maps.google.com from the site where the flash file is located. is there any convenient way to ask the user for permission to access a remote site from within my flash file?

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / keyboard blocking

does anyone have a solution to keyboard blocking? when i press fire (=space bar) and try to move into upper left (left + right cursor) simultaneously, then my ship doesn’t move on older keyboards. i have a g15 logitech keyboard which works around that kind of stuff. but it’s annoying for other people who just have an ordinary keyboard

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / Enemy Wave with (smooth) Waypoint System - with as3 source

yeah, that’s where the estimated value and the distance calculation come into the game. i don’t have the time to figure out how that works, but thanks anways for the link! for my needs the above is sufficient. and as it’s been asked for, i thought i’d create a sample and share. still, if anyone corrects/enhances the algorithm, please share :-)

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / Enemy Wave with (smooth) Waypoint System - with as3 source

here you can directly see what the swf does:

http://lofi007.piranho.de/waypoints/waypoints.swf

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / Enemy Wave with (smooth) Waypoint System - with as3 source

after nobody came up with a solution, i searched the web for info on how to create my own wave of enemies which moves along a waypoint system, while the movement at the waypoints is rather smooth. several blogs helped in creating this code. it’s still not complete, but already working. if you need this as well, here’s the initial version:

http://rapidshare.com/files/181988137/waypoints.zip

there’s stuff that still needs enhancements. if you work on this, please do share :)

usage: click in the window to add waypoints; waypoints are draggable; press the “Wave” button to let a wave of enemy ships fly around the waypoints

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / smooth movement along waypoints

if anyone is interested and needs it as well, ninoscript has the solution:

http://www.kirupa.com/forum/showpost.php?p=1735872&postcount=17

actually his is a driving game, but the mechanism is the same

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / smooth movement along waypoints

thanks, already been there as well, but didn’t find anything to my satisfaction. i had hopes that someone would share their algorithms :-)

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / smooth movement along waypoints

thanks, i already got this one and translated it to AS3, but it doesn’t work as expected. i need smoother movements at the corners. besides there seems to be a rotation bug in it. whenever a waypoint is reached, the ship rotates into the opposite direction shortly and then into the correct one, which looks ugly. happens on different angles and on different speeds. i already checked several rotation bug solutions in AS3 (yes, there seems to be one), but those didn’t solve the problem either.

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / smooth movement along waypoints

does anyone have a good algorithm with which you can move an object along several waypoints? i specifically search one which lets eg a spaceship fly to a point and along the way smoothly rotate and continue flying to the next point. currently my ships fly towards a waypoint, make a hard turn at that point and continue flying, but that looks ugly.

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / waves of enemies without the mess

here’s a simple approach with waypoints which works:

http://www.emanueleferonato.com/2007/10/06/make-a-flash-game-like-flash-element-tower-defense-part-1/

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / Tower Defense Tutorials please?!

what is tower defense?

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / The AS3 Shoot source

only levelmanager

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / Winners Announced!

is it possible to see the non-classic version of river raid? i can’t stand the music as it gets very annoying quickly, the controls are horrible and i definitely won’t waste my time to play through 5 levels of this “game” only to see how the non-classic version looks. but i really would like to see why it got voted first, there must be a reason after all.

the other 2 games are very nice.

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / The AS3 Shoot source

haven’t seen it either. just change the miniboss timerhandler in levelmanager to sth like this:

		var bossCount = 0;
		public function miniBossTimerHandler(event:TimerEvent):void 
		{
			bossCount++;

			if( bossCount < 3)
				Game.main.spriteClip.addChild( new MiniBoss());
			else			
				Game.main.spriteClip.addChild( new Boss());
			
        }
 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / How To Add Aceleration? Look Here

if anyone still needs stuff for movement, i’ve found this tutorial which is very good and has slim code:

http://www.gotoandplay.it/articles/2007/02/gametutorial_part1.php

(i don’t know about policy of linking to other sites, so if that’s not wanted, admin please delete; i thought it’s very useful stuff, hence the link)

 
avatar for Lofi Lofi 46 posts
Flag Post

Topic: Kongregate Labs / Lissajous Movement

thanks a lot, but it didn’t work as expected, but i found out if you’re interested:

	old_x = x;
	old_y = y;
	x = ...;
	y = ...;
		
	rotation = rad2deg(Math.atan2((old_y-y),(old_x-x)))+90;

using

	function rad2deg(radians:Number):Number {
		return radians * 180 / Math.PI;
	}