<?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"
	>

<channel>
	<title>Silveira Neto</title>
	<atom:link href="http://silveiraneto.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://silveiraneto.net</link>
	<description>personal blog</description>
	<pubDate>Wed, 19 Nov 2008 18:20:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>pt-br</language>
			<item>
		<title>SVG: There She Is!!</title>
		<link>http://silveiraneto.net/2008/11/19/svg-there-she-is/</link>
		<comments>http://silveiraneto.net/2008/11/19/svg-there-she-is/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 18:20:29 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
		
		<category><![CDATA[english]]></category>

		<category><![CDATA[CC-BY-SA]]></category>

		<category><![CDATA[creative commons]]></category>

		<category><![CDATA[Doki]]></category>

		<category><![CDATA[Inkscape]]></category>

		<category><![CDATA[Nabi]]></category>

		<category><![CDATA[SVG]]></category>

		<category><![CDATA[There She Is!!]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1748</guid>
		<description><![CDATA[Two SVG fanart drawings of the very cute animation There She Is!! from South-Korean.
The first one is a sign that is shown from first to last episode, love between cats and bunnies is not allowed.  

sign_there_she_is.svg
The second, from the pro-love campaign from the fourth episode.

sign2_there_she_is.svg
Enjoy, share, print and modify. They are under Creative Commons [...]]]></description>
			<content:encoded><![CDATA[<p>Two SVG fanart drawings of the very cute animation <a title="SamBakZa There She Is!!" href="http://www.sambakza.net/amalloc/amalloc_frameset.htm"><em>There She Is!!</em></a> from South-Korean.</p>
<p>The first one is a sign that is shown from first to last episode, love between cats and bunnies is not allowed. <img src='http://silveiraneto.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2008/11/sign_there_she_is.svg"><img class="alignnone size-full wp-image-1751" title="There She Is Sign" src="http://silveiraneto.net/wp-content/uploads/2008/11/sign_there_she_is.svg" alt="" /><img class="size-full wp-image-1749 aligncenter" title="there she is sign" src="http://silveiraneto.net/wp-content/uploads/2008/11/there_she_is_sign1.png" alt="" width="400" height="400" /><br />
sign_there_she_is.svg</a></p>
<p>The second, from the pro-love campaign from the fourth episode.</p>
<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2008/11/sign2_there_she_is.svg"><img class="alignnone size-full wp-image-1752" title="There She Is!! Sign" src="http://silveiraneto.net/wp-content/uploads/2008/11/sign2_there_she_is.svg" alt="" /><img class="size-full wp-image-1750 aligncenter" title="there she is sign" src="http://silveiraneto.net/wp-content/uploads/2008/11/there_she_is_sign2.png" alt="" width="400" height="332" /><br />
sign2_there_she_is.svg</a></p>
<p>Enjoy, share, print and modify. They are under <a title="Creative Commons" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution Share-Alike</a> license. I also did a more complete post (in portuguese) in my <a title="Eu Podia Tá Matando" href="http://eupodiatamatando.com/2008/11/19/there-she-is/">another blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/11/19/svg-there-she-is/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Parallel Build Benchmark</title>
		<link>http://silveiraneto.net/2008/11/14/parallel-build-benchmark/</link>
		<comments>http://silveiraneto.net/2008/11/14/parallel-build-benchmark/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 19:12:59 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
		
		<category><![CDATA[english]]></category>

		<category><![CDATA[build]]></category>

		<category><![CDATA[GNU]]></category>

		<category><![CDATA[hpc]]></category>

		<category><![CDATA[Inkscape]]></category>

		<category><![CDATA[jobs]]></category>

		<category><![CDATA[Make]]></category>

		<category><![CDATA[Makefile]]></category>

		<category><![CDATA[Parallel]]></category>

		<category><![CDATA[Parallel Build]]></category>

		<category><![CDATA[Parallelism]]></category>

		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1732</guid>
		<description><![CDATA[You can optimizing your building times using a parallel build process.
The GNU Make supports it using the parameter &#8211;jobs=N (or -j=N), where N is the maximum number of jobs that can be realized at the same time, usually compilation jobs. By default, Make will perform just a job per time. Using -j without arguments imposes [...]]]></description>
			<content:encoded><![CDATA[<p>You can optimizing your building times using a parallel build process.</p>
<p>The <a title="GNU Make" href="http://www.gnu.org/software/make/manual/make.html">GNU Make</a> supports it using the parameter &#8211;jobs=N (or -j=N), where N is the maximum number of jobs that can be realized at the same time, usually compilation jobs. By default, Make will perform just a job per time. Using -j without arguments imposes no limits on job number. There&#8217;s also the load approach using <em>&#8211;load-average</em>.<em><br />
</em></p>
<p>Here&#8217;s a benchmark I did showing four different complete builds of the <a title="Inkscape Project" href="http://inkscape.org">Inkscape</a> project, from one to four jobs at the same time. I used a Intel (Yonah FSB667 Mhz/2MbL2) Dual Core with 2 Gb of Ram with a common Ubuntu 8.10 and default build parameters and no additional optimizations.</p>
<p style="text-align: center;"><img class="size-full wp-image-1741 aligncenter" title="inkscape parallel build chart" src="http://silveiraneto.net/wp-content/uploads/2008/11/inkscape_parallel_build_chart.png" alt="chart" /><a href="http://silveiraneto.net/wp-content/uploads/2008/11/inkscape_parallel_build.ods">inkscape_parallel_build.ods</a></p>
<p>Just compiling with <em>make &#8211;jobs=2</em> instead of just <em>make</em>, almost doubles the speed of the build. As I&#8217;m using a dual core processor and the heavy compilations dominate the build process, the best result was with 2 jobs.</p>
<p>I had no trouble with those builds but it&#8217;s known that you can have problems such implicit dependencies among targets or memory exhaustion. There&#8217;s a good article, <a title="By Morgan Herrington" href="http://developers.sun.com/solaris/articles/parallel_make.html">Optimizing Build Times Using Parallel &#8220;make&#8221;</a>, on this subject. On the Make manual, there&#8217;s also a section on <a title="Make Parallel" href="http://www.gnu.org/software/make/manual/make.html#Parallel">parallel excetution</a>.</p>
<p>So, next time you try a <em>make</em>, try using <em>make &#8211;jobs=2</em> and see the results. <img src='http://silveiraneto.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/11/14/parallel-build-benchmark/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Eupodiatamatando.com no Jornal de Brasília.</title>
		<link>http://silveiraneto.net/2008/11/12/eupodiatamatandocom-no-jornal-de-brasilia/</link>
		<comments>http://silveiraneto.net/2008/11/12/eupodiatamatandocom-no-jornal-de-brasilia/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 16:37:12 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
		
		<category><![CDATA[português]]></category>

		<category><![CDATA[Blog]]></category>

		<category><![CDATA[celebridades]]></category>

		<category><![CDATA[eupodiatamatando]]></category>

		<category><![CDATA[jornal]]></category>

		<category><![CDATA[mídia]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1725</guid>
		<description><![CDATA[ Obrigado ao Thiago Silva pelo envio do recorte.
O Eupodiatamatando.com saiu no Jornal de Brasília (esse é o nome mesmo) como um dos blogs famoso por se ocupar de falar mal de celebridades.
Eu agradeço a referencia ao blog, que certamente trouxe visitas também, mas esse não é nem de longe o foco do EPTM e [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2008/11/jornal-de-brasilia.jpg"> <img class="aligncenter size-thumbnail wp-image-1724" title="jornal de brasília" src="http://silveiraneto.net/wp-content/uploads/2008/11/jornal-de-brasilia-150x150.jpg" alt="" width="150" height="150" /></a><br/><small>Obrigado ao Thiago Silva pelo envio do recorte.</small></p>
<p>O <a title="Eu Podia Tá Matando" href="http://eupodiatamatando.com" target="_blank">Eupodiatamatando.com</a> saiu no Jornal de Brasília (esse é o nome mesmo) como um dos blogs famoso por se ocupar de falar mal de celebridades.</p>
<p>Eu agradeço a referencia ao blog, que certamente trouxe visitas também, mas esse não é nem de longe o foco do EPTM e nem é o tema mais recorrente. É bem verdade que tirar sarro das pessoas, eventos e situações constituem boa parte do humor no EPTM, mas as celebridades não são o alvo principal. Me meter na vida dos outros não é muito minha praia.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/11/12/eupodiatamatandocom-no-jornal-de-brasilia/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Seja um Embaixador de Campus da Sun!</title>
		<link>http://silveiraneto.net/2008/11/11/seja-um-embaixador-de-campus-da-sun/</link>
		<comments>http://silveiraneto.net/2008/11/11/seja-um-embaixador-de-campus-da-sun/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 12:55:15 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
		
		<category><![CDATA[português]]></category>

		<category><![CDATA[42]]></category>

		<category><![CDATA[campus ambassador]]></category>

		<category><![CDATA[duke]]></category>

		<category><![CDATA[Embaixador de Campus da Sun]]></category>

		<category><![CDATA[Estágio]]></category>

		<category><![CDATA[Sun]]></category>

		<category><![CDATA[Sun Campus Ambassador]]></category>

		<category><![CDATA[Sun Microsystems]]></category>

		<category><![CDATA[Vaga]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1710</guid>
		<description><![CDATA[Está aberta uma vaga para o programa de Embaixador de Campus da Sun dentro da Universidade Federal do Ceará.

Como um Embaixador de Campus (aka C.A. ou Campus Ambassador) você receberá uma série de treinamentos (através de um ambiente de aulas web como você nunca viu igual e também através do Sun Academic Initiative), brindes e [...]]]></description>
			<content:encoded><![CDATA[<p>Está aberta uma vaga para o programa de Embaixador de Campus da Sun dentro da Universidade Federal do Ceará.</p>
<p style="text-align: center;"><img class="size-full wp-image-1717 aligncenter" title="I Need You" src="http://silveiraneto.net/wp-content/uploads/2008/11/i_need_you_duke3.gif" alt="" width="401" height="264" /></p>
<p>Como um Embaixador de Campus (aka C.A. ou Campus Ambassador) você receberá uma série de treinamentos (através de um ambiente de aulas web como você nunca viu igual e também através do <a title="Sun Academic Initiative" href="http://www.sun.com/solutions/landing/industry/education/sai/index.xml">Sun Academic Initiative</a>), brindes e se conectará através de uma rede mundial de entusiastas e desenvolvedores de Software Livre. Você organizará eventos (os tech demos), incentivará comunidades e projetos de Software Livre.</p>
<p>Requisitos básicos:</p>
<ul>
<li>Boa comunicação e capacidade para falar em público.</li>
<li>Auto motivação, boa organizaçaõ e capacidade para trabalhar sozinho.</li>
<li>Possuir um forte escopo e interesse por tecnologia.</li>
<li>Fluência em inglês.</li>
</ul>
<p>Requisitos desejáveis:</p>
<ul>
<li>Conhecimento de tecnologias da Sun como Java, OpenSolaris, NetBeans, Glassfish, etc.</li>
<li>Ter ainda pelo menos dois anos de curso pela frente.</li>
<li>Gostar de comunidades e projetos de Software Livre.</li>
</ul>
<p>Requisitos bônus:</p>
<ul>
<li>
<pre class="source-bash">:<span class="br0">(</span><span class="br0">)</span><span class="br0">{</span> :|:&amp; <span class="br0">}</span>;:</pre>
</li>
</ul>
<p>Os interessados devem enviar seus currículos o quanto antes, até o dia 15 de Novembro de 2008, para o email <strong>silveira</strong> <em>arroba</em> <strong>sun</strong> <em>ponto</em> <strong>com</strong>.</p>
<p>Maiores informações no <a title="OSUM UFC" href="http://osum.sun.com/groupsufc">OSUM UFC</a> no <a title="Sun Campus Ambassador" href="http://developers.sun.com/students/index.jsp">site oficial do programa</a>.</p>
<p>Poster de divulgação da vaga:</p>
<blockquote><p>Estudante, mude o mundo!<br />
O Software Livre e o Código Aberto estão mudando o mundo - não somente<br />
para programadores mas também para toda a sociedade. A Sun é a maior<br />
colaboradora do Software Livre e do Código Aberto no mundo e nós lhe<br />
convidamos para ajudar a mudar o mundo, se tornando um Embaixador de<br />
Campus da Sun.<br />
A Sun está procurando por talentosos estudantes desenvolvedores de<br />
software que sejam apaixonados por desenvolvimento de comunidades.<br />
Como um Embaixador de Campus da Sun, você organizará atividades de<br />
palestras e laboratórios com as últimas inovações em tecnologias livres<br />
como Java, OpenSolaris, MySQL e NetBeans. Você também poderá mostrar<br />
para seus colegas estudantes onde conseguir valiosos recursos como<br />
treinamentos via web e programas especiais de certificação para estudantes.<br />
Ainda mais importante, você conectará estudantes da sua universidade com<br />
uma comunidade global de estudantes desenvolvedores, todos participando<br />
de comunidades d Softwares Livres da Sun ao redor do mundo.<br />
Você receberá treinamentos, brindes e outros recursos que você precisar<br />
para ter sucesso e se divertir muito no processo.<br />
A Sun está procurando estudantes de graduação da UFC com forte escopo<br />
em desenvolvimento de software para trabalhar em meio período como<br />
Embaixador de Campus da Sun. Esta oportunidade provê treinamentos<br />
extensivos nas últimas tecnologias e oferece uma valiosa oportunidade de<br />
trabalhar em uma das empresas líderes em TI no mundo. Você também<br />
desenvolverá suas habilidades de liderança e aprender sobre como os<br />
modelos de software livre, código aberto e comunidades que estão mudando<br />
o mercado e a indústria.<br />
Responsabilidades:<br />
Liderar a comunidade de desenvolvedores de softwares livres da Sun no seu<br />
campus através do trabalho com os clubes existentes ou desenvolvendo uma<br />
nova comunidade de desenvolvedores de software livre; Realizar seções de<br />
demonstrações de tecnologia da Sun no seu campus; Organizar e conduzir<br />
atividades, projetos e laboratórios divertidos de tecnologia.<br />
Requisitos:<br />
Está cursando graduação em Computação ou área relacionada; Possuir<br />
fortes habilidades em tecnologias; Familiaridade com NetBeans, Sun Studio<br />
e/ou OpenSolaris são desejáveis; Possuir excelentes habilidades em<br />
comunicação; ser fluente em inglês; confortável para falar em público; Ser<br />
auto-motivado, bem organizado e ser capaz de trabalhar de maneira<br />
independente.<br />
Os interessados devem enviar seus currículos para silveira[arroba]sun.com até o<br />
dia 15 de Novembro de 2008.<br />
Maiores informações em http://osum.sun.com/groups/ufc.</p></blockquote>
<p style="text-align: center;"><img class="size-full wp-image-1712 aligncenter" title="poster chamada embaixador" src="http://silveiraneto.net/wp-content/uploads/2008/11/poster_chamadapdf.png" alt="" width="198" height="280" /><br />
<a href="http://silveiraneto.net/wp-content/uploads/2008/11/poster_chamada.pdf">poster_chamada.pdf</a> ou <a href="http://silveiraneto.net/wp-content/uploads/2008/11/poster_chamada.odg">poster_chamada.odg</a></p>
<h2>10 perguntas e respostas sobre essa vaga.</h2>
<h3>1. Eu tenho que ser aluno do curso de Computação?</h3>
<p>Não.</p>
<h3>2. Eu tenho que ser aluno da UFC?</h3>
<p>Para essa vaga em particular, sim. <a title="Mapa dos embaixadores" href="http://developers.sun.com/students/community/map.jsp">Há outras vagas</a> de Embaixador de Campus em outras universidades.</p>
<h3>3. Eu tenho que ser da graduação?</h3>
<p>Sim. Devido a legislação do Brasil você precisa estar na graduação.</p>
<h3>4. Eu não gosto da tecnologia &#8216;X&#8217; da Sun, será que eu tenho alguma chance?</h3>
<p>O portifólio de tecnologias da Sun é muito largo e você vai ter a oportunidade de conhecer mais ele. Há desde tecnologias de hardware como um processador de código aberto (GPL) como o <a title="OpenSparc" href="http://www.opensparc.net/">OpenSparc</a>, até um framework para ambientes de realidade virtual como o <a title="Wonderland" href="https://lg3d-wonderland.dev.java.net/">Wonderland</a>. De sistemas operacionais livres como <a title="OpenSolaris" href="http://opensolaris.org">OpenSolaris</a> há dispositivos programáveis como <a title="Sun SPOT" href="http://www.sunspotworld.com/">SunSpot</a>. Só para citar alguns exemplos.</p>
<p>No inicio você deverá conhecer um pouco sobre vários projetos e então você deverá se focar naquilo que você gostar mais. Basta ter a mente aberta para conhecer coisas novas.</p>
<h3>5. O estudante recebe algum benefício ou bolsa dentro do programa?</h3>
<p>Sim, recebemos uma bolsa como um estágio dentro da Sun e ainda uma série de benefícios diretos e indiretos.</p>
<h3>6. Vale a pena?</h3>
<p>Pode apostar que sim.</p>
<h3>7. Onde você trabalha?</h3>
<p>Em todo e qualquer lugar. Não há necessidade de bater ponto em um lugar específico. Nesse momento, estou na minha cama. <a title="Veja só" href="http://abclocal.go.com/kgo/story?section=news/business&amp;id=6195474">Isso é normal</a> na Sun.</p>
<h3>8. E não existe um acompanhamento?</h3>
<p>Existe sim. Eu recebo acompanhamento do coordenador de embaixadores aqui no Brasil, o <a title="Edu" href="http://blogs.sun.com/eduardolima/">Eduardo Lima</a>. Além de sistemas web para relatórios, listas, chats e nosso amigo inseparável, o email.</p>
<h3>9. Qual a resposta para a vida, o universo e tudo mais?</h3>
<p>42.</p>
<h3>10. É você quem vai escolher o próximo embaixador?</h3>
<p>Não.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/11/11/seja-um-embaixador-de-campus-da-sun/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JavaFX, Defuse the Bomb</title>
		<link>http://silveiraneto.net/2008/11/06/javafx-defuse-the-bomb/</link>
		<comments>http://silveiraneto.net/2008/11/06/javafx-defuse-the-bomb/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 14:55:32 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
		
		<category><![CDATA[english]]></category>

		<category><![CDATA[Bomb]]></category>

		<category><![CDATA[Collision]]></category>

		<category><![CDATA[defuse]]></category>

		<category><![CDATA[explosion]]></category>

		<category><![CDATA[game]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Java Web Start]]></category>

		<category><![CDATA[JavaFX]]></category>

		<category><![CDATA[JNLP]]></category>

		<category><![CDATA[netbeans]]></category>

		<category><![CDATA[openjfx]]></category>

		<category><![CDATA[RIA]]></category>

		<category><![CDATA[sources]]></category>

		<category><![CDATA[webgame]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1667</guid>
		<description><![CDATA[I continue to develop simple games demos to feel better the strengths and weakness of JavaFX for game development.
Preview:

Click to play via Java Web Start:

There&#8217;s a little JavaFX game demo where you have to transport a bomb to a defuse point without touching in the walls. I&#8217;m using the collision detection methods I described early [...]]]></description>
			<content:encoded><![CDATA[<p>I continue to develop simple games demos to feel better the strengths and weakness of JavaFX for game development.</p>
<p><strong>Preview:</strong></p>
<p><center><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/hR2LiKiBUgE&amp;rel=0&amp;color1=0x006699&amp;color2=0x54abd6"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/hR2LiKiBUgE&amp;rel=0&amp;color1=0x006699&amp;color2=0x54abd6" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></object></center></p>
<p><strong>Click to play via Java Web Start:</strong></p>
<p style="text-align: center;"><a title="Click to launch" href="http://silveiraneto.net/downloads/Defuse/dist/launch.jnlp"><img class="size-full wp-image-1474 aligncenter" title="webstart" src="../wp-content/uploads/2008/10/webstart.png" alt="" width="88" height="23" /></a></p>
<p>There&#8217;s a little JavaFX game demo where you have to transport a bomb to a defuse point without touching in the walls. I&#8217;m using the collision detection methods <a href="http://silveiraneto.net/2008/10/30/javafx-rectangular-collision-detection/">I described early in this post</a> to detect when the bomb hits a wall and then explode or when a bomb is inside the defuse point and the game ends. As it&#8217;s only a demo, it&#8217;s just one single level, but adding more levels would be easy.</p>
<p>Basically we have this four images:</p>
<p><a href="http://silveiraneto.net/wp-content/uploads/2008/11/bomb.png"><img class="alignnone size-full wp-image-1684" title="bomb" src="http://silveiraneto.net/wp-content/uploads/2008/11/bomb.png" alt="" width="80" height="41" /><br />
bomb.png</a></p>
<p><a href="http://silveiraneto.net/wp-content/uploads/2008/11/goal.png"><img class="alignnone size-full wp-image-1686" title="goal" src="http://silveiraneto.net/wp-content/uploads/2008/11/goal.png" alt="" width="120" height="72" /><br />
goal.png</a></p>
<p><a href="http://silveiraneto.net/wp-content/uploads/2008/11/floor.png"><img class="alignnone size-thumbnail wp-image-1685" title="floor" src="http://silveiraneto.net/wp-content/uploads/2008/11/floor-150x150.png" alt="" width="150" height="150" /><br />
floor.png</a></p>
<p><a href="http://silveiraneto.net/wp-content/uploads/2008/11/wall.png"><img class="alignnone size-thumbnail wp-image-1687" title="wall" src="http://silveiraneto.net/wp-content/uploads/2008/11/wall-150x150.png" alt="" width="150" height="150" /><br />
wall.png</a></p>
<p>The code is petty simple. A little bit more than 300 lines with even with all comments and declarations. I transform the bomb image into a draggable node, create a list of collidable nodes and a especial node, the goal. I check the collisions when the bomb is dragged by mouse, if it hits something, it blows up.</p>
<p>I use extensively the TimeLine class from the animation framework (javafx.animation) to create chained animations and even to control some game logic.</p>
<p>As I focused in the simplicity, I don&#8217;t declared any classes to after instantiate their objects. I just was using common classes from JavaFX and putting logic on ir throught event and binding to external variables.</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.application.Frame</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.application.Stage</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.animation.Timeline</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.animation.KeyFrame</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.animation.Interpolator</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.image.ImageView</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.image.Image</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.Group</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.Node</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.paint.Color</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.geometry.Circle</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.geometry.Rectangle</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.geometry.Shape</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.text.Text</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.Font</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.FontStyle</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.input.MouseEvent</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">/* Fade variable modified in some animations and used in the fadescreen */</span>
var fade <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">/* The Bomb */</span>
var lock <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span>;
var tx <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
var ty <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
var bomb<span style="color: #339933;">:</span>Node <span style="color: #339933;">=</span> <span style="color: #003399;">Group</span><span style="color: #009900;">&#123;</span>
    opacity<span style="color: #339933;">:</span> bind bombfade;
    content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        ImageView <span style="color: #009900;">&#123;</span>
            image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span>
                url<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;{__DIR__}/bomb.png&quot;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>,
        Circle <span style="color: #009900;">&#123;</span>
            centerX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">45</span>, centerY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">21</span>, radius<span style="color: #339933;">:</span> <span style="color: #cc66cc;">7</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">LIME</span>
            opacity<span style="color: #339933;">:</span> bind led
        <span style="color: #009900;">&#125;</span>,
        Circle <span style="color: #009900;">&#123;</span>
            centerX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">30</span>, centerY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">30</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">WHITE</span>
            radius<span style="color: #339933;">:</span> bind fireradius
        <span style="color: #009900;">&#125;</span>,
    <span style="color: #009900;">&#93;</span>,
    var startX <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    var startY <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    translateX<span style="color: #339933;">:</span> bind tx
    translateY<span style="color: #339933;">:</span> bind ty
&nbsp;
    onMousePressed<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span> e<span style="color: #339933;">:</span> <span style="color: #003399;">MouseEvent</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>lock<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">return</span>;<span style="color: #009900;">&#125;</span>
        startX <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> tx;
        startY <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> ty;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    onMouseDragged<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span><span style="color: #003399;">MouseEvent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>lock<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">return</span>;<span style="color: #009900;">&#125;</span>
        tx <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> startX;
        ty <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> startY;
        checkcollissions<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Big rectangle that covers all the screen (bomb explosion or game end) */</span>
var fadescreen <span style="color: #339933;">=</span> <span style="color: #003399;">Rectangle</span> <span style="color: #009900;">&#123;</span>
    x<span style="color: #339933;">:</span> 0, y<span style="color: #339933;">:</span> 0, width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">640</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">480</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">WHITE</span>
    opacity<span style="color: #339933;">:</span> bind fade
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* The wood floor image for the scenario. */</span>
var floor <span style="color: #339933;">=</span> ImageView <span style="color: #009900;">&#123;</span>
    image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span>
        url<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;{__DIR__}/floor.png&quot;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* The goal image where the bomb should be placed. */</span>
var goal <span style="color: #339933;">=</span> ImageView <span style="color: #009900;">&#123;</span>
    x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">470</span>, y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">360</span>
    image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span>
        url<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;{__DIR__}/goal.png&quot;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* List of obstacles nodes that the bomb can collide with. */</span>
var obstacles <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
    <span style="color: #003399;">Rectangle</span> <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">120</span>, y<span style="color: #339933;">:</span> 0, width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLACK</span><span style="color: #009900;">&#125;</span>,
    <span style="color: #003399;">Rectangle</span> <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">350</span>, y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">200</span>, width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLACK</span><span style="color: #009900;">&#125;</span>,
    <span style="color: #003399;">Rectangle</span> <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">370</span>, y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span>, width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLACK</span><span style="color: #009900;">&#125;</span>,
    <span style="color: #003399;">Rectangle</span> <span style="color: #009900;">&#123;</span>
        x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">250</span>, y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">120</span>, translateX<span style="color: #339933;">:</span> bind move, width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span>
        fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLACK</span>
    <span style="color: #009900;">&#125;</span>,
<span style="color: #009900;">&#93;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">/* Visible representations of obstacles */</span>
var wallimage <span style="color: #339933;">=</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span>
    url<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;{__DIR__}/wall.png&quot;</span>
<span style="color: #009900;">&#125;</span>
var walls <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>obs in obstacles<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    ImageView <span style="color: #009900;">&#123;</span>
        x<span style="color: #339933;">:</span> obs.<span style="color: #006633;">x</span>, y<span style="color: #339933;">:</span> obs.<span style="color: #006633;">y</span>, translateX<span style="color: #339933;">:</span> bind obs.<span style="color: #006633;">translateX</span>
        clip<span style="color: #339933;">:</span> obs, image<span style="color: #339933;">:</span> wallimage
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Animation for a blinking green led */</span>
var led <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
var bombclock <span style="color: #339933;">=</span> Timeline <span style="color: #009900;">&#123;</span>
    repeatCount<span style="color: #339933;">:</span> Timeline.<span style="color: #006633;">INDEFINITE</span>
    autoReverse<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
    keyFrames <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 0s
            values <span style="color: #339933;">:</span> led <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>
        <span style="color: #009900;">&#125;</span>,
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 1s
            values <span style="color: #339933;">:</span> led <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Animation for the bomb explosion and game reset */</span>
var fireradius <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
var explosion<span style="color: #339933;">:</span>Timeline <span style="color: #339933;">=</span> Timeline <span style="color: #009900;">&#123;</span>
    repeatCount<span style="color: #339933;">:</span> <span style="color: #cc66cc;">1</span>
    keyFrames <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 0s
            values <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
                fireradius <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span>,
                fade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span>
            <span style="color: #009900;">&#93;</span>
        <span style="color: #009900;">&#125;</span>,
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 2s
            values <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
                fireradius <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">200.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>,
                fade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>
            <span style="color: #009900;">&#93;</span>
            action<span style="color: #339933;">:</span> gamereset
        <span style="color: #009900;">&#125;</span>,
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 3s
            values<span style="color: #339933;">:</span> fade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>
        <span style="color: #009900;">&#125;</span>,
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Reset variables for initial values */</span>
function gamereset<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    lock <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span>;
    fireradius <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    tx <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    ty <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    bombfade <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1.0</span>;
&nbsp;
    moveblock.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    specialcollison.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    bombclock.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Animation when the bomb reaches the goal. Bomb disapear. */</span>
var bombfade <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1.0</span>;
var bomdisapear <span style="color: #339933;">=</span> Timeline <span style="color: #009900;">&#123;</span>
    repeatCount<span style="color: #339933;">:</span> <span style="color: #cc66cc;">1</span>
    keyFrames <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 1s
            values<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
                        bombfade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span> tween Interpolator.<span style="color: #006633;">EASEBOTH</span>,
                        fade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span>
            <span style="color: #009900;">&#93;</span>
        <span style="color: #009900;">&#125;</span>,
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 2s
            values<span style="color: #339933;">:</span>
                    fade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>;
            action<span style="color: #339933;">:</span> gamereset
        <span style="color: #009900;">&#125;</span>,
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 3s
            values<span style="color: #339933;">:</span>
                    fade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>;
        <span style="color: #009900;">&#125;</span>,
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Animation for a moving block. */</span>
var move <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
var moveblock <span style="color: #339933;">=</span> Timeline <span style="color: #009900;">&#123;</span>
    repeatCount<span style="color: #339933;">:</span> Timeline.<span style="color: #006633;">INDEFINITE</span>
    autoReverse<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
    keyFrames <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 0s
            values <span style="color: #339933;">:</span>
                    move <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span>
        <span style="color: #009900;">&#125;</span>,
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 3s
            values <span style="color: #339933;">:</span>
                    move <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">200.0</span> tween Interpolator.<span style="color: #006633;">EASEBOTH</span>
        <span style="color: #009900;">&#125;</span>,
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Check and handle possible collisions. */</span>
function checkcollissions<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>checkobstacles<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        lock <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span>;
        specialcollison.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        moveblock.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        explosion.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>insidenode<span style="color: #009900;">&#40;</span>bomb,goal<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        lock <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span>;
        moveblock.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        bomdisapear.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* There was a bug, when the bomb is stopped, not been gragged, in front of
the moving block, it could pass through it because checkcollissions() was
only called on mouse moving. This make sure checking this special case. */</span>
var specialcollison<span style="color: #339933;">:</span>Timeline <span style="color: #339933;">=</span> Timeline <span style="color: #009900;">&#123;</span>
    repeatCount<span style="color: #339933;">:</span> Timeline.<span style="color: #006633;">INDEFINITE</span>
    keyFrames <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 1s<span style="color: #339933;">/</span><span style="color: #cc66cc;">5</span>
            action<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>hitnode<span style="color: #009900;">&#40;</span>obstacles<span style="color: #009900;">&#91;</span>sizeof obstacles<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span>, bomb<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    lock <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span>;
                    moveblock.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
                    explosion.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
                    specialcollison.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
* The next four functions are for collision detection.
* @See http://silveiraneto.net/2008/10/30/javafx-rectangular-collision-detection/
*/</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Check collision between two rectangles.
 */</span>
function collission<span style="color: #009900;">&#40;</span>ax, ay, bx, by, cx, cy, dx, dy<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #003399;">Boolean</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> not <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>ax <span style="color: #339933;">&gt;</span> dx<span style="color: #009900;">&#41;</span>or<span style="color: #009900;">&#40;</span>bx <span style="color: #339933;">&lt;</span> cx<span style="color: #009900;">&#41;</span>or<span style="color: #009900;">&#40;</span>ay <span style="color: #339933;">&gt;</span> dy<span style="color: #009900;">&#41;</span>or<span style="color: #009900;">&#40;</span>by <span style="color: #339933;">&lt;</span> cy<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Check if the first rectangle are inside the second.
 */</span>
function inside <span style="color: #009900;">&#40;</span>ax, ay, bx, by, cx, cy, dx, dy<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Boolean</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>ax <span style="color: #339933;">&gt;</span> cx<span style="color: #009900;">&#41;</span> and <span style="color: #009900;">&#40;</span>bx <span style="color: #339933;">&lt;</span> dx<span style="color: #009900;">&#41;</span> and <span style="color: #009900;">&#40;</span>ay <span style="color: #339933;">&gt;</span> cy<span style="color: #009900;">&#41;</span> and <span style="color: #009900;">&#40;</span>by <span style="color: #339933;">&lt;</span> dy<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
function hitnode<span style="color: #009900;">&#40;</span>a<span style="color: #339933;">:</span> Node, b<span style="color: #339933;">:</span>Node<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #003399;">Boolean</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>collission<span style="color: #009900;">&#40;</span>
        a.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, a.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        a.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> a.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, a.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> a.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        b.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, b.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        b.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, b.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
function insidenode<span style="color: #009900;">&#40;</span>a<span style="color: #339933;">:</span>Node,b<span style="color: #339933;">:</span>Node<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Boolean</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>inside<span style="color: #009900;">&#40;</span>
        a.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, a.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        a.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> a.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, a.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> a.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        b.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, b.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        b.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, b.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
* Check collision of bomb against each obstacle.
*/</span>
function checkobstacles<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #003399;">Boolean</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>obst in obstacles<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hitnode<span style="color: #009900;">&#40;</span>obst, bomb<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span>;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Pack visual game elements in a Frame's Stage, unresizable. */</span>
<span style="color: #003399;">Frame</span> <span style="color: #009900;">&#123;</span>
    title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Defuse the Bomb&quot;</span>
    width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">640</span>
    height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">480</span>
    resizable<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">false</span>
    closeAction<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        java.<span style="color: #006633;">lang</span>.<span style="color: #003399;">System</span>.<span style="color: #006633;">exit</span><span style="color: #009900;">&#40;</span> 0 <span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
    visible<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
&nbsp;
    stage<span style="color: #339933;">:</span> Stage <span style="color: #009900;">&#123;</span>
        content<span style="color: #339933;">:</span> bind <span style="color: #009900;">&#91;</span>floor, goal, walls, bomb, fadescreen<span style="color: #009900;">&#93;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Call gamereset to set initial values and start animations */</span>
gamereset<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p><strong>Downloads:</strong></p>
<ul>
<li>High definition video, <a href="http://http://silveiraneto.net/downloads/javafx_defuse.ogv">javafx_defuse.ogv</a>.</li>
<li>Entire project with sources and resources for NetBeans 6.1 with JavaFX pluggin, <a title="NetBeans project" href="http://silveiraneto.net/downloads/defuse.tar.bz2">defuse.tar.bz2</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/11/06/javafx-defuse-the-bomb/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Apache and JNLP files</title>
		<link>http://silveiraneto.net/2008/11/06/apache-and-jnlp-files/</link>
		<comments>http://silveiraneto.net/2008/11/06/apache-and-jnlp-files/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 14:43:26 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[.htaccess]]></category>

		<category><![CDATA[Apache]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Java Network Launch Protocol]]></category>

		<category><![CDATA[Java Web Start]]></category>

		<category><![CDATA[JavaFX]]></category>

		<category><![CDATA[JNLP]]></category>

		<category><![CDATA[MIME]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1689</guid>
		<description><![CDATA[To Apache Web Server correctly handles yours JNLP (Java Network Launch Protocol) files, modify or create a .htaccess file in the top directory of your web site and add the following:
AddType application/x-java-jnlp-file    .jnlp
AddType application/x-java-archive-diff .jardiff
Without these  MIME-types, the user would see the xml jnlp file as a plain text in the browser. After that [...]]]></description>
			<content:encoded><![CDATA[<p>To Apache Web Server correctly handles yours JNLP (Java Network Launch Protocol) files, modify or create a <strong>.htaccess</strong> file in the top directory of your web site and add the following:</p>
<pre>AddType application/x-java-jnlp-file    .jnlp
AddType application/x-java-archive-diff .jardiff</pre>
<p>Without these  MIME-types, the user would see the xml jnlp file as a plain text in the browser. After that you can link to yours Java Web Start applications with a icon like this one:</p>
<p style="text-align: center;"><a title="Click to launch" href="../downloads/dukepotato/launch.jnlp"><img class="size-full wp-image-1474 aligncenter" title="webstart" src="../wp-content/uploads/2008/10/webstart.png" alt="" width="88" height="23" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/11/06/apache-and-jnlp-files/feed/</wfw:commentRss>
		</item>
		<item>
		<title>VII Semana de Tecnologia da Informação na FIC</title>
		<link>http://silveiraneto.net/2008/11/05/vii-semana-de-tecnologia-da-informacao-na-fic/</link>
		<comments>http://silveiraneto.net/2008/11/05/vii-semana-de-tecnologia-da-informacao-na-fic/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 11:52:57 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
		
		<category><![CDATA[português]]></category>

		<category><![CDATA[apresentação]]></category>

		<category><![CDATA[CEJUG]]></category>

		<category><![CDATA[FIC]]></category>

		<category><![CDATA[Opensolaris]]></category>

		<category><![CDATA[slides]]></category>

		<category><![CDATA[zfs]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1656</guid>
		<description><![CDATA[Em Outubro eu fiz mais duas apresentações na FIC, durante sua VII Semana de Tecnologia da Informação.

Desenvolvimento de Aplicações
View SlideShare presentation or Upload your own. (tags: netbeans java)


Downloads:

netbeans_fic.odp
netbeans_fic.pdf

A primeira apresentação foi sobre o NetBeans onde eu pude mostrar as funcionalidades básicas da plataforma e também mostrar na prática, ao vivo :D, a IDE em funcionamento [...]]]></description>
			<content:encoded><![CDATA[<p>Em Outubro eu fiz mais duas apresentações na <a href="http://www.fic.br">FIC</a>, durante sua VII Semana de Tecnologia da Informação.</p>
<p><center>
<div style="width:425px;text-align:left" id="__ss_722839"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/silveiraneto/desenvolvimento-de-aplicaes-presentation?type=powerpoint" title="Desenvolvimento de Aplicações">Desenvolvimento de Aplicações</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=netbeansfic-1225881781143336-8&#038;stripped_title=desenvolvimento-de-aplicaes-presentation" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=netbeansfic-1225881781143336-8&#038;stripped_title=desenvolvimento-de-aplicaes-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View SlideShare <a style="text-decoration:underline;" href="http://www.slideshare.net/silveiraneto/desenvolvimento-de-aplicaes-presentation?type=powerpoint" title="View Desenvolvimento de Aplicações on SlideShare">presentation</a> or <a style="text-decoration:underline;" href="http://www.slideshare.net/upload?type=powerpoint">Upload</a> your own. (tags: <a style="text-decoration:underline;" href="http://slideshare.net/tag/netbeans">netbeans</a> <a style="text-decoration:underline;" href="http://slideshare.net/tag/java">java</a>)</div>
</div>
<p></center></p>
<p><strong>Downloads:</strong></p>
<ul>
<li><a href="http://silveiraneto.net/downloads/netbeans_fic.odp">netbeans_fic.odp</a></li>
<li><a href="http://silveiraneto.net/downloads/netbeans_fic.pdf">netbeans_fic.pdf</a></li>
</ul>
<p>A primeira apresentação foi sobre o <a href="http://www.netbeans.org">NetBeans</a> onde eu pude mostrar as funcionalidades básicas da plataforma e também mostrar na prática, ao vivo :D, a IDE em funcionamento e tirar várias dúvidas. Foi muito bom porque muitos viram funcionalidades do NetBeans que eles não sabiam que existiam. Eu tenho que fazer isso mais vezes.</p>
<p>O retorno dessa apresentação foi muito boa e os alunos da FIC demonstraram um imenso interesse em conhecer e aprender mais sobre o NetBeans. Podem contar comigo e com o <a title="Ceará Java User Group" href="http://cejug.org/">CEJUG</a>.</p>
<p>Veja também o <a title="Flickr" href="http://www.flickr.com/photos/silveiraneto/sets/72157608514358579/">álbum de fotos desta apresentação</a> e fique atento esse mês para o lançamento do NetBeans 6.5 versão final.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://farm4.static.flickr.com/3069/2988728217_e6cefa1b87.jpg" alt="PA240017" /></p>
<p style="text-align: center;"><img class="aligncenter" src="http://farm4.static.flickr.com/3065/2988724743_beb78e5ea4.jpg" alt="PA240016" /></p>
<p>O outra apresentação foi sobre <a title="OpenSolaris" href="http://www.opensolaris.com">OpenSolaris</a> e Software/Cultura Livre. Pudemos conversar um pouco sobre <a title="Creative Commons" href="http://creativecommons.org">Creative Commons</a>, movimentos de Software Livre e na parte técnica, OpenSolaris com foco na administração de volumes com <a title="ZFS Project" href="http://opensolaris.org/os/community/zfs">ZFS</a>.</p>
<p>Os slides que eu usei foram os mesmos do <a title="SFD Fortaleza" href="http://silveiraneto.net/2008/09/25/dia-da-liberdade-do-software-fortaleza/">Software Freedom Day</a>. Para quem quiser rever os vídeos promocionais sobre Creative Commons, são eles:</p>
<ul>
<li><a title="Video Creative Commons" href="http://mirrors.creativecommons.org/getcreative/br/">Seja Criativo</a></li>
<li><a title="Video Creative Commons" href="http://mirrors.creativecommons.org/reticulum_rex/br/">Reticulum Rex</a></li>
</ul>
<p>Veja também o <a title="Flickr" href="http://www.flickr.com/photos/silveiraneto/sets/72157608540467817/">álbum de fotos da apresentação</a>.</p>
<p>Também foi criado o <a href="http://osum.sun.com">OSUM</a> (Open Source University Meetup) da FIC. É o <a href="http://osum.sun.com/group/fic">http://osum.sun.com/group/fic</a>. Se você é da FIC, não deixe de entrar. Já está se tornando um dos OSUMs mais ativos do estado.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/11/05/vii-semana-de-tecnologia-da-informacao-na-fic/feed/</wfw:commentRss>
		</item>
		<item>
		<title>1º Encontro CEJUG/CEPUG em Iguatu</title>
		<link>http://silveiraneto.net/2008/11/03/1%c2%ba-encontro-cejugcepug-em-iguatu/</link>
		<comments>http://silveiraneto.net/2008/11/03/1%c2%ba-encontro-cejugcepug-em-iguatu/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 14:58:53 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
		
		<category><![CDATA[português]]></category>

		<category><![CDATA[Ajax]]></category>

		<category><![CDATA[CEJUG]]></category>

		<category><![CDATA[CEPUG]]></category>

		<category><![CDATA[Christiano Milfont]]></category>

		<category><![CDATA[Fernando Chucre]]></category>

		<category><![CDATA[FirePHP]]></category>

		<category><![CDATA[Jefferson Girão]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[XDebug]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1645</guid>
		<description><![CDATA[Dessa vez foi em Iguatu que o CEJUG marcou presença no Ceará. Foi o primeiro encontro PHP+Java realizado pelas comunidades CEJUG e CEPUG.
Olha só um mapinha das viagens do CEJUG esse ano, só aqui no Ceará.  

Eu fiz a apresentação Apresetando o CEJUG e o Poder do Java que tradicionalmente é feita pelo Rafael [...]]]></description>
			<content:encoded><![CDATA[<p>Dessa vez foi em <a title="Wikipédia, português" href="http://pt.wikipedia.org/wiki/Iguatu_(Cear%C3%A1)">Iguatu</a> que o <a href="http://www.cejug.org">CEJUG</a> marcou presença no Ceará. Foi o primeiro encontro <a title="Site do Evento" href="http://cejug.org/display/cejug/Apresentando+o+CEJUG+e+o+poder+do+Java+e+Frameworks+AJAX+em+Iguatu+-+01.11.08">PHP+Java</a> realizado pelas comunidades CEJUG e <a title="Ceará PHP User Group" href="http://cepug.org/">CEPUG</a>.</p>
<p>Olha só um mapinha das viagens do CEJUG esse ano, só aqui no Ceará. <img src='http://silveiraneto.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: center;"><img class="size-full wp-image-1646 aligncenter" title="CEJUG no Ceará" src="http://silveiraneto.net/wp-content/uploads/2008/11/ceara_cejug.png" alt="" width="320" height="358" /></p>
<p>Eu fiz a apresentação <em>Apresetando o CEJUG e o Poder do Java</em> que tradicionalmente é feita pelo <a title="Rafael Carneiro" href="http://www.rafaelcarneiro.org/blog/">Rafael Carneiro</a>. O <a title="Milfont" href="http://www.milfont.org/tech/">Christiano Milfon</a> apresentou <em>Frameworks AJAX</em>, o <a title="Fernando Chucre" href="http://www.horizontesdigitais.com/">Fernando Chucre</a> apresentou <em>PHP Orientado a Objetos</em> e o <a title="Blog dele" href="http://www.jefferson.eti.br/">Jefferson Girão</a> apresentou <em>Depurando Aplicações PHP com XDebug e FirePHP</em>. Foram apresentações ótimas, valiosíssimas. Eu espero que todos tenham gostado como eu gostei.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://farm4.static.flickr.com/3064/2997839524_cb14c4dbf8.jpg" alt="Viagem Iguatu" /></p>
<p style="text-align: center;"><img class="aligncenter" src="http://farm4.static.flickr.com/3235/2996972099_6bf21cb46b.jpg" alt="Viagem Iguatu" /></p>
<p style="text-align: center;"><img class="aligncenter" src="http://farm4.static.flickr.com/3060/2997919870_937c462ab4.jpg" alt="Viagem Iguatu" /></p>
<p>Você pode conferir o restante das fotos se encontra <a title="Álbum do Flickr" href="http://flickr.com/photos/silveiraneto/sets/72157608607361149/">nesse álbum</a>. Como prometido, aqui estão os slides da minha apresentação:</p>
<p><center>
<div style="width:425px;text-align:left" id="__ss_715320"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/silveiraneto/apresentando-o-cejug-e-o-poder-do-java-presentation-715320?type=powerpoint" title="Apresentando o CEJUG e o poder do Java">Apresentando o CEJUG e o poder do Java</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=cejugeopoderdojava-1225676967306418-9&#038;stripped_title=apresentando-o-cejug-e-o-poder-do-java-presentation-715320" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=cejugeopoderdojava-1225676967306418-9&#038;stripped_title=apresentando-o-cejug-e-o-poder-do-java-presentation-715320" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View SlideShare <a style="text-decoration:underline;" href="http://www.slideshare.net/silveiraneto/apresentando-o-cejug-e-o-poder-do-java-presentation-715320?type=powerpoint" title="View Apresentando o CEJUG e o poder do Java on SlideShare">presentation</a> or <a style="text-decoration:underline;" href="http://www.slideshare.net/upload?type=powerpoint">Upload</a> your own. (tags: <a style="text-decoration:underline;" href="http://slideshare.net/tag/java">java</a> <a style="text-decoration:underline;" href="http://slideshare.net/tag/cejug">cejug</a>)</div>
</div>
<p></center></p>
<p><strong>Downloads:</strong></p>
<ul>
<li><a title="Slides em versão ODF" href="http://silveiraneto.net/downloads/cejug_e_o_poder_do_java.odp">cejug_e_o_poder_do_java.odp</a></li>
<li><a href="http://silveiraneto.net/downloads/cejug_e_o_poder_do_java.pdf">cejug_e_o_poder_do_java.pdf</a></li>
</ul>
<p>Os vídeos que eu passei na apresentação (indicados em slides com um ícone no canto inferior esquedo) são estes:</p>
<ul>
<li><a href="http://br.youtube.com/watch?v=mXMf9GOzzOA">Power of Java</a></li>
<li><a href="http://br.youtube.com/watch?v=guXCmQDy9Es">Java is Everywhere</a></li>
<li><a href="http://br.youtube.com/watch?v=VBp347dE0qw">Java is Everywhere 2</a></li>
<li><a href="http://br.youtube.com/watch?v=ZPEDaRj8lzE">Prêmio Universitário Java 2008</a></li>
</ul>
<p>Os slides dos demais palestrantes você pode encontrar nos seus respectivos blogs ou em breve no site do evento.</p>
<p>Eu reforço o convite para participar do CEJUG e entrar na lista de discussão seguindo <a title="Tutorial CEJUG" href="https://cejug.dev.java.net/files/documents/859/49894/tutorialInscricaoLista.pdf">esses passos</a>.</p>
<p>Eu agradeço a todos que estiveram envolvidos na organização do evento, aos que compareceram, <a title="Patrocínio do evento em Iguatu" href="http://cepug.org/wp-content/uploads/2008/10/patrocinio-1-novembro-sobral-260x300.jpg">aos patrocinadores</a>, ao CEJUG, ao CEPUG e ao Jefferson é claro, por seu empenho em fazer acontecer. Um encontro conjunto como esse demonstra um elevado grau de maturidade destas comunidades, que deixaram de lado as tão comuns briguinhas que eu observo entre algumas comunidades, para fazer um evento legal. A comunidade de desenvolvedores, estudantes e empresas do estado só se beneficia.</p>
<p>E quando você estiver em Iguatu, não deixe de ir naquele restaurante que tem em frente a rodoviária. Tem uma ótima picanha argentina. <img src='http://silveiraneto.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/11/03/1%c2%ba-encontro-cejugcepug-em-iguatu/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JavaFX, rectangular collision detection</title>
		<link>http://silveiraneto.net/2008/10/30/javafx-rectangular-collision-detection/</link>
		<comments>http://silveiraneto.net/2008/10/30/javafx-rectangular-collision-detection/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 15:26:36 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
		
		<category><![CDATA[english]]></category>

		<category><![CDATA[C]]></category>

		<category><![CDATA[game]]></category>

		<category><![CDATA[game development]]></category>

		<category><![CDATA[JavaFX]]></category>

		<category><![CDATA[jfx]]></category>

		<category><![CDATA[netbeans]]></category>

		<category><![CDATA[openjfx]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[rectangle collision]]></category>

		<category><![CDATA[rectangular collision]]></category>

		<category><![CDATA[rectangular collision detection]]></category>

		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1629</guid>
		<description><![CDATA[
In a game I wrote some years ago we handled simple rectangular collisions. Given the points:

We did:

// returning 0 means collision
int collision&#40;int ax, int ay, int bx, int by, int cx, int cy, int dx, int dy&#41;&#123;
	return &#40;&#40;ax &#62; dx&#41;&#124;&#124;&#40;bx &#60; cx&#41;&#124;&#124;&#40;ay &#62; dy&#41;&#124;&#124;&#40;by &#60; cy&#41;&#41;;
&#125;

I&#8217;ll show here a little demo about how implement simple [...]]]></description>
			<content:encoded><![CDATA[<p><center><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/NRwRTHPGg6M&amp;rel=0&amp;color1=0x006699&amp;color2=0x54abd6"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/NRwRTHPGg6M&amp;rel=0&amp;color1=0x006699&amp;color2=0x54abd6" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></object></center></p>
<p>In <a title="Batalhão" href="http://batalhao.codigolivre.org.br/">a game</a> I wrote some years ago we handled simple rectangular collisions. Given the points:</p>
<p style="text-align: center;"><img class="size-full wp-image-1630 aligncenter" title="abcd" src="http://silveiraneto.net/wp-content/uploads/2008/10/abcd.png" alt="" width="200" height="145" /></p>
<p>We did:</p>

<div class="wp_syntax"><div class="code"><pre class="c c" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// returning 0 means collision</span>
<span style="color: #993333;">int</span> collision<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> ax<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> ay<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> bx<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> by<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> cx<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> cy<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> dx<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> dy<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>ax <span style="color: #339933;">&gt;</span> dx<span style="color: #009900;">&#41;</span>||<span style="color: #009900;">&#40;</span>bx <span style="color: #339933;">&lt;</span> cx<span style="color: #009900;">&#41;</span>||<span style="color: #009900;">&#40;</span>ay <span style="color: #339933;">&gt;</span> dy<span style="color: #009900;">&#41;</span>||<span style="color: #009900;">&#40;</span>by <span style="color: #339933;">&lt;</span> cy<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I&#8217;ll show here a little demo about how implement simple rectangular collisions on JavaFX.<br />
First I created a movable rectangle using the same idea of draggable nodes I already had <a href="http://silveiraneto.net/2008/08/11/javafx-draggable-node/">posted before</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.input.MouseEvent</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.geometry.Rectangle</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MovableRectangle <span style="color: #000000; font-weight: bold;">extends</span> <span style="color: #003399;">Rectangle</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> attribute startX <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    <span style="color: #000000; font-weight: bold;">private</span> attribute startY <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> attribute onMove <span style="color: #339933;">=</span> function<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span><span style="color: #003399;">MouseEvent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
&nbsp;
    override attribute onMousePressed <span style="color: #339933;">=</span> function<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span><span style="color: #003399;">MouseEvent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
        startX <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>translateX;
        startY <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>translateY;
        onMove<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    override attribute onMouseDragged <span style="color: #339933;">=</span> function<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span><span style="color: #003399;">MouseEvent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
        translateX <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>startX;
        translateY <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>startY;
        onMove<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In the main code I some important things:</p>
<ul>
<li><strong>colide</strong>, a color that represents the collision effect. White means no collision and gray means collision.</li>
<li><strong>rec1</strong> and <strong>rec2</strong>, the two rectangles that can collide.</li>
<li><strong>checkcollision()</strong> the function that checks and handles a possible collision.</li>
</ul>
<p>Here is the main code:</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.application.Frame</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.application.Stage</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.geometry.Rectangle</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.paint.Color</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.input.MouseEvent</span>;
&nbsp;
var colide <span style="color: #339933;">=</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">WHITE</span>;
&nbsp;
function checkcollision<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>
        <span style="color: #009900;">&#40;</span>rec1.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> rec2.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> rec2.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> or
        <span style="color: #009900;">&#40;</span>rec1.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> rec1.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> rec2.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> or 
        <span style="color: #009900;">&#40;</span>rec1.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> rec2.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> rec2.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> or 
        <span style="color: #009900;">&#40;</span>rec1.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> rec1.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> rec2.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        colide <span style="color: #339933;">=</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">WHITE</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
        colide <span style="color: #339933;">=</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">LIGHTGRAY</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
var rec1<span style="color: #339933;">:</span> MovableRectangle <span style="color: #339933;">=</span> MovableRectangle <span style="color: #009900;">&#123;</span>
    x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">10</span>, y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">10</span>, width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">60</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">RED</span>
    onMove<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span><span style="color: #003399;">MouseEvent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
        checkcollision<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
var rec2<span style="color: #339933;">:</span> MovableRectangle <span style="color: #339933;">=</span> MovableRectangle <span style="color: #009900;">&#123;</span>
    x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>, y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>, width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">70</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">30</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLUE</span>
    onMove<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span><span style="color: #003399;">MouseEvent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
        checkcollision<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003399;">Frame</span> <span style="color: #009900;">&#123;</span>
    title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Rectangular Collisions&quot;</span>, width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>
    closeAction<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        java.<span style="color: #006633;">lang</span>.<span style="color: #003399;">System</span>.<span style="color: #006633;">exit</span><span style="color: #009900;">&#40;</span> 0 <span style="color: #009900;">&#41;</span>; 
    <span style="color: #009900;">&#125;</span>
    visible<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
&nbsp;
    stage<span style="color: #339933;">:</span> Stage <span style="color: #009900;">&#123;</span>
        fill<span style="color: #339933;">:</span> bind colide
        content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>rec1, rec2<span style="color: #009900;">&#93;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Try it via Java Web Start:</p>
<p><center><a href="http://silveiraneto.net/downloads/collisiondemo/launch.jnlp"><img src="http://silveiraneto.net/wp-content/uploads/2008/10/webstart.png" alt="Java Web Start" /></a></center></p>
<p>Some considerations:</p>
<ul>
<li>You can use rectangular collisions to create bounding boxes to handle collisions in more complex shapes or sprites. Is a common approach in 2d games to avoid more expensive calculations.</li>
<li>There are space for optimizations.</li>
<li>In this case I&#8217;m using only two objects. Some problems raises when I have N objects to handle.</li>
</ul>
<p>More generally, we can code:</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;">function collission<span style="color: #009900;">&#40;</span>ax, ay, bx, by, cx, cy, dx, dy<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #003399;">Boolean</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> not <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>ax <span style="color: #339933;">&gt;</span> dx<span style="color: #009900;">&#41;</span>or<span style="color: #009900;">&#40;</span>bx <span style="color: #339933;">&lt;</span> cx<span style="color: #009900;">&#41;</span>or<span style="color: #009900;">&#40;</span>ay <span style="color: #339933;">&gt;</span> dy<span style="color: #009900;">&#41;</span>or<span style="color: #009900;">&#40;</span>by <span style="color: #339933;">&lt;</span> cy<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
function hitnode<span style="color: #009900;">&#40;</span>a<span style="color: #339933;">:</span> Node, b<span style="color: #339933;">:</span>Node<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #003399;">Boolean</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>collission<span style="color: #009900;">&#40;</span>
        a.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, a.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        a.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> a.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, a.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> a.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        b.<span style="color: #006633;">getX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, b.<span style="color: #006633;">getY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        b.<span style="color: #006633;">getX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, b.<span style="color: #006633;">getY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This way we can pass just two bounding boxes to hitnode and easily check collision of a node against a list of bounding boxes nodes.<br />
Using the same approach I also wrote this function to test if a Node is inside another Node:</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;">function inside <span style="color: #009900;">&#40;</span>ax, ay, bx, by, cx, cy, dx, dy<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Boolean</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>ax <span style="color: #339933;">&gt;</span> cx<span style="color: #009900;">&#41;</span> and <span style="color: #009900;">&#40;</span>bx <span style="color: #339933;">&lt;</span> dx<span style="color: #009900;">&#41;</span> and <span style="color: #009900;">&#40;</span>ay <span style="color: #339933;">&gt;</span> cy<span style="color: #009900;">&#41;</span> and <span style="color: #009900;">&#40;</span>by <span style="color: #339933;">&lt;</span> dy<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
function insidenode<span style="color: #009900;">&#40;</span>a<span style="color: #339933;">:</span>Node,b<span style="color: #339933;">:</span>Node<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Boolean</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>inside<span style="color: #009900;">&#40;</span>
        a.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, a.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        a.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> a.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, a.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> a.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        b.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, b.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        b.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, b.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Soon I&#8217;ll post game examples showing how to use this method and others collission detection methods.</p>
<p><strong>Downloads:</strong></p>
<ul>
<li>The original video, <a href="http://silveiraneto.net/downloads/javafx_rectangular_collision_detection.ogg">javafx_rectangular_collision_detection.ogg</a></li>
<li>NetBeans 6.1 Project with sources, <a href="http://silveiraneto.net/downloads/javafx_rec_col.tar.gz">javafx_rec_col.tar.gz</a>. Needs <a href="http://javafx.netbeans.org">JavaFX module</a> installed.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/10/30/javafx-rectangular-collision-detection/feed/</wfw:commentRss>
		</item>
		<item>
		<title>La trahison</title>
		<link>http://silveiraneto.net/2008/10/28/la-trahison/</link>
		<comments>http://silveiraneto.net/2008/10/28/la-trahison/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 02:04:32 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
		
		<category><![CDATA[français]]></category>

		<category><![CDATA[René Magritte]]></category>

		<category><![CDATA[The Treachery of Images]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1575</guid>
		<description><![CDATA[Ceci n&#8217;est pas un blogue.
]]></description>
			<content:encoded><![CDATA[<p><strong>Ceci n&#8217;est pas un blogue.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/10/28/la-trahison/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
