<?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>warriormill</title>
	<atom:link href="http://warriormill.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://warriormill.com</link>
	<description>Maximo Guerrero</description>
	<lastBuildDate>Mon, 19 Dec 2011 15:31:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Facebook IFrame API-Key tip</title>
		<link>http://warriormill.com/2010/02/facebook-iframe-api-key-tip/</link>
		<comments>http://warriormill.com/2010/02/facebook-iframe-api-key-tip/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 00:57:28 +0000</pubDate>
		<dc:creator>Maximo Guerrero</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web2.0]]></category>

		<guid isPermaLink="false">http://warriormill.com/?p=522</guid>
		<description><![CDATA[I Have seen alot of sample where the API key is hard coded into, unless you are building a desktop there is no need to do this. Facebook provides the API key, and the session key in the iframe url. Your application should retrieve the keys from the url, this makre your code more portable. [...]]]></description>
			<content:encoded><![CDATA[<p>I Have seen alot of sample where the API key is hard coded into, unless you are building a desktop there is no need to do this. Facebook provides the API key, and the session key in the iframe url. Your application should retrieve the keys from the url, this makre your code more portable.</p>
<p>Url Variables:</p>
<ul>
<li>fb_sig_api_key</li>
<li>fb_sig_session_key</li>
<li>fb_sig_ss</li>
</ul>
<p><strong>UPDATE &#8211; 9/10/10</strong></p>
<p>With the new changes to face book app, make sure that you go into the advanced setting and check canvas session parameters.</p>
<ul></ul>
]]></content:encoded>
			<wfw:commentRss>http://warriormill.com/2010/02/facebook-iframe-api-key-tip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook JS Client API for Flash/Flex</title>
		<link>http://warriormill.com/2010/02/facebook-js-client-api-for-flashflex/</link>
		<comments>http://warriormill.com/2010/02/facebook-js-client-api-for-flashflex/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 00:44:19 +0000</pubDate>
		<dc:creator>Maximo Guerrero</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web2.0]]></category>

		<guid isPermaLink="false">http://warriormill.com/?p=520</guid>
		<description><![CDATA[In my experience i have found that using the JavaScript client library for Facebook and the External Interface API in flash is alot more responsive than the Adobe Facebook AS3 library. Sometimes the event fails to fire. The only time you should use the adobe library is when you need to upload fotos, and do [...]]]></description>
			<content:encoded><![CDATA[<p>In my experience i have found that using the JavaScript client library for Facebook and the External Interface API in flash is alot more responsive than the Adobe Facebook AS3 library. Sometimes the event fails to fire. The only time you should use the adobe library is when you need to upload fotos, and do so by sharing the session data used by the JavaScript client.</p>
<p>Example of sharing a session:</p>
<pre class="brush: jscript; title: Source Code:; notranslate">
fb= new Facebook();
var session:WebSession;
session=new  WebSession(Application.application.parameters.fbsigapikey,
Application.application.parameters.fbsigss,
Application.application.parameters.fbsigsessionkey);
session.addEventListener(FacebookEvent.CONNECT, function():void{
var bytes:ByteArray = jpegencoder.encode(lastpumpyourselfbm.bitmapData);
var call:UploadPhoto = new UploadPhoto(bytes);

fb.post(call);

 });
fb.startSession(session);
session.verifySession();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://warriormill.com/2010/02/facebook-js-client-api-for-flashflex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Homebase project manager source code available</title>
		<link>http://warriormill.com/2009/12/homebase-project-manager-source-code-available/</link>
		<comments>http://warriormill.com/2009/12/homebase-project-manager-source-code-available/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 18:04:17 +0000</pubDate>
		<dc:creator>Maximo Guerrero</dc:creator>
				<category><![CDATA[Other Random Stuff]]></category>

		<guid isPermaLink="false">http://warriormill.com/?p=518</guid>
		<description><![CDATA[decided to post source code and video of homebase working. Download is as is, no warranty or license. click here for more information]]></description>
			<content:encoded><![CDATA[<p>decided to post source code and video of homebase working. Download is as is, no warranty or license.<br />
<a href="http://warriormill.com/homebase-project-manager/"> click here for more information </a></p>
]]></content:encoded>
			<wfw:commentRss>http://warriormill.com/2009/12/homebase-project-manager-source-code-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keane client outreach site</title>
		<link>http://warriormill.com/2009/12/keane-client-outreach-site/</link>
		<comments>http://warriormill.com/2009/12/keane-client-outreach-site/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 17:25:50 +0000</pubDate>
		<dc:creator>Maximo Guerrero</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[Keane]]></category>
		<category><![CDATA[ria]]></category>

		<guid isPermaLink="false">http://warriormill.com/?p=504</guid>
		<description><![CDATA[Designed By: Charlie Guerrero Developed By: Myself Technology: Flex, XML Website: pending]]></description>
			<content:encoded><![CDATA[<p><strong>Designed By</strong>: <a href="http://www.chuckfolio.com">Charlie Guerrero</a><br />
<strong>Developed By</strong>: Myself<br />
<strong>Technology</strong>: Flex, XML<br />
Website: pending</p>
<p><a href="http://warriormill.com/wp-content/uploads/2009/12/Keane-Client-outreach.jpg" rel="lightbox[504]"><img class="alignnone size-full wp-image-506" title="Keane-Client-outreach" src="http://warriormill.com/wp-content/uploads/2009/12/Keane-Client-outreach.jpg" alt="Keane-Client-outreach" width="478" height="278" /></a></p>
<div align="center">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/zZNhA851IFg&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/zZNhA851IFg&amp;hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object>
</div>
]]></content:encoded>
			<wfw:commentRss>http://warriormill.com/2009/12/keane-client-outreach-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android Game Development – Part 2 Player &amp; Input controls</title>
		<link>http://warriormill.com/2009/10/adroid-game-development-%e2%80%93-part-2-player-input-controls/</link>
		<comments>http://warriormill.com/2009/10/adroid-game-development-%e2%80%93-part-2-player-input-controls/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 13:48:45 +0000</pubDate>
		<dc:creator>Maximo Guerrero</dc:creator>
				<category><![CDATA[Android Development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://warriormill.com/?p=483</guid>
		<description><![CDATA[Input Controls In this section we will modify the GameEngineView to handle input controls. We do this by calling setFocusable(true); on the constructor of the view. All that is left is to override the onKeyDown and onKeyUp events. In this snippet the &#8220;st&#8221; object is an Instance of the player object which will be discussed [...]]]></description>
			<content:encoded><![CDATA[<h3>Input Controls</h3>
<p>In this section we will modify the <strong>GameEngineView</strong> to handle input controls. We do this by  calling <strong>setFocusable(true);</strong> on the constructor of the view. All that is left is to override the <strong>onKeyDown</strong> and <strong>onKeyUp</strong> events.</p>
<pre class="brush: java; title: Source Code:; notranslate">
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if(keyCode == android.view.KeyEvent.KEYCODE_DPAD_LEFT )
			{
				st.setCurrentAnimation(&quot;walk_left&quot;, true);
				st.AnimateTo(new Point( st.getXpos()-40, st.getYpos()));
			}
		if(keyCode == android.view.KeyEvent.KEYCODE_DPAD_RIGHT)
			{
				st.setCurrentAnimation(&quot;walk_right&quot;, true);
				st.AnimateTo(new Point( st.getXpos()+40, st.getYpos()));
			}

		return super.onKeyDown(keyCode, event);
	}
	@Override
	public boolean onKeyUp(int keyCode, KeyEvent event) {
		if(keyCode == android.view.KeyEvent.KEYCODE_DPAD_LEFT )
			st.setCurrentAnimation(&quot;idle_left&quot;, false);
		if(keyCode == android.view.KeyEvent.KEYCODE_DPAD_RIGHT)
			st.setCurrentAnimation(&quot;idle_right&quot;, false);

		st.MoveTo(new Point( st.getXpos(), st.getYpos()));
		return super.onKeyUp(keyCode, event);
	}
</pre>
<p>In this snippet the &#8220;st&#8221; object is an Instance of the player object which will be discussed shortly. Note that on key down animate player, on key up we return him to the idle state.</p>
<h3>Player </h3>
<p>The player class houses the characteristics that a player consists of.  We will use the Sprite Tile as the base object, this will take care of the visual part of our player. We will add function and attributes for animation</p>
<pre class="brush: java; title: Source Code:; notranslate">
package com.warriormill.warriorengine;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Point;

import com.warriormill.warriorengine.drawable.SpriteTile;

public class Player extends SpriteTile {

	public float lifebar=100.0f;
	private Point move_to = new Point(10,10);

	public Player(int BitmapResourceId, int XmlAnimationResourceId,
			Context context) {
		super(BitmapResourceId, XmlAnimationResourceId, context);
	}
	public void AnimateTo(Point pt)
	{
		move_to = pt;
	}
	public void MoveTo(Point pt)
	{
		move_to =pt;
		this.setXpos(pt.x);
		this.setYpos(pt.y);
	}

	@Override
	public void draw(Canvas canvas) {
		super.draw(canvas);

		updateLocation();
	}
	private void updateLocation()
	{
		if(move_to.y &gt; this.getYpos())
			this.setYpos(getYpos()+1);
		else if(move_to.y &lt; this.getYpos())
			this.setYpos(getYpos()-1);

		if(move_to.x &gt; this.getXpos())
			this.setXpos(getXpos()+1);
		else if(move_to.x &lt; this.getXpos())
			this.setXpos(getXpos()-1);
	}
}
</pre>
<p><a href='http://warriormill.com/wp-content/uploads/2009/10/part2.zip'>Source Code</a></p>
<p><strong>Preview</strong><br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/N_5zTZjmTpg&#038;hl=en&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/N_5zTZjmTpg&#038;hl=en&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://warriormill.com/2009/10/adroid-game-development-%e2%80%93-part-2-player-input-controls/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Android Game Development &#8211; Part 1 GameLoop &amp; Sprites</title>
		<link>http://warriormill.com/2009/10/adroid-game-development-part-1-gameloop-sprites/</link>
		<comments>http://warriormill.com/2009/10/adroid-game-development-part-1-gameloop-sprites/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 20:56:25 +0000</pubDate>
		<dc:creator>Maximo Guerrero</dc:creator>
				<category><![CDATA[Android Development]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[2d]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[game]]></category>

		<guid isPermaLink="false">http://warriormill.com/?p=452</guid>
		<description><![CDATA[Game Loop Game Loop is the main part of a game engine, it cycles threw at given intervals updating the game. The Game loop in this section will be fairly simple, it will be a thread that fires off every millisecond. A couple things to notice. We pause the thread until the screen has finished [...]]]></description>
			<content:encoded><![CDATA[<h3>Game Loop</h3>
<p>Game Loop is the main part of a game engine, it cycles threw at given intervals updating the game. The Game loop in this section will be fairly simple, it will be a thread that fires off every millisecond.</p>
<pre class="brush: java; title: Source Code:; notranslate">
/**
*
*/
package com.warriormill.warriorengine;
import java.util.concurrent.TimeUnit;
import com.warriormill.warriorengine.drawable.SpriteTile;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
//import android.view.SurfaceHolder;
//import android.view.SurfaceView;
import android.view.View;

/**
* @author maximo guerrero
*
*/
public class GameEngineView extends View {
SpriteTile st;

GameLoop gameloop;
private class GameLoop extends Thread
{
private volatile boolean running=true;
public void run()
{
while(running)
{
try{
TimeUnit.MILLISECONDS.sleep(1);
postInvalidate();
pause();

}
catch(InterruptedException ex)
{
running=false;
}

}

}
public void pause()
{
running=false;
}
public void start()
{
running=true;
run();
}
public void safeStop()
{
running=false;
interrupt();
}

}
public void unload()
{
gameloop.safeStop();

}

public GameEngineView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
init(context);

}
public GameEngineView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
init(context);
}
public GameEngineView(Context context) {
super(context);
// TODO Auto-generated constructor stub
init(context);
}

private void init(Context context)
{
st = new SpriteTile(R.drawable.buster, R.xml.buster, context);
gameloop = new GameLoop();
gameloop.run();

}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// TODO Auto-generated method stub
//super.onMeasure(widthMeasureSpec, heightMeasureSpec);
System.out.println(&quot;Width &quot; + widthMeasureSpec);
setMeasuredDimension(100, 100);
}

@Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
//super.onDraw(canvas);
st.setXpos(15);
st.setYpos(15);

st.draw(canvas);
gameloop.start();

}

}
</pre>
<p>A couple things to notice. We pause the thread until the screen has finished drawing, the reason this is done is that the thread will continue to fire off and the <strong>onDraw()</strong> function will never be called. Also Since we are using a generic thread and not a UI-Thread we call <strong>postInvalidate()</strong> function to let android know that our view has to be re drawn.</p>
<p>The Current Game loop is really simple it will call draw on the items that implement the <strong>Drawable</strong> Interface.</p>
<h3>Sprite Tile Class</h3>
<p>The Sprite Tile class will be an object that extends the Drawable interface in the android api. Our Sprite will be composed of two files,  a bitmap file (image of format type jpg, png, gif or bmp) and an xml file that describes its behavior.</p>
<p>Sprite sheet ( check out http://www.retrogamezone.co.uk for sample sprites):</p>
<p><a href="http://warriormill.com/wp-content/uploads/2009/10/buster.gif" rel="lightbox[452]"><img class="alignnone size-full wp-image-469" title="Sprite of Buster Bunny" src="http://warriormill.com/wp-content/uploads/2009/10/buster.gif" alt="Sprite of Buster Bunny" width="200px" height="558px" /></a></p>
<p>The sprite sheet is one image with all possible animaitions for our sprite</p>
<p>Xml Description:</p>
<pre class="brush: xml; title: Source Code:; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;animations&gt;
&lt;animation name=&quot;idle&quot; canLoop=&quot;true&quot; &gt;
&lt;framerect top=&quot;4&quot; left=&quot;85&quot; bottom=&quot;58&quot; right=&quot;115&quot; delayNextFrame=&quot;10&quot; /&gt;
&lt;framerect top=&quot;4&quot; left=&quot;122&quot; bottom=&quot;58&quot; right=&quot;153&quot; delayNextFrame=&quot;10&quot; /&gt;
&lt;framerect top=&quot;4&quot; left=&quot;161&quot; bottom=&quot;58&quot; right=&quot;190&quot; delayNextFrame=&quot;5&quot; /&gt;
&lt;framerect top=&quot;4&quot; left=&quot;199&quot; bottom=&quot;58&quot; right=&quot;228&quot; delayNextFrame=&quot;5&quot; /&gt;
&lt;framerect top=&quot;4&quot; left=&quot;237&quot; bottom=&quot;58&quot; right=&quot;268&quot; delayNextFrame=&quot;5&quot; /&gt;
&lt;framerect top=&quot;4&quot; left=&quot;276&quot; bottom=&quot;58&quot; right=&quot;307&quot; delayNextFrame=&quot;5&quot; /&gt;
&lt;framerect top=&quot;4&quot; left=&quot;85&quot; bottom=&quot;58&quot; right=&quot;115&quot; delayNextFrame=&quot;60&quot; /&gt;

&lt;collisionrect top=&quot;10&quot; left=&quot;5&quot; bottom=&quot;40&quot; right=&quot;20&quot; /&gt;
&lt;/animation&gt;
&lt;/animations&gt;
</pre>
<p>The xml description file contains the information needed to animation the sprite sheet. All of the Elements and there Attributes will have respective fields in our sprite class. Note that the frame rectangle is not equally uniform, this allows to compose an animation where the tile thats being drawn doesn&#8217;t have to be the same size. It also tells us how much time each frame will last on the screen, along with a rectangle for collision for that specific animation.</p>
<p>Sprite Class:<br />
The following class will load, draw and animate the tilesheet.</p>
<pre class="brush: java; title: Source Code:; notranslate">
package com.warriormill.warriorengine.drawable;

import java.util.ArrayList;
import java.util.Hashtable;

import org.xmlpull.v1.XmlPullParser;

import android.content.Context;
import android.content.res.XmlResourceParser;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.Log;

/**
* @author maximo guerrero
*/
public class SpriteTile extends Drawable {
private Bitmap tileSheet; //sprite tile sheet for all animations. rectangles are used to slip and only show parts of one bitmap
private Hashtable animations; //all animation sequences for this sprite
private String currentAnimation=&quot;idle&quot;; //current animation sequence
private int currentFrame=0; //current frame being played
private int xpos=100; // x position
private int ypos=100; // y position
private int waitDelay=0; // delay before the next frame

private ColorFilter cf;

// Class contains Information about one frame
private class FrameInfo
{
public Rect rect = new Rect();
public int nextFrameDelay =0;
}
//Class encapsulates all the data for an animations sequence. List for frames, animcation name, if the sequence will loop and collission info
private class AnimationSequece
{
public ArrayList sequence;
public Rect collisionRect;
public boolean canLoop =false;
@SuppressWarnings(&quot;unused&quot;)
public String name=&quot;idle&quot;;
}

//takes resource ids for bitmaps and xmlfiles
public SpriteTile(int BitmapResourceId, int XmlAnimationResourceId, Context context)
{
loadSprite(BitmapResourceId,XmlAnimationResourceId,context);
}

//load bitmap and xml data
public void loadSprite(int spriteid, int xmlid, Context context) {
tileSheet = BitmapFactory.decodeResource(context.getResources(), spriteid);
//load the xml will all the frame animations into a hashtable
XmlResourceParser xpp= context.getResources().getXml(xmlid);

animations= new Hashtable();

try
{
int eventType = xpp.getEventType();
String animationname=&quot;&quot;;
AnimationSequece animationsequence = new AnimationSequece();
while (eventType != XmlPullParser.END_DOCUMENT){

if(eventType == XmlPullParser.START_DOCUMENT) {
System.out.println(&quot;Start document&quot;);

} else if(eventType == XmlPullParser.END_DOCUMENT) {
System.out.println(&quot;End document&quot;);

} else if(eventType == XmlPullParser.START_TAG) {
System.out.println(&quot;Start tag &quot;+xpp.getName());
if(xpp.getName().toLowerCase().equals(&quot;animation&quot;))
{
animationname=xpp.getAttributeValue(null, &quot;name&quot;);
animationsequence = new AnimationSequece();
animationsequence.name=animationname;
animationsequence.sequence=new ArrayList();
animationsequence.canLoop = xpp.getAttributeBooleanValue(null,&quot;canLoop&quot;, false);
}
else if(xpp.getName().toLowerCase().equals(&quot;framerect&quot;))
{
FrameInfo frameinfo = new FrameInfo();
Rect frame = new Rect();
frame.top = xpp.getAttributeIntValue(null, &quot;top&quot;, 0);
frame.bottom = xpp.getAttributeIntValue(null, &quot;bottom&quot;, 0);
frame.left = xpp.getAttributeIntValue(null, &quot;left&quot;, 0);
frame.right = xpp.getAttributeIntValue(null, &quot;right&quot;, 0);
frameinfo.rect = frame;
frameinfo.nextFrameDelay = xpp.getAttributeIntValue(null,&quot;delayNextFrame&quot;, 0);
animationsequence.sequence.add(frameinfo);
}
else if(xpp.getName().toLowerCase().equals(&quot;collisionrect&quot;))
{
Rect colrect = new Rect();
colrect.top = xpp.getAttributeIntValue(null, &quot;top&quot;, 0);
colrect.bottom = xpp.getAttributeIntValue(null, &quot;bottom&quot;, 0);
colrect.left = xpp.getAttributeIntValue(null, &quot;left&quot;, 0);
colrect.right = xpp.getAttributeIntValue(null, &quot;right&quot;, 0);
animationsequence.collisionRect=colrect;
}
}else if(eventType == XmlPullParser.END_TAG) {
if(xpp.getName().toLowerCase().equals(&quot;animation&quot;))
{
animations.put(animationname, animationsequence);
}
} else if(eventType == XmlPullParser.TEXT) {
System.out.println(&quot;Text &quot;+xpp.getText());

}
eventType = xpp.next();
}
}
catch (Exception e) {
Log.e(&quot;ERROR&quot;, &quot;ERROR IN SPRITE TILE CODE:&quot;+e.toString());
}
System.out.println(&quot;Sprite Loaded &quot;);
}
//Draw sprite onto screen
@Override
public void draw(Canvas canvas) {
try
{
FrameInfo frameinfo= animations.get(currentAnimation).sequence.get(currentFrame);
Rect rclip = frameinfo.rect;
Rect dest = new Rect(this.getXpos(), getYpos(), getXpos() + (rclip.right - rclip.left),
getYpos() + (rclip.bottom - rclip.top));
if(cf!=null)
{
//color filter code here

}
canvas.drawBitmap(tileSheet, rclip, dest, null);
update(); //after drawing update the frame counter
}
catch (Exception e)
{
Log.e(&quot;ERROR&quot;, &quot;ERROR IN SPRITE TILE CODE:&quot;+e.toString()+e.getStackTrace().toString());
}

}

@Override
public int getOpacity() {
// TODO Auto-generated method stub
return 100;
}

@Override
public void setAlpha(int alpha) {
// TODO Auto-generated method stub

}

@Override
public void setColorFilter(ColorFilter cf) {
// TODO Auto-generated method stub
this.cf = cf;
}

//updates the frame counter to the next frame
public void update()
{
if(waitDelay==0)//if done waiting
{
//set current frame back to the first because looping is possible
if(animations.get(currentAnimation).canLoop &amp;amp;&amp;amp; currentFrame == animations.get(currentAnimation).sequence.size()-1)
currentFrame=0;
else
{
currentFrame++; //go to next frame

FrameInfo frameinfo= animations.get(currentAnimation).sequence.get(currentFrame);
waitDelay = frameinfo.nextFrameDelay; //set delaytime for the next frame
}
}
else
{
waitDelay--; //wait for delay to expire
}

}
//has this sprite collided with a rect
public boolean hasCollided(Rect rect)
{
AnimationSequece as = animations.get(currentAnimation);
if( rect.right &amp;lt; as.collisionRect.left )
return false;
if( rect.left &amp;gt; as.collisionRect.right )
return false;

if( rect.top &amp;gt; as.collisionRect.bottom )
return false;
if( rect.bottom &amp;lt; as.collisionRect.top )
return false;

return true;
}
//has animation finished playing, returns true on a animaiton that can loop for ever
public boolean hasAnimationFinished()
{
AnimationSequece as = animations.get(currentAnimation);
if(currentFrame == as.sequence.size() -1 &amp;amp;&amp;amp; !as.canLoop )
return true;

return false;
}

public void setXpos(int xpos) {
this.xpos = xpos;
}

public int getXpos() {
return xpos;
}

public void setYpos(int ypos) {
this.ypos = ypos;
}

public int getYpos() {
return ypos;
}
}
</pre>
<p>The class also implements a couple useful functions for checking the animations current state. Also note that the constructor take Resource-ID&#8217;s and not file paths. This is so that the developer has the choice of passing in images that have been compressed by the android api or raw images.</p>
<p>Final product:<br />
<a href="http://warriormill.com/wp-content/uploads/2009/10/5554-avd.jpg" rel="lightbox[452]"><img class="alignnone size-thumbnail wp-image-480" title="Android Game Development part 1 - Final Product" src="http://warriormill.com/wp-content/uploads/2009/10/5554-avd-150x150.jpg" alt="Android Game Development part 1 - Final Product" width="150" height="150" /></a></p>
<p>That&#8217;s it for part 1.</p>
<p><a href="http://warriormill.com/wp-content/uploads/2009/10/part1.zip">Source Code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://warriormill.com/2009/10/adroid-game-development-part-1-gameloop-sprites/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>WatchCity Kitchens &amp; LeBlanc Contracting</title>
		<link>http://warriormill.com/2009/10/watchcity-kitchens-leblanc-contracting/</link>
		<comments>http://warriormill.com/2009/10/watchcity-kitchens-leblanc-contracting/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 20:20:18 +0000</pubDate>
		<dc:creator>Maximo Guerrero</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://warriormill.com/?p=454</guid>
		<description><![CDATA[Designed By: Carlos Perez Developed By: Myself Technology: PHP, jquery Website: http://www.watchcitykitchens.com]]></description>
			<content:encoded><![CDATA[<div><strong>Designed By</strong>: Carlos Perez</div>
<div><strong>Developed By</strong>: Myself</div>
<div><strong>Technology</strong>: PHP, jquery</div>
<div><strong>Website</strong>: <a href="http://www.watchcitykitchens.com" target="_blank">http://www.watchcitykitchens.com</a></p>
<p><a href="http://warriormill.com/wp-content/uploads/2009/10/WatchCity-Kitchens-LeBlanc-Contracting-2.jpg" rel="lightbox[454]"><img class="alignnone size-thumbnail wp-image-459" title="WatchCity Kitchens &amp; LeBlanc Contracting 2" src="http://warriormill.com/wp-content/uploads/2009/10/WatchCity-Kitchens-LeBlanc-Contracting-2-150x150.jpg" alt="WatchCity Kitchens &amp; LeBlanc Contracting 2" width="150" height="150" /></a><a href="http://warriormill.com/wp-content/uploads/2009/10/photo-gallery-«-WatchCity-Kitchens-LeBlanc-Contracting.jpg" rel="lightbox[454]"><img class="alignnone size-thumbnail wp-image-457" title="photo gallery « WatchCity Kitchens &amp; LeBlanc Contracting" src="http://warriormill.com/wp-content/uploads/2009/10/photo-gallery-«-WatchCity-Kitchens-LeBlanc-Contracting-150x150.jpg" alt="photo gallery « WatchCity Kitchens &amp; LeBlanc Contracting" width="150" height="150" /></a><a href="http://warriormill.com/wp-content/uploads/2009/10/photo-gallery-«-WatchCity-Kitchens-LeBlanc-Contracting-2.jpg" rel="lightbox[454]"><img class="alignnone size-thumbnail wp-image-456" title="photo gallery « WatchCity Kitchens &amp; LeBlanc Contracting 2" src="http://warriormill.com/wp-content/uploads/2009/10/photo-gallery-«-WatchCity-Kitchens-LeBlanc-Contracting-2-150x150.jpg" alt="photo gallery « WatchCity Kitchens &amp; LeBlanc Contracting 2" width="150" height="150" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://warriormill.com/2009/10/watchcity-kitchens-leblanc-contracting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mynt1792 Fashion by Ricky Zinn</title>
		<link>http://warriormill.com/2009/10/mynt1792-fashion-by-ricky-zinn/</link>
		<comments>http://warriormill.com/2009/10/mynt1792-fashion-by-ricky-zinn/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 21:31:57 +0000</pubDate>
		<dc:creator>Maximo Guerrero</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://warriormill.com/?p=409</guid>
		<description><![CDATA[Designed By: Ian Thornell Developed By: Carlos Quinones &#38; myself Technology: PHP, Mysql,FLEX and jquery Website: http://www.mynt1792.com]]></description>
			<content:encoded><![CDATA[<div><strong>Designed By</strong>: Ian Thornell</div>
<div><strong>Developed By</strong>: Carlos Quinones &amp; myself</div>
<div><strong>Technology</strong>: PHP, Mysql,FLEX and jquery</div>
<div><strong>Website</strong>: <a href="http://www.mynt1792.com" target="_blank">http://www.mynt1792.com</a></div>
<div></div>
<div><a href="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-12.jpg" rel="lightbox[409]"><img class="alignnone size-thumbnail wp-image-449" title="myIntroNewStar 12" src="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-12-150x150.jpg" alt="myIntroNewStar 12" width="150" height="150" /></a><a href="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-11.jpg" rel="lightbox[409]"><img class="alignnone size-thumbnail wp-image-448" title="myIntroNewStar 11" src="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-11-150x150.jpg" alt="myIntroNewStar 11" width="150" height="150" /></a><a href="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-10.jpg" rel="lightbox[409]"><img class="alignnone size-thumbnail wp-image-447" title="myIntroNewStar 10" src="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-10-150x150.jpg" alt="myIntroNewStar 10" width="150" height="150" /></a><a href="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-9.jpg" rel="lightbox[409]"><img class="alignnone size-thumbnail wp-image-446" title="myIntroNewStar 9" src="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-9-150x150.jpg" alt="myIntroNewStar 9" width="150" height="150" /></a><a href="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-8.jpg" rel="lightbox[409]"><img class="alignnone size-thumbnail wp-image-445" title="myIntroNewStar 8" src="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-8-150x150.jpg" alt="myIntroNewStar 8" width="150" height="150" /></a><a href="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-7.jpg" rel="lightbox[409]"><img class="alignnone size-thumbnail wp-image-444" title="myIntroNewStar 7" src="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-7-150x150.jpg" alt="myIntroNewStar 7" width="150" height="150" /></a><a href="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-6.jpg" rel="lightbox[409]"><img class="alignnone size-thumbnail wp-image-443" title="myIntroNewStar 6" src="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-6-150x150.jpg" alt="myIntroNewStar 6" width="150" height="150" /></a><a href="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-5.jpg" rel="lightbox[409]"><img class="alignnone size-thumbnail wp-image-442" title="myIntroNewStar 5" src="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-5-150x150.jpg" alt="myIntroNewStar 5" width="150" height="150" /></a><a href="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-4.jpg" rel="lightbox[409]"><img class="alignnone size-thumbnail wp-image-441" title="myIntroNewStar 4" src="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-4-150x150.jpg" alt="myIntroNewStar 4" width="150" height="150" /></a><a href="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar.jpg" rel="lightbox[409]"><img class="alignnone size-thumbnail wp-image-450" title="myIntroNewStar" src="http://warriormill.com/wp-content/uploads/2009/10/myIntroNewStar-150x150.jpg" alt="myIntroNewStar" width="150" height="150" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://warriormill.com/2009/10/mynt1792-fashion-by-ricky-zinn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Marketing Association&#8217;s WebAward for the U.S. District Court Website</title>
		<link>http://warriormill.com/2009/09/web-marketing-associations-webaward-for-the-u-s-district-court-website/</link>
		<comments>http://warriormill.com/2009/09/web-marketing-associations-webaward-for-the-u-s-district-court-website/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 17:23:17 +0000</pubDate>
		<dc:creator>Maximo Guerrero</dc:creator>
				<category><![CDATA[Awards]]></category>
		<category><![CDATA[goverment]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://warriormill.com/?p=403</guid>
		<description><![CDATA[award:http://www.webaward.org/winner.asp?eid=12307 website:http://www.mad.uscourts.gov/ Click here to view award]]></description>
			<content:encoded><![CDATA[<p>award:<a href="http://www.webaward.org/winner.asp?eid=12307">http://www.webaward.org/winner.asp?eid=12307</a></p>
<p>website:<a href="http://www.mad.uscourts.gov/">http://www.mad.uscourts.gov/</a></p>
<p><a href="http://www.webaward.org/winner.asp?eid=12307" targe="_blank"><br />
Click here to view award</a></p>
]]></content:encoded>
			<wfw:commentRss>http://warriormill.com/2009/09/web-marketing-associations-webaward-for-the-u-s-district-court-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming the mobile web</title>
		<link>http://warriormill.com/2009/08/programming-the-mobile-web/</link>
		<comments>http://warriormill.com/2009/08/programming-the-mobile-web/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 11:16:35 +0000</pubDate>
		<dc:creator>Maximo Guerrero</dc:creator>
				<category><![CDATA[Other Random Stuff]]></category>

		<guid isPermaLink="false">http://warriormill.com/?p=389</guid>
		<description><![CDATA[One of the biggest problems facing mobile web developers is making sites share the same level of user experience across all platforms. The approach i recomend is to make your application scalable enough to  adapt to different screen resolution and features. This means you  must know alot about the phone before hand, the response to [...]]]></description>
			<content:encoded><![CDATA[<p>One of the biggest problems facing mobile web developers is making sites share the same level of user experience across all platforms. The approach i recomend is to make your application scalable enough to  adapt to different screen resolution and features. This means you  must know alot about the phone before hand, the response to this usualy &#8220;we can possibly collect all that information&#8221;. Yes I agree but, we already have people doing this work and donating it as open source.</p>
<p>There are two open source database that i like to use:</p>
<ul>
<li>For ASP.NET there is <a href="http://mdbf.codeplex.com/" target="_blank">&#8220;The Mobile Device Browser File&#8221; </a>this is an open source browser file its hosted on codeplex.<a href="http://mdbf.codeplex.com/">http://mdbf.codeplex.com/</a></li>
<li>For all other Development Platforms I suggesst  <a href="http://wurfl.sourceforge.net/" target="_blank">WURFL</a> (Wireless Universal Resource File).  <a href="http://wurfl.sourceforge.net/" target="_blank">http://wurfl.sourceforge.net/</a></li>
</ul>
<p>These resource files gives us great control over what type of content can be served out to  the device requesting information. This means that your mobile site has to intelligently make decision on the information that you are now provided, because now you know screen resolutions, if a the mobile device can handle video.  Use this information wisely dont not try to make a use case for everyphone. Group phones based on ability and screen size.</p>
<p>Group  devices into categories for example the nextGen Group can be composed of  iphone, android, and other  touch phones.</p>
<p><a href="http://warriormill.com/wp-content/uploads/2009/06/mobile-screen-grouping.jpg" rel="lightbox[389]"><img class="alignnone size-full wp-image-393" title="mobile-screen-grouping" src="http://warriormill.com/wp-content/uploads/2009/06/mobile-screen-grouping.jpg" alt="mobile-screen-grouping" width="816" height="1056" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://warriormill.com/2009/08/programming-the-mobile-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

