"as2" Category


DisneyLand Paris Tower of Terror Micro Quiz - Repost


Friday, April 4, 2008

A While ago I published a post on a recent game that I had made for Disney well the activity finishes today and I've learnt a few things that I thought I would share, mainly code.

I was instructed to creat a time date activator for php, so that an image changed to a live feed from the park Now I know basic php, so this one was a little tricky, I searched Google and came up with loads of complicated sollutions none of them really matching my requirement.

So here is the code, for all those people who have had a similar problem and want a quick simple no frills sollution, thanks for Richard Wong for informing me about the end of string function.

 
//Get Date and Hour
$today = date('D');
$hour = date('G');
//
$holdingContent = < <ENDOFSTRING
blah blah blah old content
ENDOFSTRING;
//
$newContent =<<<ENDOFSTRING
blah blah blah new content
ENDOFSTRING;
 
//If today is greater than day time then show new content
if ($today == "DaySet" && $hour > HourSet) {
    echo $newContent;
} else {
	//Show old content
	echo $holdingContent
}
 

Orginal Post.
Just completed this little gem.. would like to do a bit more but it was a quick turn around and material was sparse (approx 24 hours office time).

Screens.

game_start_screen.jpg game_lift_screen.jpg game_question_screen.jpg

Hopefully you get the idea, I esp loved creating the lightning effect.. very atmospheric, the thunder gives it a real sense of terror.

here's my code, using the a simple for loop and set interval and the very useful gs.TweenLite class from greensock.com, there's is also an as3 version available, which adds extra freatures and sweetness.

//Import the Class
import gs.TweenLite;

//Set vars
//Stage fps = 24 - 30
var st = this.lighting_effect_mc;
var tcount:Number = 0;

//Play Thunder
var thunder:Sound = new Sound();
thunder.onLoad = function(success:Boolean):Void  {
	if (success) {
		thunder.start();
		thunder.setPan(0);
	}
};
thunder.loadSound("game/sfx/Thunder.mp3",false);

//Name of the mc's on stage.
var target:Array = [st.ligh0, st.ligh1, st.ligh2, st.ligh3];
nolights = target.length;
trace("no lights = "+nolights);
//
//This calls the effect.
function callLflash() {
	//
	tcount += 1;
	rand = random(nolights);
	//
	if (tcount == 80) {
		//Play Thunder
		var thunder:Sound = new Sound();
		thunder.onLoad = function(success:Boolean):Void  {
			if (success) {
				trace("Sound Loaded");
				thunder.start();
				pn = random(100);
				thunder.setPan(pn);
				thunder.setVolume(pn);
				trace(pn);
			}
		};
		thunder.loadSound("sfx/Thunder2.mp3",false);
		tcount = 0;
	}
	//
	if (target[rand]._visible == true) {
		TweenLite.to(target[rand],0.4,{_alpha:0});
		if (target[rand]._alpha == 0) {
			target[rand]._visible = false;
			target[rand]._alpha = 100;
		}
	} else {
		target[rand]._visible = true;
		rand = random(nolights);
	}
}
function intervalCallLight() {
	var speed = 50;
	turnOn = setInterval(this, "callLflash", speed);
}

intervalCallLight();

Check it out on it's microsite here