<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Filipe Silvestrim Blog &#124; Game Development and ActionScript</title>
	<atom:link href="http://www.filipesilvestrim.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.filipesilvestrim.com/blog</link>
	<description>Researchs, curiosities and stuffs about Web and Game Development and interactive technologies</description>
	<lastBuildDate>Fri, 16 Oct 2009 19:25:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Useful Websites for Game Developers, Game Designers, &#8230;</title>
		<link>http://www.filipesilvestrim.com/blog/16/10/2009/useful-websites-for-game-developers-game-designers/</link>
		<comments>http://www.filipesilvestrim.com/blog/16/10/2009/useful-websites-for-game-developers-game-designers/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 18:46:11 +0000</pubDate>
		<dc:creator>Filipe Silvestrim</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Game Design]]></category>
		<category><![CDATA[Game Development]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Links]]></category>

		<guid isPermaLink="false">http://www.filipesilvestrim.com/blog/?p=92</guid>
		<description><![CDATA[Last night I was looking some old docs and I found a list of links that, at the time, I thought that every Game Developer, Gamer or curious (about game) should know.
In fact, this isn&#8217;t nor a specific list and nor a huge list, but is really helpful to the purpose of be startup to [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I was looking some old docs and I found a list of links that, at the time, I thought that every Game Developer, Gamer or curious (about game) should know.</p>
<p>In fact, this isn&#8217;t nor a specific list and nor a huge list, but is really helpful to the purpose of be startup to get inspired in the projects of your new games.</p>
<p>Here are the links (if you know some other useful links, please reply this post, than I&#8217;ll update it):</p>
<p><strong>Aggregators:</strong></p>
<ul class="standard_list">
<li>Kongregate &#8211; <a href="http://www.kongregate.com" target="_blank">http://www.kongregate.com</a></li>
<li>Pogo &#8211; <a href="http://www.pogo.com" target="_blank">http://www.pogo.com</a></li>
<li>MiniClip &#8211; <a href="http://www.miniclip.com" target="_blank">http://www.miniclip.com</a></li>
<li>BigFish &#8211; <a href="http://www.bigfishgames.com" target="_blank">http://www.bigfishgames.com</a></li>
<li>NewGrounds &#8211; <a href="http://www.newgrounds.com" target="_blank">http://www.newgrounds.com</a></li>
<li>PopCap &#8211; <a href="http://www.popcap.com" target="_blank">http://www.popcap.com</a></li>
<li>RealArcade &#8211; <a href="http://www.realarcade.com" target="_blank">http://www.realarcade.com</a></li>
<li>IWin &#8211; <a href="http://www.iwin.com" target="_blank">http://www.iwin.com</a></li>
<li>Shockwave &#8211; <a href="http://www.shockwave.com" target="_blank">http://www.shockwave.com</a></li>
<li>Games MSN &#8211; <a href="http://www.games.msn.com" target="_blank">http://www.games.msn.com</a></li>
<li>ArcadeTown &#8211; <a href="http://www.arcadetown.com" target="_blank">http://www.arcadetown.com</a></li>
<li>TryGames &#8211; <a href="http://www.trygames.com" target="_blank">http://www.trygames.com</a></li>
<li>Oberon &#8211; <a href="http://www.oberongames.com" target="_blank">http://www.oberongames.com</a></li>
<li>Reflexive &#8211; <a href="http://www.reflexivearcade.com" target="_blank">http://www.reflexivearcade.com</a></li>
<li>MarkFennell &#8211; <a href="http://www.markfennell.com/flash" target="_blank">http://www.markfennell.com/flash</a></li>
<li>CandyStand &#8211; <a href="http://www.candystand.com" target="_blank">http://www.candystand.com</a></li>
<li>MouseBreaker &#8211; <a href="http://www.mousebreaker.com" target="_blank">http://www.mousebreaker.com</a></li>
<li>TeaGames &#8211; <a href="http://www.teagames.com" target="_blank">http://www.teagames.com</a></li>
<li>Metanet &#8211; <a href="http://www.harveycartel.org/metanet/downloads.html" target="_blank">http://www.harveycartel.org/metanet/downloads.html</a></li>
<li>Squarecircleco &#8211; <a href="http://www.squarecircleco.com" target="_blank">http://www.squarecircleco.com</a></li>
<li>Extrajet &#8211; <a href="http://www.extrajetzt.com" target="_blank">http://www.extrajetzt.com</a></li>
<li>Large Animal &#8211; <a href="http://www.largeanimal.com" target="_blank">http://www.largeanimal.com</a></li>
</ul>
<p><strong>Analysis:</strong></p>
<ul class="standard_list">
<li>Jay Is Games &#8211; <a href="http://jayisgames.com" target="_blank">http://jayisgames.com</a></li>
<li>Three Hundred Mechanics &#8211; <a href="http://www.squidi.net/three/index.php" target="_blank">http://www.squidi.net/three/index.php</a></li>
</ul>
<p><strong>Market and Industry:</strong></p>
<ul class="standard_list">
<li>GameStats &#8211; <a href="http://www.gamestats.com" target="_blank">http://www.gamestats.com</a></li>
<li>Games Industry &#8211; <a href="http://www.gamesindustry.biz" target="_blank">http://www.gamesindustry.biz</a></li>
<li>Games Politics &#8211; <a href="http://www.gamepolitics.com" target="_blank">http://www.gamepolitics.com</a></li>
</ul>
<p><strong>Development:</strong></p>
<ul class="standard_list">
<li>Gamasutra &#8211; <a href="http://www.gamasutra.com" target="_blank">http://www.gamasutra.com</a></li>
<li>GameDev &#8211; <a href="http://www.gamedev.net" target="_blank">http://www.gamedev.net</a></li>
</ul>
<p><strong>Reviews and News:</strong></p>
<ul class="standard_list">
<li>GameSpot &#8211; <a href="http://www.gamespot.com" target="_blank">http://www.gamespot.com</a></li>
<li>Games Radar &#8211; <a href="http://www.gamesradar.com" target="_blank">http://www.gamesradar.com</a></li>
<li>About.com &#8211; <a href="http://boardgames.about.com/od/news/Game_Reviews_News_and_Events.htm" target="_blank">http://boardgames.about.com/od/news/Game_Reviews_News_and_Events.htm</a></li>
<li>IGN &#8211; <a href="http://www.ign.com" target="_blank">http://www.ign.com</a></li>
</ul>
<p><strong>Virals:</strong></p>
<ul class="standard_list">
<li>Viral Game &#8211; <a href="http://www.viral-game.co.uk/our-viral-campaigns.html" target="_blank">http://www.viral-game.co.uk/our-viral-campaigns.html</a></li>
<li>MCM Games &#8211; <a href="http://www.mcmgames.co.uk/viral-game-designers.asp" target="_blank">http://www.mcmgames.co.uk/viral-game-designers.asp</a></li>
<li>Viral World &#8211; <a href="http://www.viralworld.co.uk" target="_blank">http://www.viralworld.co.uk</a></li>
<li>Kerb Games &#8211; <a href="http://www.kerb.co.uk" target="_blank">http://www.kerb.co.uk</a></li>
<li>Viral Chart &#8211; <a href="http://www.viralchart.com" target="_blank">http://www.viralchart.com</a></li>
</ul>
<p><strong>Visual References:</strong></p>
<ul class="standard_list">
<li>The Video Game Atlas &#8211; <a href="http://www.vgmaps.com/Atlas" target="_blank">http://www.vgmaps.com/Atlas</a></li>
<li>Game Sprite Archives &#8211; <a href="http://www.gsarchives.net" target="_blank">http://www.gsarchives.net</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.filipesilvestrim.com/blog/16/10/2009/useful-websites-for-game-developers-game-designers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Screen Manager</title>
		<link>http://www.filipesilvestrim.com/blog/16/08/2009/screen-manager/</link>
		<comments>http://www.filipesilvestrim.com/blog/16/08/2009/screen-manager/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 20:39:07 +0000</pubDate>
		<dc:creator>Filipe Silvestrim</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Easy]]></category>
		<category><![CDATA[FS Library]]></category>
		<category><![CDATA[Prototype]]></category>
		<category><![CDATA[screen]]></category>

		<guid isPermaLink="false">http://www.filipesilvestrim.com/blog/?p=76</guid>
		<description><![CDATA[It&#8217;s been a while that I&#8217;m trying to post the screen manager how to use (also because the code has already been on my code.google for a while).
So&#8230; aren&#8217;t you tired of building screens for every new site? Linking it to a movieclip? Manage all transitions?&#8230; And also having problems with scope access or listener?
On [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while that I&#8217;m trying to post the screen manager how to use (also because the code has already been on my <a title="Filipe Silvestrim google code" href="http://code.google.com/p/filipesilvestrim/" target="_blank">code.google</a> for a while).</p>
<p>So&#8230; aren&#8217;t you tired of building screens for every new site? Linking it to a movieclip? Manage all transitions?&#8230; And also having problems with scope access or listener?</p>
<p>On the net you&#8217;ll find some code that really fix the problems, like <a title="Gaia Framework" href="http://www.gaiaflashframework.com/" target="_blank">GAIA</a>, but not in a simple and easy way. Personally I&#8217;ve being using this class for all my projects (games or simple websites) since I wrote it and I&#8217;ve noticed how fast I can start a project by using it.</p>
<p>To be able to build a screen you&#8217;ll need some class like this:</p>
<pre class="brush: as3;">
package com.filipesilvestrim.screenexample.screen
{
	import com.filipesilvestrim.screenexample.utils.ButtonManipulator;
	import com.filipesilvestrim.screenexample.utils.Consts;
	import com.filipesilvestrim.ui.screen.AbstractScreen;
	import com.filipesilvestrim.ui.screen.ScreenManager;

	import flash.events.Event;

	import gs.TweenLite;

	/**
	 * ...
	 * @author Filipe Silvestrim
	 */
	public class ScreenHome extends AbstractScreen
	{
		private var content : mcScreenHome;

		public function ScreenHome( name : String )
		{
			/* The AbstractScreen has 4 params:
				@param: String - being the name of the screen registered in the ScreenManager
				@param: Boolean - exist transition to the entrance of the screen
				@param: Boolean - exist transition to the exit of the screen
				@param: Boolean - if this screen have something to preload
			*/
			super(name, false, true);
		}

		//When someone calls the change to screen this is the first method to be called
		override public function build():void
		{
			//creating the view
			content = new mcScreenHome();
			//an AbstractScreen is a subclass of Sprite
			//so, we're adding the view created in flash to the ScreenHome instance
			addChild(content);

			//repositioning the view (anchor point is in the middle)
			content.x = 275;
			content.y = 200;

			//reset propeties
			this.alpha = 1;

			//getting access to the buttons created via flash
			ButtonManipulator.createButton(content.$instr, &quot;Instructions&quot;, gotoInstr);
			ButtonManipulator.createButton(content.$more, &quot;More Info&quot;, gotoInfo);
		}

		//helper callback event manipulated by the ButtonManipulator
		private function gotoInstr(e:Event):void
		{
			ScreenManager.getInstance().changeToScreen(Consts.SCREEN_INSTR);
		}

		private function gotoInfo(e:Event):void
		{
			ScreenManager.getInstance().changeToScreen(Consts.SCREEN_INFO);
		}

		//If the current screen is active and someone else calls the changeToScreen method
		//this method is called to destroy the current screen
		override public function destroy():void
		{
			TweenLite.killTweensOf(this);

			//cleaning the memory
			removeChild(content);
			content = null;
		}

		//All the optional screen functions as transitions in and out and preload
		//must to override their methods and when done call theirs end methods (event)
		override protected function transitionOut():void
		{
			TweenLite.to(this, 1, { alpha:0, onComplete:super.endTransitionOut } );
		}
	}

}
</pre>
<p>I&#8217;m showing here one example to show how easy and fast is to create screens in an ActionScript project using the <a title="ScreenManager Class" href="http://filipesilvestrim.googlecode.com/svn/trunk/src/com/filipesilvestrim/ui/screen/ScreenManager.as" target="_blank">ScreenManager</a>.</p>
<p>And here is a example of a game screen:</p>
<p>
<object width="550" height="400">
<param name="movie" value="http://www.filipesilvestrim.com/blog/wp-content/uploads/2009/08/ScreenManagerExample.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<embed type="application/x-shockwave-flash" width="550" height="400" src="http://www.filipesilvestrim.com/blog/wp-content/uploads/2009/08/ScreenManagerExample.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</p>
<p>To download the example (source code) just <a title="Download the example" href="http://filipesilvestrim.com/resources/lib/ScreenExample.zip" target="_blank">click here to download the FlashBuilder project</a> and link it to my library (<a title="Filipe Silvestrim lib download" href="http://filipesilvestrim.googlecode.com/files/fs.swc" target="_blank">donwload at my google code</a>)</p>
<p>The document class of the project is this:</p>
<pre class="brush: as3;">
package
{
	import com.filipesilvestrim.screenexample.screen.ScreenHome;
	import com.filipesilvestrim.screenexample.screen.ScreenInfo;
	import com.filipesilvestrim.screenexample.screen.ScreenInstructions;
	import com.filipesilvestrim.screenexample.utils.Consts;
	import com.filipesilvestrim.ui.screen.ScreenManager;

	import flash.display.Sprite;

	[SWF(width=550, height=400)]
	public class ScreenManagerExample extends Sprite
	{
		public function ScreenManagerExample()
		{
			/*
				First we need to start the ScreenManager.
				The first param is the DocumentClass - we need this because
				the ScreenManager need to have direct access to the stage
				to get focus back to the current screen and if we would
				to access the main class or stage directly via the property scope.
				The second parameter is the local (DisplayObjectContainer)
				were the screen will be attached later.
			*/
			ScreenManager.getInstance().init(this, this);

			//Before start we need to register all the screens to be used later
			ScreenManager.getInstance().addScreen(new ScreenHome(Consts.SCREEN_HOME));
			ScreenManager.getInstance().addScreen(new ScreenInstructions(Consts.SCREEN_INSTR));
			ScreenManager.getInstance().addScreen(new ScreenInfo(Consts.SCREEN_INFO));

			//vamos inicializar/chamar a nossa tela de escolha
			ScreenManager.getInstance().changeToScreen(Consts.SCREEN_HOME);
		}
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.filipesilvestrim.com/blog/16/08/2009/screen-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alchemy shell script for easy compilation</title>
		<link>http://www.filipesilvestrim.com/blog/04/08/2009/alchemy-shell-script-for-easy-compilation/</link>
		<comments>http://www.filipesilvestrim.com/blog/04/08/2009/alchemy-shell-script-for-easy-compilation/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 15:42:25 +0000</pubDate>
		<dc:creator>Filipe Silvestrim</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Alchemy]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Easy]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://www.filipesilvestrim.com/blog/?p=66</guid>
		<description><![CDATA[Hello all!
Once the blog is with a new face, let&#8217;s start to renew the posts too  
Today I&#8217;m posting a quick tip for those who are new with Adobe Alchemy. I really agree that it kind of sucks when you&#8217;re new with theses technologies and you need to configure a lot of things.
Well, I [...]]]></description>
			<content:encoded><![CDATA[<p>Hello all!</p>
<p>Once the blog is with a new face, let&#8217;s start to renew the posts too <img src='http://www.filipesilvestrim.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Today I&#8217;m posting a quick tip for those who are new with <a title="Adobe Alchemy" href="http://labs.adobe.com/technologies/alchemy/" target="_blank">Adobe Alchemy</a>. I really agree that it kind of sucks when you&#8217;re new with theses technologies and you need to configure a lot of things.</p>
<p>Well, I have created a little <a title="Shell Script" href="http://en.wikipedia.org/wiki/Shell_script" target="_blank">shell script</a> that helps to compile a C or C++ Alchemy project without the necessity of configuring the .profile file.</p>
<p>The steps to install and compile a Alchemy project with this shell script are:</p>
<ol>
<li>Download the Alchemy Toolkit at <a title="Alchemy ToolKit" href="http://labs.adobe.com/downloads/alchemy.html" target="_blank">http://labs.adobe.com/downloads/alchemy.html</a></li>
<li>Unzip the package in a directory (that will be your main Alchemy directory)</li>
<li>Go to the main Alchemy directory via Terminal (i.e. cd /Documents/alchemy)</li>
<li>Run the config script in Terminal (i.e. ./config)</li>
</ol>
<p>Now to compile a project just copy the <a title="Alchemy Shell Script File" href="http://filipesilvestrim.googlecode.com/files/run.sh" target="_blank">shell script file</a> to the folder that contains your C or C++ Alchemy project. But before run the script you just need to change the path (highlighted line) to the alchemy-setup directory located in the Alchemy directory (i.e. source /Documents/alchemy/alchemy-setup).</p>
<p>And that is it <img src='http://www.filipesilvestrim.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Now to run the shell script just make the file executable (i.e. in terminal type &#8220;chmod +x run.sh&#8221;) and run it. The script will then ask the main C file of the project: Just type the name of the file without extension and click Return. Done! Your project will be compiled!</p>
<p>Ps.: This is a shell script for Unix. If you want to port it to Windows (.bat) feel free to do that! Just share with us!</p>
<p>Ps.: To compile a C++ file just change the lines of the c-file extension (i.e. cName=&#8221;$fname.cpp&#8221;) and change the compiler to the g++ (i.e. which g++ AND g++ $cName -O3 -Wall -swc -o $swcName).</p>
<pre class="brush: bash; highlight: [33];">
#!/bin/bash
#
# About:     This file is a shell script to make easier
#         the compilation of Adobe Alchemy sources
#
# The MIT License
#
# Copyright (c) 2009 Filipe Silvestrim - http://www.filipesilvestrim.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the &quot;Software&quot;), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#

echo &quot;**************** Easy Alchemy Compiler script ****************&quot;
shopt -s expand_aliases

echo &quot;// Configurating Alchemy...&quot;
source /Documents/alchemy/alchemy-setup
PATH=$PATH:~/bin:/usr/local/bin:~/bin/flex/bin:~/bin/astmp:$ALCHEMY_HOME/achacks
export PATH

alc-on
which gcc

echo &quot;// Accessing  Current Dir...&quot;
DIR=$( (cd -P $(dirname $0) &amp;&amp; pwd) )
cd $DIR

echo &quot;// Please, write the main C file name:&quot;
read fname
cName=&quot;$fname.c&quot;
swcName=&quot;$fname.swc&quot;
gcc $cName -O3 -Wall -swc -o $swcName

echo &quot;**************** DONE ****************&quot;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.filipesilvestrim.com/blog/04/08/2009/alchemy-shell-script-for-easy-compilation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SpotLights to RTS games and pseudo inverse masks</title>
		<link>http://www.filipesilvestrim.com/blog/02/02/2009/spotlights-to-rts-games-and-pseudo-inverse-masks/</link>
		<comments>http://www.filipesilvestrim.com/blog/02/02/2009/spotlights-to-rts-games-and-pseudo-inverse-masks/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 06:23:45 +0000</pubDate>
		<dc:creator>Filipe Silvestrim</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Games]]></category>

		<guid isPermaLink="false">http://www.filipesilvestrim.com/blog/?p=24</guid>
		<description><![CDATA[Well&#8230; Today a friend of mine asked me to help him with a night render for his RTS game. He needed an inverse mask to his MovieClip (which was his entire game). I thought a little and I decided to help him. I started writing an inverse mask, but I realized that this would exhaust [...]]]></description>
			<content:encoded><![CDATA[<p>Well&#8230; Today a friend of mine asked me to help him with a night render for his <a title="RTS Genre" href="http://en.wikipedia.org/wiki/Real-time_strategy" target="_blank">RTS</a> game. He needed an inverse mask to his MovieClip (which was his entire game). I thought a little and I decided to help him. I started writing an inverse mask, but I realized that this would exhaust the cpu. So I thought that what really matters to him is to create a layer of fog on his game, so I wrote (in a few minutes) 2 classes that manage theses &#8220;Spots Lights&#8221;.</p>
<p>The result as you can see is here (drag the red circles):</p>
<p>
<object width="350" height="468">
<param name="movie" value="http://www.filipesilvestrim.com/blog/wp-content/uploads/2009/02/labs.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<embed type="application/x-shockwave-flash" width="350" height="468" src="http://www.filipesilvestrim.com/blog/wp-content/uploads/2009/02/labs.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" ></embed>
</object>
</p>
<p style="text-align: left;">As I&#8217;m writing codes that are not related to my engine (the one I&#8217;m writing for my final project), I decided to create a <a title="Filipe Silvestrim Repository" href="http://code.google.com/p/filipesilvestrim/" target="_blank">Google Code Repository</a> for my extra experiments. This way the classes will be always there. This first experiment can be improved a lot. If you have some comments or know a better way of doing it, please let me know <img src='http://www.filipesilvestrim.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p style="text-align: left;">This example&#8217;s class is here:</p>
<pre class="brush: as3;">
package {
    import com.filipesilvestrim.game.render.light.SpotLight;
    import com.filipesilvestrim.game.render.light.SpotRenderer;

    import flash.display.Sprite;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.events.MouseEvent;

    [SWF(width=350, height=468)]
    public class SpotExperiment extends Sprite
    {
    private var spotRender 		: SpotRenderer;
    private var spotSelected 	: SpotLight;

    [Embed(source=&quot;aoe.jpg&quot;)]
    private var map : Class;

    public function SpotExperiment()
    {
        stage.scaleMode = StageScaleMode.NO_SCALE;
        addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
        addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
        addEventListener(Event.MOUSE_LEAVE, onMouseUp);
        addEventListener(Event.ENTER_FRAME, onEnterFrame);

        //Adding the background (in some cases the game as itself)
        addChild(new map());

        //creating the render. The first param is where we'll add the representation, the second is the width and the third is the height
        spotRender = new SpotRenderer(this, 350, 468);
        //here we can change the fog color to other one and the transparency
        spotRender.changeColorMap(0x000000, 1);

        //Now we're adding 3 spots of diferent sizes and position
        //As params we have: name, pos X, pos Y, width, height
        var spot1 : SpotLight = new SpotLight(&quot;spot1&quot;, 200,200,200,200);
        //we can adjust the intensity from 0 to 1
        spot1.intensity = 1;
        //the focus can be adjusted too
        spot1.focus = .5;
        //adds the red ball for debug
        spot1.debug(this);
        //add the spot to be rendered
        spotRender.addSpot(spot1);

        var spot2 : SpotLight = new SpotLight(&quot;spot2&quot;, 250,300,100,100);
        spot2.debug(this);
        spotRender.addSpot(spot2);

        var spot3 : SpotLight = new SpotLight(&quot;spot3&quot;, 100, 100, 300, 300);
        spot3.debug(this);
        spotRender.addSpot(spot3);

        //render as first time to the scenario don't appear without no one fog
        spotRender.render();
    }

        private function onMouseDown ( event : MouseEvent ) : void
        {
            //if some spot is target
            if (spotRender.getSpot(event.target.name) != null)
            {
                //hold in the spotSelected variable the sport that represents that Sprite ball
                spotSelected = spotRender.getSpot(event.target.name);
            }
        }

        private function onMouseUp ( event : Event ) : void
        {
            //if mouse released
            spotSelected = null;
        }

        private function onEnterFrame ( event : Event ) : void
        {
            //hold the spots changes (if some spot selected)
            if(spotSelected != null)
            {
                //reposition the spot and the debug reference accourding the mouse position
                spotSelected.x = spotSelected.spriteDebug.x = mouseX;
                spotSelected.y = spotSelected.spriteDebug.y = mouseY;
                //when change the position the sportRender must be rendered again
                spotRender.render();
            }
        }
    }
}</pre>
<p style="text-align: left;">
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">[<ins>SWF]</ins>http://www.filipesilvestrim.com/blog/wp-content/uploads/2009/02/labs.swf<ins>,</ins> 350<ins>,</ins> 468<ins>[</ins><ins>/SWF</ins>]</div>
]]></content:encoded>
			<wfw:commentRss>http://www.filipesilvestrim.com/blog/02/02/2009/spotlights-to-rts-games-and-pseudo-inverse-masks/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Clone a object with type cast</title>
		<link>http://www.filipesilvestrim.com/blog/29/01/2009/clone-a-object-with-type-cast/</link>
		<comments>http://www.filipesilvestrim.com/blog/29/01/2009/clone-a-object-with-type-cast/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 03:22:09 +0000</pubDate>
		<dc:creator>Filipe Silvestrim</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flex 3]]></category>

		<guid isPermaLink="false">http://www.filipesilvestrim.com/blog/29/01/2009/clone-a-object-with-type-cast/</guid>
		<description><![CDATA[Wheel, I&#8217;m not writing another way of do it&#8230;
Is the same way that ObjectUtils of Flex Framework do, but&#8230; Imagine that we want to duplicate one object of the class Example, we can just do the clone with a code like this:

public function deepClone ( obj : * ) : *
{
     [...]]]></description>
			<content:encoded><![CDATA[<p>Wheel, I&#8217;m not writing another way of do it&#8230;</p>
<p>Is the same way that ObjectUtils of Flex Framework do, but&#8230; Imagine that we want to duplicate one object of the class Example, we can just do the clone with a code like this:</p>
<pre class="brush: as3;">
public function deepClone ( obj : * ) : *
{
        var bytes : ByteArray = new ByteArray();
        bytes.writeObject(obj);
        bytes.position = 0;
        return bytes.readObject();
}
</pre>
<p>Let&#8217;s first imagine our Example class like this:</p>
<pre class="brush: as3;">
package com.filipesilvestrim
{
        public class Example
        {
                public var name : String;

                public function Example () {}
        }
}
</pre>
<p>Ok, but now if we try get the object with the cast like <strong>trace((deepClone(obj) as Example))</strong>. Man&#8230; shame on you, you&#8217;ll get &#8220;null&#8221;. but why? It occurs because when we are cloning the class we do it with the ByteArray and when you return that&#8217;s &#8220;new&#8221; bytes as an Object, the Flash Player don&#8217;t know that those bytes are affiliate with the class Example. So how to solve it?</p>
<p>Let&#8217;s register in the Flash Player the class Example, to that when it saw the bytes being cast, it understand that those bytes mean that class. To register we need to this:</p>
<pre class="brush: as3;">
registerClassAlias(&quot;com.filipesilvestrim.Example&quot;, Example);
</pre>
<p>And the code working will be like this:</p>
<pre class="brush: as3;">
package com.filipesilvestrim
{
        import flash.net.registerClassAlias;

        import com.filipesilvestrim.Example;

        public class MainClone
        {

                public function MainClone ()
                {
                        var obj : Example = new Example();

                        registerClassAlias(&quot;com.filipesilvestrim.Example&quot;, Example);

                        trace(&quot;Cloned Object with cast = &quot; + (deepClone(obj) as Example)); // must trace &quot;Cloned Object with cast = [object Example]&quot;

                }

                private function deepClone ( obj : * ) : *
                {
                        var bytes : ByteArray = new ByteArray();
                        bytes.writeObject(obj);
                        bytes.position = 0;
                        return bytes.readObject();
                }
        }
}
</pre>
<p>So, lets code and have fun <img src='http://www.filipesilvestrim.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.filipesilvestrim.com/blog/29/01/2009/clone-a-object-with-type-cast/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>What a shame&#8230; Back to blog!</title>
		<link>http://www.filipesilvestrim.com/blog/29/01/2009/what-a-shame-back-to-blog/</link>
		<comments>http://www.filipesilvestrim.com/blog/29/01/2009/what-a-shame-back-to-blog/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 02:35:35 +0000</pubDate>
		<dc:creator>Filipe Silvestrim</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.filipesilvestrim.com/blog/29/01/2009/what-a-shame-back-to-blog/</guid>
		<description><![CDATA[Wow today I saw my blog and I felt a pain on my heart. Can you guys imagine, it&#8217;s almost one year that I didn&#8217;t blog.
Last year was so busy, building a looot of games, conciliating work and college and my User Group. I just feel said about have being had no more time to [...]]]></description>
			<content:encoded><![CDATA[<p>Wow today I saw my blog and I felt a pain on my heart. Can you guys imagine, it&#8217;s almost one year that I didn&#8217;t blog.</p>
<p>Last year was so busy, building a looot of games, conciliating work and college and my User Group. I just feel said about have being had no more time to blog. So, let&#8217;s change this scene.</p>
<p>To those that don&#8217;t know what I do. I&#8217;m an Game Developer, mainly developing in AS3, at <a href="http://www.w3haus.co.uk" title="W3Haus" target="_blank">W3Haus</a>. I have an Adobe User Group in Rio Grande do Sul, Brazil; the user group is called <a href="http://www.augrs.com" title="AUGRS" target="_blank">AUGRS</a>. I&#8217;m finishing my college (Digital Games at <a href="http://wwww.unisinos.br" title="Unisinos" target="_blank">UNISINOS</a>) this year and my thesis project will target game engines and AS3 (soon I&#8217;ll have more news about it).</p>
<p>And here we go starts new year with an picture of me in an meeting at <a href="http://www.lfpug.com/" title="LFPUG" target="_blank">LFPUG</a> (London Flash Platform User Group) last year when I traveled to London to attend <a href="http://www.flashonthebeach.com/" title="FOTB08" target="_blank">Flash On The Beach 2008</a>. I&#8217;m the 4º from right to left. And by request of my friend (lol), I&#8217;ll introduce <a href="http://www.pedrotaranto.com.br" title="Pedro Taranto" target="_blank">Pedro Taranto</a>, another Brazilian that traveled with me and he was there to &#8211; the 1º from left to right.</p>
<p style="text-align: center"><img src="http://www.filipesilvestrim.com/blog/images/posts/london_08_lfpug.jpg" title="Meeting at LFPUG" alt="Meeting at LFPUG" border="0" height="375" width="500" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.filipesilvestrim.com/blog/29/01/2009/what-a-shame-back-to-blog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flash Player loses focus with button + removeChild</title>
		<link>http://www.filipesilvestrim.com/blog/21/02/2008/flash-player-loose-focus-with-button-removechild/</link>
		<comments>http://www.filipesilvestrim.com/blog/21/02/2008/flash-player-loose-focus-with-button-removechild/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 03:24:04 +0000</pubDate>
		<dc:creator>Filipe Silvestrim</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>

		<guid isPermaLink="false">http://www.filipesilvestrim.com/blog/21/02/2008/flash-player-loose-focus-with-button-removechild/</guid>
		<description><![CDATA[Well, this week, I was doing a little game that to the player start to play needs click in one &#8220;start game&#8221; button and after uses the keyboard to control the character moves. So until this point all OK, but what i didn&#8217;t told you is that when click&#8217;s in the &#8220;start game&#8221;, it disappears [...]]]></description>
			<content:encoded><![CDATA[<p>Well, this week, I was doing a little game that to the player start to play needs click in one &#8220;start game&#8221; button and after uses the keyboard to control the character moves. So until this point all OK, but what i didn&#8217;t told you is that when click&#8217;s in the &#8220;start game&#8221;, it disappears with one removeChild() (because it appears above all the stage).</p>
<p>After this, my character was no more moving&#8230; I fought &#8220;wow could be my InputManager class not working so fine&#8230;&#8221;, but I tried find some bug or something wrong and nothing. After some tries, accidentally I removed the buttonMode = true &#8211; propertie that i was defining to that my &#8220;start game&#8221; Movie Clip behaviors like Button &#8211; and tcharam&#8230; All working&#8230;..</p>
<p>At first we need remind that Keyboard events will just works when Flash Player get focus. And accidentally I found a way of Flash Player loses focus with on removeChild().</p>
<p><strong>So what is happening here?!</strong></p>
<p>First, open the swf file (focus it); after, click at the button (button with focus); later on, the button is removed from the stage (the focus is removed together with the button &#8211; so here are the problem). Now if I click on the stage, or other local in the swf file (Flash Player will get focus again) and it will works&#8230;<br />
<em>Here is a source code as example :</em></p>
<pre class="brush: as3;">
var spBtn = new Sprite();
spBtn.buttonMode = true; spBtn.graphics.beginFill( 0xff0000, .4 );
spBtn.graphics.drawRect( 0, 0, this.stage.stageWidth, this.stage.stageHeight );
spBtn.graphics.endFill();

addChild( spBtn );

addEventListener ( KeyboardEvent.KEY_DOWN, managekeyDown );
spBtn.addEventListener( MouseEvent.MOUSE_DOWN, mouseClick );

function mouseClick ( e : Event ) : void
{
    spBtn.removeEventListener( MouseEvent.MOUSE_DOWN, mouseClick );
    removeChild( spBtn );
}

function managekeyDown ( e : KeyboardEvent ) : void
{
    if ( e.keyCode == Keyboard.LEFT )
    {
        trace ( &quot;JUST TRACE IF FLASH PLAYER HAVE FOCUS ON IT&quot; );
    }
}
</pre>
<p>======= Updated at August 1º (expect update more the blog&#8230;) ======</p>
<p>To fix this issue you must reset the focus to the stage. So the code will change just in this part:</p>
<pre class="brush: as3;">
function mouseClick ( e : Event ) : void
{
    spBtn.removeEventListener( MouseEvent.MOUSE_DOWN, mouseClick );
    removeChild( spBtn );
    //After the remove child we’ll reset the focus to stage
    this.stage.focus = this;
}
</pre>
<p> <img src='http://www.filipesilvestrim.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.filipesilvestrim.com/blog/21/02/2008/flash-player-loose-focus-with-button-removechild/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>From now on just English&#8230;</title>
		<link>http://www.filipesilvestrim.com/blog/20/02/2008/from-now-on-just-english/</link>
		<comments>http://www.filipesilvestrim.com/blog/20/02/2008/from-now-on-just-english/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 03:33:50 +0000</pubDate>
		<dc:creator>Filipe Silvestrim</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.filipesilvestrim.com/blog/20/02/2008/from-now-on-just-english/</guid>
		<description><![CDATA[Well guys, unhappily &#8211; to whom just want to know in Portuguese &#8211; and happily to the rest of the World, I&#8217;ll be writing just in English on my blog. I&#8217;m taking this action looking forward an better transparency to change informations on line, once the majority of the ActionScript Gurus communicate each others in [...]]]></description>
			<content:encoded><![CDATA[<p>Well guys, unhappily &#8211; to whom just want to know in Portuguese &#8211; and happily to the rest of the World, I&#8217;ll be writing just in English on my blog. I&#8217;m taking this action looking forward an better transparency to change informations on line, once the majority of the ActionScript Gurus communicate each others in English and too because I&#8217;ve a lot of abroad ActionScript friends.</p>
<p>So, to those that want continues seeing ActionScript related subjects in Portuguese, I strongly advice join to the AUGRS ( Adobe User Group Rio Grande do Sul) <a href="http://www.augrs.com/execultables/index.php?vfsPage=list" target="_blank">discussion list</a>.</p>
<p>To the others, we&#8217;ll be in touch.</p>
<p>== Versão em Português / Portuguese Version ==</p>
<p>Bom pessoal, infelizmente &#8211; para aqueles que só saber Português &#8211; e felizmente para o resto do mundo, estarei blogando de agora em diante somente em Inglês. Estou tomando esta medida visando uma melhor transparência para troca de informações online, uma vez que a maioria dos gurus da área se comunicam em inglês e também levando em conta de que tenho muitos amigos da área no exterior.</p>
<p>Então, para quem quiser continuar vendo assuntos relacionados a ActionScript em Português, aconselho estes a participarem da <a href="http://www.augrs.com/execultables/index.php?vfsPage=list" target="_blank">lista de discussão</a> do AUGRS ( Adobe User Group Rio Grande do Sul).</p>
<p>Aos demais, estaremos em contato, porém agora Inglês.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.filipesilvestrim.com/blog/20/02/2008/from-now-on-just-english/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>O que é Singularity?</title>
		<link>http://www.filipesilvestrim.com/blog/29/01/2008/o-que-e-singularity/</link>
		<comments>http://www.filipesilvestrim.com/blog/29/01/2008/o-que-e-singularity/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 01:09:26 +0000</pubDate>
		<dc:creator>Filipe Silvestrim</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.filipesilvestrim.com/blog/29/01/2008/o-que-e-singularity/</guid>
		<description><![CDATA[Bom pessoal, voltando a blogar depois de um tempo (espero não perder o pique novamente por conta de muito trabalho, conforme aconteceu).
Afinal de contas, agora até eu andei ficando curioso com esse tal de Singularity do Aral Balkan.
Afinal de contas, o que é o Singularity? Uma nova Tecnologia em Flash? RIA? Um site em Web [...]]]></description>
			<content:encoded><![CDATA[<p>Bom pessoal, voltando a blogar depois de um tempo (espero não perder o pique novamente por conta de muito trabalho, conforme aconteceu).</p>
<p>Afinal de contas, agora até eu andei ficando curioso com esse tal de <a href="http://singularity08.com/" title="What is Singularity?">Singularity</a> do <a href="http://aralbalkan.com/" title="Aral Balkan" target="_blank">Aral Balkan</a>.</p>
<p>Afinal de contas, o que é o Singularity? Uma nova Tecnologia em Flash? RIA? Um site em Web 2.0?</p>
<p>Como a curiosidade é tanta, estou colocando essa imagem no meu blog para ser um dos primeiros a saber o que que é isso!  Logo que sair a descrição ou mesmo for lançada alguma coisa estarei aqui falando.</p>
<p><a href="http://singularity08.com"></a></p>
<p><a href="http://singularity08.com"></a></p>
<p style="text-align: center"><a href="http://singularity08.com"><img src="http://singularity08.com/images/teaser/button_468x60.gif" alt="Singularity?" height="60" width="468" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.filipesilvestrim.com/blog/29/01/2008/o-que-e-singularity/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Papervision3D 2.0 Alpha</title>
		<link>http://www.filipesilvestrim.com/blog/04/12/2007/papervision3d-20-alpha/</link>
		<comments>http://www.filipesilvestrim.com/blog/04/12/2007/papervision3d-20-alpha/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 05:46:12 +0000</pubDate>
		<dc:creator>Filipe Silvestrim</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.filipesilvestrim.com/blog/04/12/2007/papervision3d-20-alpha/</guid>
		<description><![CDATA[&#160;
Foi lançada hoje de madrugada a tão esperada versão 2.o da Biblioteca Papervision 3D.
&#160;
Na nova versão possuímos recursos tais como: ShadeMaterials, Shaders, ASCollada (agora com suporte a animação), Frustrum Culling, Multiple Viewports, Render to Scene e muito mais&#8230;
&#160;
Para quem quiser ter uma idéia do que podemos fazer no a nova versão dê uma olhada no [...]]]></description>
			<content:encoded><![CDATA[<p class="entry">&nbsp;</p>
<p class="snap_preview">Foi lançada hoje de madrugada a tão esperada versão 2.o da Biblioteca Papervision 3D.</p>
<p class="snap_preview">&nbsp;</p>
<p class="snap_preview">Na nova versão possuímos recursos tais como: ShadeMaterials, Shaders, ASCollada (agora com suporte a animação), Frustrum Culling, Multiple Viewports, Render to Scene e muito mais&#8230;</p>
<p class="snap_preview">&nbsp;</p>
<p class="snap_preview">Para quem quiser ter uma idéia do que podemos fazer no a nova versão dê uma olhada no link abaixo que exemplifica aplicação de iluminação de phong e bumpMapping.</p>
<p class="snap_preview">swf:<br />
<a href="http://www.rockonflash.com/papervision3d/downloads/shaderDemos/EarthPhongDemo.swf" target="_blank"> http://www.rockonflash.com<wbr></wbr>/papervision3d/downloads<wbr></wbr>/shaderDemos/EarthPhongDemo.swf</a></p>
<p>FLA:<br />
<a href="http://www.rockonflash.com/papervision3d/downloads/shaderDemos/EarthPhongDemo.fla" target="_blank">http://www.rockonflash.com<wbr></wbr>/papervision3d/downloads<wbr></wbr>/shaderDemos/EarthPhongDemo.fla  </a></p>
<p class="snap_preview">&nbsp;</p>
<p class="snap_preview">Então aproveite agora mesmo para fazer o download da nova versão a partir do SVN no endereço: <tt><strong><em>http</em></strong>://papervision3d.googlecode.com/svn/trunk/</tt></p>
<p class="snap_preview">&nbsp;</p>
<p class="snap_preview">Abraços.</p>
<p class="entry">&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.filipesilvestrim.com/blog/04/12/2007/papervision3d-20-alpha/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
