<?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>Yarrcade.com &#187; Flash</title>
	<atom:link href="http://www.yarrcade.com/tag/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.yarrcade.com</link>
	<description>A heavy metal pirate&#039;s blog about free online flash games and their monetization as well as game design and development tutorials with actionscript3 and flash cs3 and some tricks to outperform in Microsoft Office ...</description>
	<lastBuildDate>Thu, 15 Sep 2011 15:05:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>More Moving 3D Environments in Flash</title>
		<link>http://www.yarrcade.com/2010/12/11/more-moving-3d-environments-in-flash/</link>
		<comments>http://www.yarrcade.com/2010/12/11/more-moving-3d-environments-in-flash/#comments</comments>
		<pubDate>Sat, 11 Dec 2010 18:58:26 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[grids]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[CS3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=1558</guid>
		<description><![CDATA[A little further experiment with 3D makes me want to play LHX or D-Track. If the movie does not react to keyboard input, click once inside of it to give it focus. There are a lot of optimization opportunities, though &#8230; <a href="http://www.yarrcade.com/2010/12/11/more-moving-3d-environments-in-flash/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="contentthumb"><img src="http://www.yarrcade.com/wp-content/uploads/2010/12/3Dexp1.png" alt="Moving 3D Environments" title="Moving 3D Environments" width="100" height="100"></div>
<p>A little further experiment with 3D makes me want to play <a href="http://en.wikipedia.org/wiki/LHX_Attack_Chopper" target="_blank">LHX</a> or <a href="http://en.wikipedia.org/wiki/Death_track" target="_blank">D-Track</a>.</p>
<p><span id="more-1558"></span></p>
<div class="centerswf">
<embed src="http://www.yarrcade.com/wp-content/uploads/2010/12/drunk11.swf" width="640" height="480"></embed>
</div>
<p>If the movie does not react to keyboard input, click once inside of it to give it focus.</p>
<p>There are a lot of optimization opportunities, though the frame rate seems to be pretty stable. Smoothing the terrain could be next, depth sorting is obviuosly not the best. Well, that&#8217;s what weekends are for, right?</p>
<p>Source? Sure: <a href="http://www.yarrcade.com/wp-content/uploads/2010/12/drunk11.zip" target="_blank">ZIP (13.9 KB)</a></p>
<p>Please tell me in the comments if it works for you and if you experience any lags.</p>
<p>Yoho!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2010/12/11/more-moving-3d-environments-in-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What are game developers doing while NOT developing?</title>
		<link>http://www.yarrcade.com/2009/08/19/what-are-game-developers-doing-while-not-developing/</link>
		<comments>http://www.yarrcade.com/2009/08/19/what-are-game-developers-doing-while-not-developing/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 10:48:53 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=640</guid>
		<description><![CDATA[Just a qestion that made me think a bit. I know that some of them must be professional game designers or at least some sort of programmers. Others are students. How about you? Yoho! EDIT: Hey, that&#8217;s a question.]]></description>
			<content:encoded><![CDATA[<p>Just a qestion that made me think a bit. I know that some of them must be professional game designers or at least some sort of programmers. Others are students. How about you?<br />
<span id="more-640"></span></p>
<p>Yoho!</p>
<p>EDIT: Hey, that&#8217;s a question.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2009/08/19/what-are-game-developers-doing-while-not-developing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3: Creating a game like circle chain</title>
		<link>http://www.yarrcade.com/2009/08/18/as3-creating-a-game-like-circle-chain/</link>
		<comments>http://www.yarrcade.com/2009/08/18/as3-creating-a-game-like-circle-chain/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 19:43:02 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[game development]]></category>
		<category><![CDATA[mochiads]]></category>
		<category><![CDATA[API integration]]></category>
		<category><![CDATA[chain reaction game]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[kongregate]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[version encryption issue]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=614</guid>
		<description><![CDATA[This game was inspired by Emanuele Feronato&#8217;s Circle Chain game and as he posted the AS2 code I took it and converted is to a basic AS3 chain reaction game.This tutorial also covers the mochi encryption issues and the possibility &#8230; <a href="http://www.yarrcade.com/2009/08/18/as3-creating-a-game-like-circle-chain/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="contentthumb"><img title="The Chain Reaction Game" src="http://www.natan.info/yarrcade/gamefiles/the-chain-reaction-tutorial/_thumb_100x100.png" alt="The Chain Reaction Game"/></div>
<p>This game was inspired by Emanuele Feronato&#8217;s Circle Chain game and as he posted the <a href="http://www.emanueleferonato.com/2007/11/25/experiment-monetizing-a-flash-game-part-5" target="_blank">AS2 code</a> I took it and converted is to a basic AS3 chain reaction game.This tutorial also covers the mochi encryption issues and the possibility to load different APIs despite those.<br />
<span id="more-614"></span></p>
<p>Here is the DocumentClass called ScreenGame, it includes MochiAds and the Kongregate API that is only loaded when the game is <a href="http://www.kongregate.com/games/kegogrog/the-chain-reaction-tutorial" target="_blank">played on Kongregate</a>. This class is somewhat bloated because I just made it as tutorial and didn&#8217;t want to put to mujch effort in the game&#8217;s stucture (title screen, help screen, etc.) but then included too much features (nay, not too much but two tutorials at once because you can&#8217;t test the MochiAds thing without a game&#8230;)</p>
<pre lang="ActionScript" colla="-">
package {
	import flash.display.Loader;
	import flash.display.LoaderInfo;
	import flash.display.Stage;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	import flash.events.Event;
	import flash.text.TextField;
	import flash.ui.Mouse;
	import flash.ui.ContextMenu;
	import flash.ui.ContextMenuItem;
	import flash.events.ContextMenuEvent;
	import flash.net.navigateToURL;
	import flash.net.URLRequest;
	import flash.media.SoundChannel;
	import mochi.as3.*

	public class ScreenGame extends MovieClip {

		public var bullet:MovieClip;
		public var bulletArray:Array;
		public var startX:Number;
		public var startY:Number;
		public var bulletDir:Number;
		public var gameTimer:Timer;

		public var monomer:MovieClip;
		public var monomerArray:Array;
		public var maxMonomer:int;

		public var levelText:MovieClip;
		public var levelDesc:Array;

		public var textOn:Boolean;
		public var gameStarted:Boolean;

		public var levelNumber:int;

		public var blueArray:Array;
		public var pinkArray:Array;
		public var greyArray:Array;
		public var blackArray:Array;
		public var killArray:Array;
		public var monomerKilled:int;

		public var monomerHolder:MovieClip;
		public var bulletHolder:MovieClip;

		public var lostAnyway:Boolean;

		public var counter:int;

		public var cMenu:ContextMenu;
		public var cMenuHomePage:ContextMenuItem;
		public var cMenuCopyRight:ContextMenuItem;

		public var soundFail:SoundFail;
		public var sfxSoundChannel:SoundChannel;

		public var kongregate:*;
</pre>
<p>All the includes that are needed. The level design is done via the blue, pink, grey, black and kill arrays.</p>
<pre lang="ActionScript">
		public function ScreenGame () {

			MochiBot.track(this, "xxxxxxxx");
			var _mochiads_game_id:String = "xxxxxxxxxxxxxxxx";

			this.addEventListener(Event.ADDED_TO_STAGE, initGame, false, 0, true);

		}
</pre>
<p>The EventListener is added to make the game work with the MochiAds Encryption and Version Control wrapper. Setting up the game directly in here would lead to a failure.</p>
<pre lang="ActionScript">
		public function initGame(event:Event) {

			//Need that to get the real url:
			var domainCheck = LoaderInfo(root.loaderInfo.loader.loaderInfo).url;

			//That would be used without Mochi's Encryption:
			//var domainCheck = LoaderInfo(root.loaderInfo).url;

			if ( domainCheck.indexOf("natan") >= 0 ) {
				domainName.text = "playing at blog.natan.info";
			}

			else if ( domainCheck.indexOf("kongregate") >= 0 ) {

				// Pull the API path from the FlashVars
				var paramObj:Object = LoaderInfo(root.loaderInfo.loader.loaderInfo).parameters;
				// The API path. The debug version ("shadow" API) will load if testing locally.
				var api_url:String = paramObj.api_path || "http://www.kongregate.com/flash/API_AS3_Local.swf";
				// Debug
				trace ( "API path: " + api_url );
				// Load the API
				var request:URLRequest = new URLRequest ( api_url );
				var loader:Loader = new Loader();
				loader.contentLoaderInfo.addEventListener ( Event.COMPLETE, loadComplete );
				loader.load ( request );
				this.addChild ( loader );
				//Kongregate API reference
				//done in public vars
				//var kongregate:*
				// Called when API swf finishes loading
				function loadComplete ( event:Event ):void {
				    // Save Kongregate API reference
				    kongregate = event.target.content;
				    // Connect
				kongregate.services.connect();
				    // Debug our services
					trace ( "\n" + kongregate.services );
					trace ( "\n" + kongregate.user );
			    	trace ( "\n" + kongregate.scores );
			    	trace ( "\n" + kongregate.stats );
				}
				domainName.text = " playing at Kongregate";
			}

			else {
				domainName.text = "blog.natan.info";
			}
</pre>
<p>That is the domain check to be used with the MochiAds wrapper. I tested it with the Kongregate API and it seems to work.</p>
<pre lang="ActionScript">
			cMenu = new ContextMenu();
			cMenu.hideBuiltInItems();
			cMenuHomePage = new ContextMenuItem("LÞ the keg'o'grog blog");
			cMenuCopyRight = new ContextMenuItem("© - 2009 _ 1.0");
			cMenuCopyRight.enabled = false;
			cMenuCopyRight.separatorBefore = true;
			cMenuHomePage.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, goToHomePage, false, 0, true);
			cMenu.customItems.push(cMenuHomePage, cMenuCopyRight);
			this.contextMenu = cMenu;

			soundFail = new SoundFail ();
</pre>
<p>Custom context menu and the &#8216;plopp&#8217; sound.</p>
<pre lang="ActionScript">
			levelNumber = 0;
			bulletArray = new Array();
			monomerArray = new Array();
			//level number           1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20
			blueArray = new Array  ( 3,  0,  0,  0,  3,  3,  2, 25,  5,  0, 10,  2,  1, 10,  0,  5,  0, 25,  2, 20);
			pinkArray = new Array  ( 0,  0,  0,  2,  1,  2,  3,  0,  1,  5,  0,  1,  1,  0,  1,  0,  6,  0,  1, Math.round(Math.random()));
			greyArray = new Array  ( 0,  3,  0,  0,  0,  1,  2,  0,  4,  1, 10,  1,  1, 10,  0,  5,  0, 20,  2, 20);
			blackArray = new Array ( 0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 10,  5,  5,  2,  5,  2, 20);
			killArray = new Array  ( 1,  1,  1,  0,  1,  2,  2, 24,  5,  1, 18,  3,  3, 30,  1, 13,  1, 50,  5,  0);
			levelDesc = new Array () ;
			levelDesc [0] = "LEVEL 1\n\nStart the first explosion with a click and try to start a chain reaction.";
			levelDesc [1] = "LEVEL 2\n\nThe number above shows how much goobies have to explode.";
			levelDesc [2] = "LEVEL 3\n\nClick anywhere to start.";
			levelDesc [3] = "LEVEL 4\n\nThe stars are not to be hit. Period.";
			levelDesc [4] = "LEVEL 5\n\nThe first combination.";
			levelDesc [5] = "LEVEL 6\n\nTry this!";
			levelDesc [6] = "LEVEL 7\n\nThis might be hard but the next will be fun.";
			levelDesc [7] = "LEVEL 8\n\nWow! Have fun!";
			levelDesc [8] = "LEVEL 9\n\nThis is possible.";
			levelDesc [9] = "LEVEL 10\n\nOne is the loneliest number. The grey Goobie knows...";
			levelDesc [10] = "LEVEL 11\n\nAll for one or one for all?";
			levelDesc [11] = "LEVEL 12\n\nEasy?";
			levelDesc [12] = "LEVEL 13\n\nAll together now!";
			levelDesc [13] = "LEVEL 14\n\nNow you really need all.";
			levelDesc [14] = "LEVEL 15\n\nYeah, one is all you need.";
			levelDesc [15] = "LEVEL 16\n\nPhew! This will be easy.";
			levelDesc [16] = "LEVEL 17\n\nTwo can be as bad as one...";
			levelDesc [17] = "LEVEL 18\n\nAll! This time for real.\nMass destruction!";
			levelDesc [18] = "LEVEL 19\n\nLast level. Then back to work.";
			levelDesc [19] = "DONE!\n\nCongratulations! Check out the Tutorial and other games at\n\nblog.natan.info"

			setupGame();

		}
</pre>
<p>This is the level design. The arrays blue, pink, grey and black hold the number of monomers, the killArray holds the number of enemies that must explode in the level. There is a random chance that after finishing level 19 there is no star in the mass of goobies.</p>
<pre lang="ActionScript">
		public function setupGame () {

			Mouse.show();
			this.addEventListener(Event.ENTER_FRAME, enterFrameHandler, false, 0, true);
			gameStarted = false;
			textOn = true;
			monomerKilled = 0;
			lostAnyway = false;
			monomerHolder = new MovieClip();
			bulletHolder = new MovieClip();
			this.addChild(monomerHolder);
			this.addChild(bulletHolder);
			this.addChild(monomerKillText);

			monomerHolder.mouseChildren = false;
			bulletHolder.mouseChildren = false;

			for (counter = 0; counter <= blueArray[levelNumber] -1 ; counter++ ) {
				monomer = new Monomer(this, "blue");
				monomer.x = Math.random()*640;
				monomer.y = Math.random()*480;
				monomer.mouseEnabled = false;
				monomerArray.push(monomer);
				monomerHolder.addChild(monomer);
			}

			for ( counter = 0; counter <= pinkArray[levelNumber] -1 ; counter++ ) {
				monomer = new Monomer(this, "pink");
				monomer.x = Math.random()*640;
				monomer.y = Math.random()*480;
				monomer.mouseEnabled = false;
				monomerArray.push(monomer);
				monomerHolder.addChild(monomer);
			}

			for ( counter = 0; counter <= greyArray[levelNumber] -1 ; counter++ ) {
				monomer = new Monomer(this, "grey");
				monomer.x = Math.random()*640;
				monomer.y = Math.random()*480;
				monomer.mouseEnabled = false;
				monomerArray.push(monomer);
				monomerHolder.addChild(monomer);
			}

			for ( counter = 0; counter <= blackArray[levelNumber] -1 ; counter++ ) {
				monomer = new Monomer(this, "black");
				monomer.x = Math.random()*640;
				monomer.y = Math.random()*480;
				monomer.mouseEnabled = false;
				monomerArray.push(monomer);
				monomerHolder.addChild(monomer);
			}

			levelText = new LevelText();
			levelText.textArea.text = levelDesc[levelNumber];
			this.addChild(levelText);
			levelText.addEventListener(MouseEvent.CLICK, removeText, false, 0, true);
		}
</pre>
<p>Every array is checked and the given number of monomers is placed to the holderClip (to completely remove everything and level end) and an array for hittesting purposes.</p>
<pre lang="ActionScript">
		public function removeText(event:MouseEvent) {
			levelText.removeEventListener(MouseEvent.CLICK, removeText);
			levelText.visible = false;
			stage.addEventListener(MouseEvent.CLICK, releaseMouseBullet, false, 0, true);
		}
</pre>
<p>The level description overlay is removed.</p>
<pre lang="ActionScript">

		public function releaseMouseBullet (event:MouseEvent) {
			if (textOn == true ) {
				textOn = false;
			}
			else {
				Mouse.hide();
				addVerticalBullet(mouseX, mouseY);
				stage.removeEventListener(MouseEvent.CLICK, releaseMouseBullet);
				gameStarted = true;
			}
		}
</pre>
<p>As it is a one-click-per-level game the listener is removed after the click.</p>
<pre lang="ActionScript">
		public function addVerticalBullet (startX, startY) {
			for (counter = 0; counter <= 3; counter++) {
				bulletDir = Math.PI * 0.5 * counter;
				bullet = new Bullet(this, bulletDir);
				bullet.x = startX;
				bullet.y = startY;
				bulletArray.push(bullet);
				bulletHolder.addChild(bullet);
			}
		}

		public function addDiagonalBullet (startX, startY) {
			for (counter = 0; counter <= 3; counter++ ) {
				bulletDir = Math.PI * 0.5 * (counter + 0.5);
				bullet = new Bullet(this, bulletDir);
				bullet.x = startX;
				bullet.y = startY;
				bulletArray.push(bullet);
				bulletHolder.addChild(bullet);
			}
		}
</pre>
<p>All you need is math: PI*0.5 means 90°.</p>
<pre lang="ActionScript">

		public function enterFrameHandler (event:Event) {
			for each ( bullet in bulletArray ) {
				bullet.moveBullet();
			}
			for each ( monomer in monomerArray ) {
				monomer.moveMonomer ();
			}
			bulletArrayLength.text = bulletArray.length.toString();
			monomerKillText.text = monomerKilled.toString()+" / "+killArray[levelNumber].toString();
			monomerArrayLength.text = monomerArray.length.toString();
			if(gameStarted == true ) {
				if(bulletArray.length == 0 || lostAnyway || monomerArray.length == 0) {
					if ( monomerKilled >= killArray[levelNumber] &#038;&#038; !lostAnyway ) {
						if ( levelNumber < 19 ) {
							levelNumber++;
						}
					}
					this.removeChild(monomerHolder);
					this.removeChild(bulletHolder);
					monomerArray.splice(0, monomerArray.length);
					bulletArray.splice(0, bulletArray.length);
					setupGame();
				}
			}
		}
</pre>
<p>The game itself: at every frame (framerate set to 30) every bullet and monomer is moved. With mouse click you set the gameStarted to true. That means there are four bullets on stage, once all bullets are removed the game should be over OR if a star is hit lostAnyway is set true and the level is immediately over OR if all monomers are removed (and no star) the level is passed. As long as there are levels the number is increased. One could direct the player to the score table with an 'else if' at this point. After all, the stage is purged and the next level is set up.</p>
<pre lang="ActionScript">
		public function removeBullet (which) {
			if(bulletHolder.contains(which)){
				bulletHolder.removeChild (which);
				//which.alpha = 0.5;
				bulletArray.splice(bulletArray.indexOf(which), 1);
			}
		}

		public function removeMonomer (which) {
			if(monomerHolder.contains(which)){
				sfxSoundChannel = soundFail.play();
				monomerHolder.removeChild (which);
				//which.alpha = 0.5;
				monomerArray.splice(monomerArray.indexOf(which), 1);
				monomerKilled++;
			}
		}
		public function goToHomePage(event:ContextMenuEvent){
			var homeRequest = new URLRequest("http://blog.natan.info");
			navigateToURL(homeRequest, "_blank");
		}
	}
}
</pre>
<p>The Monomer Class includes PixelPerfectCollisionTesting by <a href="http://www.troygilbert.com" target="_blank">Troy Gilbert</a> that is explained a bit at <a href="http://gamedev.michaeljameswilliams.com/2009/02/10/avoider-game-tutorial-6/" target="_blank">Michael's Blog</a>.</p>
<pre lang="ActionScript">
package {
	import flash.display.MovieClip;

	public class Monomer extends MovieClip {

		public var clipRef:MovieClip;
		public var bulletDir:Number;
		public var xSpeed:Number;
		public var ySpeed:Number;
		public var sType:String;
		public var monomerDir:Number;

		public function Monomer (clipRef, sType:String = "blue") {
			this.clipRef = clipRef;
			this.sType = sType;
			this.gotoAndStop(this.sType);
			monomerDir = Math.PI * Math.random() * 2;
			this.rotation = this.monomerDir*180/Math.PI;
			this.xSpeed = Math.cos(monomerDir)*1.5;
			this.ySpeed = Math.sin(monomerDir)*1.5;
			//this.scaleX = this.scaleY = 0.75;
		}

		public function moveMonomer () {

			this.x += this.xSpeed;
			this.y += this.ySpeed;

			for each ( var bullet in clipRef.bulletArray ) {

				//if ( this.hitTestPoint(bullet.x, bullet.y, true )) {
				if (PPCD.isColliding(this, bullet, clipRef, true)){
					if ( this.sType == "blue" ) {
						if(clipRef.bulletArray.length < 150){
						clipRef.addVerticalBullet(this.x, this.y);
						}
					}
					if ( this.sType == "pink" ) {
						clipRef.lostAnyway = true;
					}
					if ( this.sType == "grey" ) {
						if(clipRef.bulletArray.length < 150){
						clipRef.addDiagonalBullet(this.x, this.y);
						}
					}
					if ( this.sType == "black" ) {
						if(clipRef.bulletArray.length < 150){
						clipRef.addVerticalBullet(this.x, this.y);
						clipRef.addDiagonalBullet(this.x, this.y);
						}
					}
					clipRef.removeMonomer(this);
				}
			}

			if ( this.x < -20 ) { this.x = 660; }
			if ( this.x > 660 ) { this.x = -20; }
			if ( this.y < -20 ) { this.y = 500; }
			if ( this.y > 500 ) { this.y = -20; }
		}
	}
}
</pre>
<p>sType is used to set up the color of the monomer. The Monomer clip has four frames labelled 'blue', 'pink' etc. If everything should be animated then I would recommend using an extra 'monomerGrapic' clip and add this to the monomer (which then holds no graphic itself'.</p>
<p>And the Bullet Class:</p>
<pre lang="ActionScript">
package {
	import flash.display.MovieClip;

	public class Bullet extends MovieClip {

		public var clipRef:MovieClip;
		public var bulletDir:Number;
		public var xSpeed:Number;
		public var ySpeed:Number;

		public function Bullet (clipRef, bulletDir) {
			this.clipRef = clipRef;
			this.bulletDir = bulletDir;
			this.xSpeed = Math.cos(bulletDir)*5;
			this.ySpeed = Math.sin(bulletDir)*5;
		}

		public function moveBullet () {
			this.x += this.xSpeed;
			this.y += this.ySpeed;

			if ( this.x < 0 ) { clipRef.removeBullet(this); }
			if ( this.x > 640 ) { clipRef.removeBullet(this); }
			if ( this.y < 0 ) { clipRef.removeBullet(this); }
			if ( this.y > 480 ) { clipRef.removeBullet(this); }
		}
	}
}
</pre>
<p>Myke them bounce or add gravity, lots of possibilities.</p>
<p>And that is the final result:</p>
<div class="ads">
<embed src="http://games.natan.info/the-chain-reaction-tutorial/CRT.swf" width="480" height="360">
</div>
<p>There are unlimited possibilities: As the score you could count the number of tries, the time needed, the number of exploded goobies, etc.</p>
<p>Well, you can come up with questions, mateys.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2009/08/18/as3-creating-a-game-like-circle-chain/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Game: Piece o&#8217;Eight II</title>
		<link>http://www.yarrcade.com/2009/07/21/game-piece-oeight-ii/</link>
		<comments>http://www.yarrcade.com/2009/07/21/game-piece-oeight-ii/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 01:33:33 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[game development]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[mochiads]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[kegogrog]]></category>
		<category><![CDATA[piece o eight II]]></category>
		<category><![CDATA[piece o'eight II]]></category>
		<category><![CDATA[pirate]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=494</guid>
		<description><![CDATA[Basically it&#8217;s the first game, but this time it has a goal. Still on the experiment road. I am a bit excited. I wonder what the best weekday is to push it into the world. I think I&#8217;ll go through &#8230; <a href="http://www.yarrcade.com/2009/07/21/game-piece-oeight-ii/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="contentthumb"><img title="The Piece o' Eight Game II _ Thumbnail" src="http://www.natan.info/yarrcade/gamefiles/piece-o-eight-II/_thumb_100x100.png" alt="The Piece o' Eight Game II"/></div>
<p>Basically it&#8217;s the first game, but this time it has a goal. Still on the experiment road. I am a bit excited. I wonder what the best weekday is to push it into the world. I think I&#8217;ll go through the mochibot stats to find something.<br />
<span id="more-494"></span></p>
<p><so, second game. Features:</p>
<ul>
<li>some clickety-click</li>
<li>score and highscore</li>
<li>sound effects</li>
<li>custom cursor</li>
<li>custom context menu</li>
</ul>
<div class="ads"><a href="http://blog.natan.info/piece-o-eight-II/">PLAY HERE</a></div>
<p>Another version includes the Kongregate API.</p>
<p>Be ye a gamer. Yo ho!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2009/07/21/game-piece-oeight-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monetizing flash games: Distribution</title>
		<link>http://www.yarrcade.com/2009/07/03/monetizing-flash-games-distribution/</link>
		<comments>http://www.yarrcade.com/2009/07/03/monetizing-flash-games-distribution/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 01:25:49 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[game development]]></category>
		<category><![CDATA[mochiads]]></category>
		<category><![CDATA[monetization]]></category>
		<category><![CDATA[distribution]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[kongregate]]></category>
		<category><![CDATA[mochi]]></category>
		<category><![CDATA[newgrounds]]></category>
		<category><![CDATA[portal]]></category>
		<category><![CDATA[publishing]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=391</guid>
		<description><![CDATA[My flash game monetization experiment results. <a href="http://www.yarrcade.com/2009/07/03/monetizing-flash-games-distribution/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well, I have to give a positive statement about game distribution with mochi&#8217;s service and little self efforts. Apart from the fact that the game was made in three hours and it really is no masterpiece, it got round quite a bit. At least I was amazed.<br />
<span id="more-391"></span></p>
<p>I would say: every developer, include a mochibot (if you care for statistics). These are the results after two weeks:</p>
<div id="attachment_390" class="wp-caption alignnone" style="width: 412px"><a href="http://blog.natan.info/wp-content/uploads/2009/07/poe_2week_stat.PNG"><img src="http://blog.natan.info/wp-content/uploads/2009/07/poe_2week_stat.PNG" alt="2 weeks in the wild..." title="poe_2week_stat" width="402" height="127" class="size-full wp-image-390" /></a><p class="wp-caption-text">2 weeks in the wild...</p></div>
<p>Personally I just submitted the game to two portals, <a href="http://www.newgrounds.com/refer/kegogrog" target="_blank">NG</a> and <a href="http://www.kongregate.com/?referrer=kegogrog" target="_blank">Kong</a>. I did not include APIs other than Mochiads, but I&#8217;ll definitely do that next time.</p>
<div id="attachment_392" class="wp-caption alignnone" style="width: 493px"><a href="http://blog.natan.info/wp-content/uploads/2009/07/poe_2week_host.PNG"><img src="http://blog.natan.info/wp-content/uploads/2009/07/poe_2week_host.PNG" alt="extra effort pays" title="poe_2week_host" width="483" height="266" class="size-full wp-image-392" /></a><p class="wp-caption-text">extra effort pays</p></div>
<p>Mochi distribution works very well for getting it round to several hosts. On the other hand, my personal submission efforts make up for a big share in the game&#8217;s traffic. I made more with <a href="http://www.kongregate.com/?referrer=kegogrog" target="_blank">Kong</a> than with mochi and realized to late that <a href="http://www.newgrounds.com/refer/kegogrog" target="_blank">NG</a> also shares revenue. DON&#8217;T forget to check that! Overall my experience hunt on API integration, publishing and related paid out with about 1$. That way more than I hoped for (really!). With a real game, this could have been something.</p>
<p>With that said, roam on me mateys. Yo ho!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2009/07/03/monetizing-flash-games-distribution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Game: Piece o&#8217;Eight</title>
		<link>http://www.yarrcade.com/2009/06/18/game-piece-o-eight/</link>
		<comments>http://www.yarrcade.com/2009/06/18/game-piece-o-eight/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 20:47:02 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[mochiads]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[kegogrog]]></category>
		<category><![CDATA[piece o eight]]></category>
		<category><![CDATA[piece o'eight]]></category>
		<category><![CDATA[pirate]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=336</guid>
		<description><![CDATA[Basically it&#8217;s the thing I wrote for the shared objects tutorial. Just added some other graphics. It is my approach to begin the experiment. That &#8216;game&#8217; won&#8217;t get any good score, on the other hand: it&#8217;s just a test. So, &#8230; <a href="http://www.yarrcade.com/2009/06/18/game-piece-o-eight/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="contentthumb"><img src="http://www.natan.info/yarrcade/gamefiles/piece-o-eight/_thumb_100x100.png" alt="The Piece o&#039;Eight Game" title="The Piece o&#039;Eight Game _ Thumbnail"/></div>
<p>Basically it&#8217;s the thing I wrote for the shared objects tutorial. Just added some other graphics. It is my approach to begin the experiment. That &#8216;game&#8217; won&#8217;t get any good score, on the other hand: it&#8217;s just a test.<br />
<span id="more-336"></span></p>
<p>So, first game.<br />
Features:</p>
<ul>
<li>some clickety-click</li>
<li>score and highscore</li>
</ul>
<div class="ads">
<a href="http://blog.natan.info/piece-oeight/">PLAY HERE</a></div>
<p>Still got to insert some music and a custom cursor&#8230; Testing the power of mochis version control. I did already make a change to it and well, it&#8217;s updated.</p>
<p>Be ye a gamer. Yo ho!</p>
<p>edit 2009-06-20: cursor added<br />
edit 2009-06-21: leaderboard added, positive experience with mochi&#8217;s verson control so far</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2009/06/18/game-piece-o-eight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial: Sharing shared objects between games/applications</title>
		<link>http://www.yarrcade.com/2009/06/06/tutorial-sharing-shared-objects-between-gamesapplications/</link>
		<comments>http://www.yarrcade.com/2009/06/06/tutorial-sharing-shared-objects-between-gamesapplications/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 15:46:59 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[game development]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[savegame]]></category>
		<category><![CDATA[sharedobject]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=193</guid>
		<description><![CDATA[This topic came up some days ago with a lot of interesting possibilities especially for flash games. One shared object holding several variables you can load from every game. What could that mean? A regular player of your games gets &#8230; <a href="http://www.yarrcade.com/2009/06/06/tutorial-sharing-shared-objects-between-gamesapplications/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><!--start_raw--></p>
<p>This topic came up <a href="http://blog.natan.info/2009/06/04/idea-sharing-shared-objects-between-gamesapplications/">some days ago</a> with a lot of interesting possibilities especially for flash games. One shared object holding several variables you can load from every game. What could that mean? A regular player of your games gets <em>secret levels, special items or skills</em> for playing a game more often. Or let the player compare his actual score to the scores he achieved in other games you made, if these are comparable. Or an adventurelike game where one has to <em>solve puzzles in external games</em> or where <em>achievements in other games control the plot</em>.</p>
<p>Alright, enough of the dreaming, let&#8217;s go to where the action is:</p>
<p><span id="more-193"></span></p>
<p><b>The sending application</b></p>
<p>Make youself familiar with Saving and Loading in Flash by reading <a href="http://gamedev.michaeljameswilliams.com/2009/03/18/avoider-game-tutorial-11/" target="_blank">this tutorial</a> or <a href="http://www.emanueleferonato.com/2008/12/28/understanding-as3-shared-objects/">this tutorial</a>. Thanks to Michael and Emanuele for this. You should also bookmark their blogs, these guys are doing great stuff. Inspirado!</p>
<p>Today we are going to create a simple one-screen application which generates a score that is saved to a local shared object. The fla&#8217;s name is SharedObjectTutorial.fla with DocumentClass1.as as the document class. The important parts of the DocumentClass:</p>
<p><code>
<pre>
package
{
  import flash.display.MovieClip;
  import flash.text.TextField;
  import flash.ui.Mouse;
  import flash.events.MouseEvent;
  import flash.utils.Timer;
  import flash.events.TimerEvent;
  import flash.net.SharedObject;
  import flash.system.Security;</pre>
<p></code></p>
<p>Since Flash 7, shared objects are stored with a complete URL of the application. With the import of flash.system.Security we have the possbility of switching to the version 6 mode. Back then only the last two components of a URL was used so subdomains did save their shared objects to the same place. That was example.com, games.example.com and forum.example.com all used the storage of example.com.</p>
<p><code>
<pre>
  public class DocumentClass1 extends MovieClip
  {
    public var sharedObject:SharedObject;
    public var score:Number = 0;
    public var gameTimer:Timer;
    public function DocumentClass1()
    {
      Security.exactSettings = false;</pre>
<p></code></p>
<p>As stated, with Security.exactSetting set to false we can save all data to one place.</p>
<p><code>
<pre>
      loadSave();
</pre>
<p></code></p>
<p>A function is called that takes care of all the loading and saving.</p>
<p><code>
<pre>
    }
    public function loadSave()
    {
      sharedObject = SharedObject.getLocal( "kegogrogscores", "/" );</pre>
<p></code></p>
<p>getLocal creates and reads a shared object, the slash is import because without every swf would create its own path to the file sharedObject.data.gameName01_gamePlayed = 1; that is the way of assigning variables to data in the shared object, in this case we&#8217;ll tell that this game is played on this computer.</p>
<p><code>
<pre>
      if( sharedObject.data.gameName01_scoreName01 == null || score &gt; sharedObject.data.gameName01_scoreName01)
      {
        sharedObject.data.gameName01_scoreName01 = score;
      }
</pre>
<p></code></p>
<p>When saving from more than one game to file, make sure the names are not the same, otherwise you could overwrite your precious savegame.<br />
If the local object holds no information or the the actual value is greater than the saved value this path will assign numbers to the variables we try to get from the harddrive.</p>
<p><code>
<pre>
      savedScore.text = sharedObject.data.gameName01_scoreName01.toString();
      scoreDisplay.text = score.toString();
</pre>
<p></code></p>
<p>Just two textfields showing information.</p>
<p><code>
<pre>
      sharedObject.flush();
    }
  }
}</pre>
<p></code></p>
<p>With flush() information is saved to the disk. Otherwise the local object is updated only on closing the application. Complete missing here is a game code. But that is not a part of this tut. Here is a flash movie based on the above approach:</p>
<div class="ads">
<embed src="http://www.natan.info/blog/wp-content/uploads/2009/06/sharedobjecttutorial1.swf" width="550" height="400"></embed></div>
<p>As a result you now have a shared object on your harddrive (in case your flash players security settings allowed). It contains two values, one states that this gae is played, the other tells the highscore. Phew! You can test this by making some score and refreshing the page. The highscore should be there now.</p>
<p><b>The receiving application</b></p>
<p>At this point the second file is nearly a copy of the first.</p>
<p><code>
<pre>
package
{
  import flash.display.MovieClip;
  import flash.net.SharedObject;
  import flash.text.TextField;
  import flash.system.Security;
  import flash.display.SimpleButton;
  import flash.ui.Mouse;
  import flash.events.MouseEvent;
  public class DocumentClass2 extends MovieClip
  {
    public var sharedObject:SharedObject;
    public function DocumentClass2()
    {
      Security.exactSettings = false;
      loadScore();
      clearButton.addEventListener(MouseEvent.CLICK, clearButtonHandler);
      loadButton.addEventListener(MouseEvent.CLICK, loadButtonHandler);
    }
    public function loadScore()
    {
      sharedObject = null;</pre>
<p></code></p>
<p>Setting the variable to null is neccessary to really refresh its value, otherwise the parallel reload would not be possible.</p>
<p><code>
<pre>
      sharedObject = SharedObject.getLocal( "kegogrogscores", "/" );
</pre>
<p></code></p>
<p>Getting the shared object.</p>
<p><code>
<pre>
      if( sharedObject.data.gameName01_gamePlayed == null )</pre>
<p></code></p>
<p>Checking if the game was played.</p>
<p><code>
<pre>
      {
        regBon.text = "no";
      }
      else if ( sharedObject.data.gameName01_gamePlayed == 1 )
      {
        regBon.text = "yes";
      }
      if( sharedObject.data.gameName01_scoreName01 == null )
      {
        sharedObject.data.gameName01_scoreName01 = 0;
</pre>
<p></code></p>
<p>If there is no score just set it zero.</p>
<p><code>
<pre>
      }
      scoreBon.text = sharedObject.data.gameName01_scoreName01.toString();
      }
    public function clearButtonHandler(event:MouseEvent)
    {
      sharedObject = SharedObject.getLocal( "kegogrogscores", "/" );
      sharedObject.clear();
</pre>
<p></code></p>
<p>Deleting the shared object, we&#8217;ll talk about that later.</p>
<p><code>
<pre>
      loadScore();
    }
    public function loadButtonHandler(event:MouseEvent)
    {
      loadScore();</pre>
<p></code></p>
<p>Calling the loading function.</p>
<p><code>
<pre>
    }
  }
}</pre>
<p></code></p>
<p>[kml_flashembed fversion="9.0.0" movie="/wp-content/uploads/2009/06/sharedobjecttutorial2.swf" targetclass="flashmovie" useexpressinstall="true" publishmethod="static" width="550" height="400"]<br />
[/kml_flashembed]</p>
<p>You can now go back up and raise the highscore, then come back, click LOAD and the new highscore should show! To the the cleared highscore in the first application you need to refresh the page. I didn&#8217;t just implement the test (nulling the shared object before flushing), but it&#8217;s no problem for you anymore to do this.</p>
<p>Talking about sharedObject.clear(): This really deletes the file, so if there are more games saved in this slot, nothing will exist afterwards. A better approach here is to set values back to zero. If you followed a strict naming convention there should be no problem assigning new values.</p>
<p><b>ONE THING: To load data from a local object, this object must not come from another URL.</b>
<p>
<!--end_raw--><br />
That&#8217;s it for the moment. Now it&#8217;s time for development. Here is the <a href="http://blog.natan.info/wp-content/uploads/2009/06/sharedobjecttutorial.rar">source</a>.</p>
<p>It&#8217;s caturday, so drink up me hearties, yo ho!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2009/06/06/tutorial-sharing-shared-objects-between-gamesapplications/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Idea: Sharing shared objects between games/applications</title>
		<link>http://www.yarrcade.com/2009/06/04/idea-sharing-shared-objects-between-gamesapplications/</link>
		<comments>http://www.yarrcade.com/2009/06/04/idea-sharing-shared-objects-between-gamesapplications/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 20:13:32 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[shared object]]></category>
		<category><![CDATA[sharedobject]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=148</guid>
		<description><![CDATA[With the Shared Object Tutorial Michael came up with an excellent piece of education. Regarding shared objects, how about sharing data between several games, like sequels or prequels. Imagine a series of shooting galleries giving you experience points for a &#8230; <a href="http://www.yarrcade.com/2009/06/04/idea-sharing-shared-objects-between-gamesapplications/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>With the <a href="http://gamedev.michaeljameswilliams.com/2009/03/18/avoider-game-tutorial-11/" target="_blank">Shared Object Tutorial</a> Michael came up with an excellent piece of education. Regarding shared objects, how about sharing data between several games, like sequels or prequels.<br />
<span id="more-148"></span><br />
Imagine a series of shooting galleries giving you experience points for a RPG.</p>
<p>Or some sort of puzzles where the score can be transferred to a racing game. Ok, that&#8217;s quite a bit strange. But possible. I think I&#8217;ll try that somewhen in the next months. Tell me what you think about that.</p>
<p>Open fire, sink &#8216;em ol&#8217; nutshell! Yo ho!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2009/06/04/idea-sharing-shared-objects-between-gamesapplications/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Embedding Flash in this blog</title>
		<link>http://www.yarrcade.com/2009/04/02/embedding-flash-in-this-blog/</link>
		<comments>http://www.yarrcade.com/2009/04/02/embedding-flash-in-this-blog/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 21:15:46 +0000</pubDate>
		<dc:creator>kegogrog</dc:creator>
				<category><![CDATA[game development]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.yarrcade.com/?p=60</guid>
		<description><![CDATA[Just trying to embed some flash into this blog with the kimili plugin. This could come in handy for things like coding tutorials or games. [kml_flashembed fversion="9.0.0" movie="/wp-content/uploads/2009/04/cursor1.swf" targetclass="flashmovie" publishmethod="static" width="550" height="400"/] YES, seems to work. ARRR! EDIT: Deactivated because &#8230; <a href="http://www.yarrcade.com/2009/04/02/embedding-flash-in-this-blog/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just trying to embed some flash into this blog with the kimili plugin. This could come in handy for things like coding tutorials or games.<br />
<span id="more-60"></span></p>
<p>[kml_flashembed fversion="9.0.0" movie="/wp-content/uploads/2009/04/cursor1.swf" targetclass="flashmovie" publishmethod="static" width="550" height="400"/]</p>
<p>YES, seems to work. ARRR!</p>
<p>EDIT: Deactivated because direct embedding seems to be comfortable enough.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yarrcade.com/2009/04/02/embedding-flash-in-this-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

