<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="http://rss.egloos.com/style/blog.xsl" type="text/xsl" media="screen"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
	<title>^@#%&amp;$</title>
	<link>http://handmade.egloos.com</link>
	<description>정확히 말하면 지금 이 현실이 참 불쾌합니다.</description>
	<language>ko</language>
	<pubDate>Sun, 08 Nov 2009 13:09:29 GMT</pubDate>
	<generator>Egloos</generator>
	<image>
		<title>^@#%&amp;$</title>
		<url>http://pds1.egloos.com/logo/1/200510/27/72/c0024072.jpg</url>
		<link>http://handmade.egloos.com</link>
		<width>80</width>
		<height>80</height>
		<description>정확히 말하면 지금 이 현실이 참 불쾌합니다.</description>
	</image>
  	<item>
		<title><![CDATA[ 타워 게임을 어떻게 만들어야 할 것인가? ]]> </title>
		<link>http://handmade.egloos.com/5117278</link>
		<guid>http://handmade.egloos.com/5117278</guid>
		<description>
			<![CDATA[ 
  타워 게임을 어케 만들어야 할까여?<div><br />
</div><div>클래스를 어케 구성해야 할지를 모르겠네영..</div><div><br />
</div><div>우선, 학교에서 배운대로 요구사항을 작성한 다음에 요구사항에서 클래스를 도출해 보도록 하지영.</div><div>(딱히, 다른 대안이 없어서 이런짓을 하고 있다능..;;)</div><div><br />
</div><div>음, 우선 제가 원하는건, 고정된 맵이 등장하구요. 아, 맵은 한 화면 크기예요. 다시말해 스크롤되거나 그런건 없다는 말이지여.</div><div>그다음에 <span id="POPS8065_262" class="pops">지도</span>에는 딱 길 하나가 존재해요. 구불구불해도 되고 직선이어도 되고 뭐, 암 상관 없긴 한데, 어쨌든 출발에서 도착까지 이어지는 길이 일방통행 인거예요. 중간에 교차로 막 이따위꺼 나오면 안되여.</div><div>그리고 지도에 적을 공격할수 있는 타워가 있어여. 이 타워는 사용자가 짓게되여. 타워는 여러가지 종류가 존재할수 있어여. 그리고 각 타워는 자신만의 공격 범위를 가지고 있지여. 물론, 공격력도 각기 다르지여.</div><div>웅, 그리고 적들은 이동속도가 달라여. 근데, 일방통행이잖아여. 그래서 한 단계에서 나오는 적은 모조리 같은 녀석이 나와여. 즉 적 10마리가 출발에서 도착지까지 이동한다고 하면 동일한 적 10마리가 나오게 되는거지여. 적은 단계가 넘어가면서 바껴여.</div><div><br />
</div><div>원평희 추가:</div><font class="Apple-style-span" color="#999999">적은 한방에 죽는게 아니라면 맷집이나 체력이 있어야 할것 같구.. 또.. 이름이라던가.. 위치좌표라던가.. 있으면 좋을것 같은데요..<br />
흠.. 유저 클래스도 만들어주면 좋지 않을까요.. 남은 체력이라던지.. 돈.. 점수 등이 필요할 것 같아요..<br />
</font><br />
<div>여기서 간단히 추출할수 있는 클래스는 <b>'맵', '타워', '적', '유저'</b>&nbsp;밖에 없는건가여?</div><div><br />
</div><div>속성은</div><div><b>맵 : 고정, 한화면, 일방통행, 타워, 적</b></div><div><b>타워 : 종류, 공격 범위, 공격력, 소요금액</b></div><div><b>적 : 이동속도,&nbsp;<span class="Apple-style-span" style="font-weight: normal; "><b>종류, 위치, HP, <s>이름</s><span class="Apple-style-span" style="font-weight: normal; "><b>&nbsp;</b></span></b></span></b></div><div><b>유저 : 돈</b></div><div>정도를 추출해 냈는데.. 음...</div><div><br />
</div><div>뭐가 더 있어야 할까여?</div><br />
<a href="http://garden.egloos.com/10000277">이글루스 가든 - 게임 프로그래머 되기</a><br/><br/>tag : <a href="/tag/타워디펜스" rel="tag">타워디펜스</a>,&nbsp;<a href="/tag/TD" rel="tag">TD</a>,&nbsp;<a href="/tag/Game" rel="tag">Game</a>,&nbsp;<a href="/tag/Concept" rel="tag">Concept</a>,&nbsp;<a href="/tag/설계" rel="tag">설계</a>,&nbsp;<a href="/tag/디자인" rel="tag">디자인</a>,&nbsp;<a href="/tag/design" rel="tag">design</a>,&nbsp;<a href="/tag/programming" rel="tag">programming</a>			 ]]> 
		</description>
		<category>Study+more</category>
		<category>타워디펜스</category>
		<category>TD</category>
		<category>Game</category>
		<category>Concept</category>
		<category>설계</category>
		<category>디자인</category>
		<category>design</category>
		<category>programming</category>

		<comments>http://handmade.egloos.com/5117278#comments</comments>
		<pubDate>Sun, 08 Nov 2009 12:06:09 GMT</pubDate>
		<dc:creator>승네군</dc:creator>
	</item>
	<item>
		<title><![CDATA[ 일기 ]]> </title>
		<link>http://handmade.egloos.com/5113999</link>
		<guid>http://handmade.egloos.com/5113999</guid>
		<description>
			<![CDATA[ 
  아쒸바 짜증.<div><br />
</div><div>오늘 하루 한것들 중에서 제대로 끝난게 없다.&nbsp;</div><div><br />
</div><div>아니. 막차타고 집에 가려는데, 발목 잡는 이유는 뭐냐?</div><div><br />
</div><div>씨발 일정. 아 진짜. - _-</div><br/><br/>tag : <a href="/tag/야근" rel="tag">야근</a>,&nbsp;<a href="/tag/회사" rel="tag">회사</a>,&nbsp;<a href="/tag/사우나" rel="tag">사우나</a>,&nbsp;<a href="/tag/피곤" rel="tag">피곤</a>,&nbsp;<a href="/tag/피로" rel="tag">피로</a>,&nbsp;<a href="/tag/휴식" rel="tag">휴식</a>			 ]]> 
		</description>
		<category>Day+by+day</category>
		<category>야근</category>
		<category>회사</category>
		<category>사우나</category>
		<category>피곤</category>
		<category>피로</category>
		<category>휴식</category>

		<comments>http://handmade.egloos.com/5113999#comments</comments>
		<pubDate>Wed, 04 Nov 2009 14:17:59 GMT</pubDate>
		<dc:creator>승네군</dc:creator>
	</item>
	<item>
		<title><![CDATA[ 흠흠. ]]> </title>
		<link>http://handmade.egloos.com/5112841</link>
		<guid>http://handmade.egloos.com/5112841</guid>
		<description>
			<![CDATA[ 
  오랜만 : )			 ]]> 
		</description>
		<category>Day+by+day</category>

		<comments>http://handmade.egloos.com/5112841#comments</comments>
		<pubDate>Tue, 03 Nov 2009 07:06:03 GMT</pubDate>
		<dc:creator>승네군</dc:creator>
	</item>
	<item>
		<title><![CDATA[ 호구가 호구로 살아야지 안그럼 어째..- _- ]]> </title>
		<link>http://handmade.egloos.com/5101118</link>
		<guid>http://handmade.egloos.com/5101118</guid>
		<description>
			<![CDATA[ 
  호구가 호구로 사는게 당연한 일이 되어버린 세상이니 `어쩔수 없다`고 밖에 말 못하겠소.<div>지금부터라도 바꿔가면 나 죽고 나서 바뀌기야 할것 같지만, 나 죽고나 무슨 소용이 있다고 그 귀찮은 일을 할까나?</div><div><br />
</div><div>돈 안생기는 일에 1/100을 투자하여 나 죽고 나서 10이 돌아오는것 보다</div><div>돈 생기는 일에 1/100을 더 투자하여 나 죽기 전에 1/10이 돌아오는것을 바라는게 잘못된 일인가?</div><div><br />
</div><div>할말이 없다.&nbsp;</div><div>정신 차리고 살아야지.</div><div>아니면... 정신줄을 놓고 살던지.</div><div><br />
</div><div>다양한 스펙트럼 어쩌고 하는 개소리 하지만, 따지고 들면 결국엔 흑 아니면 백으로 나뉘는데 뭐...</div><div><br />
</div><div>PS. 이건 그 일이랑 상관 없는 물음이긴 한데, 자식에게 뼈빠지게 헌신하는 이유는 뭔가요?</div><div>PS. 살아 생전에 덕보려는 그런것 말고...</div><br/><br/>tag : <a href="/tag/사기꾼" rel="tag">사기꾼</a>,&nbsp;<a href="/tag/호구" rel="tag">호구</a>,&nbsp;<a href="/tag/피해자" rel="tag">피해자</a>			 ]]> 
		</description>
		<category>이상한 思想</category>
		<category>사기꾼</category>
		<category>호구</category>
		<category>피해자</category>

		<comments>http://handmade.egloos.com/5101118#comments</comments>
		<pubDate>Tue, 20 Oct 2009 11:15:55 GMT</pubDate>
		<dc:creator>승네군</dc:creator>
	</item>
	<item>
		<title><![CDATA[ 실력이 없으니...맨날 생각만 하는구나. ]]> </title>
		<link>http://handmade.egloos.com/5095297</link>
		<guid>http://handmade.egloos.com/5095297</guid>
		<description>
			<![CDATA[ 
  간만에, 일찍(...) 퇴근해서 인터넷을 좀 돌아다니다 보니.. 옴.. 다시 게임 제작에 의욕이 생긴다.&nbsp;<div>... 아 실수.. 의욕'<b>만</b>'생긴다..</div><div><br />
</div><div>우선, 인터넷에서 넘쳐나다 못해 이제는 질려버린 '타워'게임.</div><div>간단히 640x480 사이즈 화면으로 하면 적당히 나올거 같은데...</div><div>이미지도 구하기 쉽고(뭣하면 만들면 되지 뭐...)</div><div><br />
</div><div>다음으로, 탄막(...!) 액션 RPG(...?!) 인데..</div><div>실상은, 단순히 허허 벌판에 적들이 떼거지로 나오고, 주인공이 칼질해서 적 죽이고</div><div>어느 정도 죽이면 레벨업 되고... 음 우선 여기까지만 생각 했었음.</div><div><br />
</div><div>'타워' 게임은 타일 기반이라서 생각보다 쉽게 만들수 있을거 같기도 한데.. 음 : )</div><br/><br/>tag : <a href="/tag/게임" rel="tag">게임</a>,&nbsp;<a href="/tag/동인게임" rel="tag">동인게임</a>,&nbsp;<a href="/tag/제작" rel="tag">제작</a>,&nbsp;<a href="/tag/아마추어" rel="tag">아마추어</a>,&nbsp;<a href="/tag/기획" rel="tag">기획</a>,&nbsp;<a href="/tag/망상" rel="tag">망상</a>			 ]]> 
		</description>
		<category>Small Ideas</category>
		<category>게임</category>
		<category>동인게임</category>
		<category>제작</category>
		<category>아마추어</category>
		<category>기획</category>
		<category>망상</category>

		<comments>http://handmade.egloos.com/5095297#comments</comments>
		<pubDate>Tue, 13 Oct 2009 14:32:06 GMT</pubDate>
		<dc:creator>승네군</dc:creator>
	</item>
	<item>
		<title><![CDATA[ 몸이 피곤하니... ]]> </title>
		<link>http://handmade.egloos.com/5094174</link>
		<guid>http://handmade.egloos.com/5094174</guid>
		<description>
			<![CDATA[ 
  신경이 날카롭다.<div><br />
</div><div>뭐, 물론 날을 남에게 보이지는 않으려고 한다.</div><br/><br/>tag : <a href="/tag/무기력" rel="tag">무기력</a>,&nbsp;<a href="/tag/수면" rel="tag">수면</a>,&nbsp;<a href="/tag/운동" rel="tag">운동</a>,&nbsp;<a href="/tag/헬스" rel="tag">헬스</a>,&nbsp;<a href="/tag/피곤" rel="tag">피곤</a>,&nbsp;<a href="/tag/피로" rel="tag">피로</a>,&nbsp;<a href="/tag/이슈" rel="tag">이슈</a>,&nbsp;<a href="/tag/문제" rel="tag">문제</a>,&nbsp;<a href="/tag/사고" rel="tag">사고</a>			 ]]> 
		</description>
		<category>Day+by+day</category>
		<category>무기력</category>
		<category>수면</category>
		<category>운동</category>
		<category>헬스</category>
		<category>피곤</category>
		<category>피로</category>
		<category>이슈</category>
		<category>문제</category>
		<category>사고</category>

		<comments>http://handmade.egloos.com/5094174#comments</comments>
		<pubDate>Mon, 12 Oct 2009 11:53:06 GMT</pubDate>
		<dc:creator>승네군</dc:creator>
	</item>
	<item>
		<title><![CDATA[ 한글날? 공휴일? 어? 진짜? ]]> </title>
		<link>http://handmade.egloos.com/5091264</link>
		<guid>http://handmade.egloos.com/5091264</guid>
		<description>
			<![CDATA[ 
  이새끼들이 누굴 봉다리 핫<span id="POPS21572_791" class="pops">바지</span>로 보나. 좆까라 시바- _-<div>어디서 약을 팔어!</div><div><br />
</div><div>--</div><div><a href="http://deulpul.egloos.com/1956631">http://deulpul.egloos.com/1956631</a>&nbsp;병신드립도 가지가지. 후쌛</div><div><a href="http://www.lameproof.com/zboard/zboard.php?id=bbs1&amp;page=1&amp;sn1=&amp;divpage=4&amp;sn=off&amp;ss=on&amp;sc=on&amp;sm=off&amp;select_arrange=headnum&amp;desc=asc&amp;no=19595">http://lameproof.com/</a>&nbsp;한글날 하루전에 언플드립. 이건 뭐 병신도 아니고..</div><div><br />
</div><div>PS. 난독증 있으신분 있으면 대화로 해결합시다.</div><br/><br/>tag : <a href="/tag/한글날" rel="tag">한글날</a>,&nbsp;<a href="/tag/휴일" rel="tag">휴일</a>,&nbsp;<a href="/tag/개뻥" rel="tag">개뻥</a>			 ]]> 
		</description>
		<category>Day+by+day</category>
		<category>한글날</category>
		<category>휴일</category>
		<category>개뻥</category>

		<comments>http://handmade.egloos.com/5091264#comments</comments>
		<pubDate>Thu, 08 Oct 2009 19:09:56 GMT</pubDate>
		<dc:creator>승네군</dc:creator>
	</item>
	<item>
		<title><![CDATA[ Allegro/STL Tutorial Ch.6 ]]> </title>
		<link>http://handmade.egloos.com/5075983</link>
		<guid>http://handmade.egloos.com/5075983</guid>
		<description>
			<![CDATA[ 
  <span style="font-size:130%;">Chapter 6<br />
</span><br />
<strong>6. Basic Game Design<br />
</strong><br />
<strong>6.1 The basic sprite system<br />
</strong><br />
From the previous exercise, we have a program where we could move two helicopter sprites around the screen, and outside it. There are two improvements we want to do at this point; first, we want the helicopter to stay on screen; second, we want the helicopter's ceiling fan to look like it's moving. To make it easier to accomplish similar things for the other objects we are soon going to create, we will implement some more features into the base class, and make the chopper class use these. We will also make a background class. The code now looks like this:<br />
이전 예에서, 우리는 두개의 헬리콥터가 화면을 가로질러서 화면 밖으로 나가버리는 프로그래을 만들었다. 거기에 두개의 바꾸고 싶은것이 보인다: 첫째, 우리는 헬리콥터를 화면에 머무르게 하고 싶다. 둘째, 우리는 헬리콥터의 날개가 움직이는것 처러 보이고 싶다.<span style="color:#ff6600;">(이거 맞는 번역임??)</span> 우리가 앞으로 만들 다른 객체들에도 비슷한 내용을 적용하기 위해서,&nbsp;우리는 베이스 클래스에 몇가지 기능을 더 구현할 것이다. 그리고 chopper 클래스가 베이스 클래스에 추가된 기능을 사용할 것이다. 또한, 우리는 background 클래스도 만들것이다. 이 내용을 모두 적용한 코드는 다음과 같다:<br />
<!-- Generator: GNU source-highlight 3.1<br />
by Lorenzo Bettini<br />
http://www.lorenzobettini.it<br />
http://www.gnu.org/software/src-highlite --><br />
<pre><tt><b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;allegro.h&gt;</font><br />
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;stl.h&gt;</font><br />
<b><font color="#000080">#include</font></b> <font color="#FF0000">"tutorial.h"</font><br />
<br />
<b><font color="#000080">#define</font></b> MIN_Y <font color="#993399">8</font><br />
<b><font color="#000080">#define</font></b> MAX_Y <font color="#993399">180</font><br />
<br />
DATAFILE<font color="#990000">*</font>data<font color="#990000">;</font><br />
BITMAP<font color="#990000">*</font>backdrop<font color="#990000">,*</font>framebuf<font color="#990000">;</font><br />
<br />
<b><font color="#0000FF">class</font></b> <font color="#008080">sprite</font> <font color="#FF0000">{</font><br />
<b><font color="#0000FF">protected</font></b><font color="#990000">:</font><br />
 <font color="#008080">fix</font> X<font color="#990000">,</font>Y<font color="#990000">;</font><br />
 RLE_SPRITE<font color="#990000">*</font>image<font color="#990000">;</font><br />
<b><font color="#0000FF">public</font></b><font color="#990000">:</font><br />
 <b><font color="#000000">sprite</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">)</font> <font color="#FF0000">{</font> X<font color="#990000">=</font>_X<font color="#990000">;</font> Y<font color="#990000">=</font>_Y<font color="#990000">;</font> image<font color="#990000">=</font>NULL<font color="#990000">;</font> <font color="#FF0000">}</font><br />
 <b><font color="#000000">sprite</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">,</font>RLE_SPRITE<font color="#990000">*</font>img<font color="#990000">)</font> <font color="#FF0000">{</font> X<font color="#990000">=</font>_X<font color="#990000">;</font> Y<font color="#990000">=</font>_Y<font color="#990000">;</font> image<font color="#990000">=</font>img<font color="#990000">;</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#990000">~</font><b><font color="#000000">sprite</font></b><font color="#990000">()</font> <font color="#FF0000">{}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">draw</font></b><font color="#990000">(</font>BITMAP<font color="#990000">*</font>dest<font color="#990000">)</font> <font color="#FF0000">{</font><br />
  <b><font color="#000000">draw_rle_sprite</font></b><font color="#990000">(</font>dest<font color="#990000">,</font>image<font color="#990000">,</font>X<font color="#990000">,</font>Y<font color="#990000">);</font><br />
 <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">clippos</font></b><font color="#990000">()</font> <font color="#FF0000">{</font> <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>Y<font color="#990000">+</font>image<font color="#990000">-&gt;</font>h<font color="#990000">&gt;</font>MAX_Y<font color="#990000">)</font> Y<font color="#990000">=</font>MAX_Y<font color="#990000">-</font>image<font color="#990000">-&gt;</font>h<font color="#990000">;</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">move</font></b><font color="#990000">(</font><font color="#008080">fix</font> DX<font color="#990000">,</font><font color="#008080">fix</font> DY<font color="#990000">)</font> <font color="#FF0000">{</font> X<font color="#990000">+=</font>DX<font color="#990000">;</font> Y<font color="#990000">+=</font>DY<font color="#990000">;</font> <b><font color="#000000">clippos</font></b><font color="#990000">();</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">place</font></b><font color="#990000">(</font><font color="#008080">fix</font> NX<font color="#990000">,</font><font color="#008080">fix</font> NY<font color="#990000">)</font> <font color="#FF0000">{</font> X<font color="#990000">=</font>NX<font color="#990000">;</font> Y<font color="#990000">=</font>NY<font color="#990000">;</font> <b><font color="#000000">clippos</font></b><font color="#990000">();</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">int</font> <b><font color="#000000">outside</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">)</font> <font color="#FF0000">{</font> <b><font color="#0000FF">return</font></b> <font color="#990000">(</font>_X<font color="#990000">&lt;-</font>image<font color="#990000">-&gt;</font>w<font color="#990000">)||(</font>_X<font color="#990000">&gt;=</font>SCREEN_W<font color="#990000">);</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">bool</font> <b><font color="#000000">animate</font></b><font color="#990000">()</font> <font color="#FF0000">{</font> <b><font color="#0000FF">return</font></b> FALSE<font color="#990000">;</font> <font color="#FF0000">}</font><br />
<font color="#FF0000">}</font><font color="#990000">;</font><br />
<br />
<b><font color="#0000FF">typedef</font></b> <font color="#008080">list&lt;sprite*&gt;</font> sprite_list<font color="#990000">;</font><br />
<br />
<font color="#008080">sprite_list</font> sprites<font color="#990000">;</font><br />
<br />
<b><font color="#0000FF">class</font></b> <font color="#008080">background</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> sprite <font color="#FF0000">{</font><br />
<b><font color="#0000FF">public</font></b><font color="#990000">:</font><br />
 <b><font color="#000000">background</font></b><font color="#990000">()</font> <font color="#990000">:</font> <b><font color="#000000">sprite</font></b><font color="#990000">(</font><font color="#993399">0</font><font color="#990000">,</font>MIN_Y<font color="#990000">)</font> <font color="#FF0000">{}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">draw</font></b><font color="#990000">(</font>BITMAP<font color="#990000">*</font>dest<font color="#990000">)</font> <font color="#FF0000">{</font><br />
  <b><font color="#000000">blit</font></b><font color="#990000">(</font>backdrop<font color="#990000">,</font>dest<font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font>X<font color="#990000">,</font>Y<font color="#990000">,</font>backdrop<font color="#990000">-&gt;</font>w<font color="#990000">,</font>backdrop<font color="#990000">-&gt;</font>h<font color="#990000">);</font><br />
 <font color="#FF0000">}</font><br />
<font color="#FF0000">}</font><font color="#990000">;</font><br />
<br />
<b><font color="#0000FF">class</font></b> <font color="#008080">chopper</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> sprite <font color="#FF0000">{</font><br />
<b><font color="#0000FF">protected</font></b><font color="#990000">:</font><br />
 <font color="#009900">int</font> frame<font color="#990000">;</font><br />
<b><font color="#0000FF">public</font></b><font color="#990000">:</font><br />
 <b><font color="#000000">chopper</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">)</font><br />
  <font color="#990000">:</font> <b><font color="#000000">sprite</font></b><font color="#990000">(</font>_X<font color="#990000">,</font>_Y<font color="#990000">,(</font>RLE_SPRITE<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_CHOPPER<font color="#990000">].</font>dat<font color="#990000">)</font> <font color="#FF0000">{</font> frame<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">clippos</font></b><font color="#990000">()</font> <font color="#FF0000">{</font><br />
  <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>X<font color="#990000">&lt;</font><font color="#993399">0</font><font color="#990000">)</font> X<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font><br />
  <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>X<font color="#990000">+</font>image<font color="#990000">-&gt;</font>w<font color="#990000">&gt;</font>SCREEN_W<font color="#990000">)</font> X<font color="#990000">=</font>SCREEN_W<font color="#990000">-</font>image<font color="#990000">-&gt;</font>w<font color="#990000">;</font><br />
  <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>Y<font color="#990000">&lt;</font>MIN_Y<font color="#990000">)</font> Y<font color="#990000">=</font>MIN_Y<font color="#990000">;</font><br />
  sprite<font color="#990000">::</font><b><font color="#000000">clippos</font></b><font color="#990000">();</font><br />
 <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">bool</font> <b><font color="#000000">animate</font></b><font color="#990000">();</font><br />
<font color="#FF0000">}</font><font color="#990000">;</font><br />
<br />
<font color="#009900">bool</font> chopper<font color="#990000">::</font><b><font color="#000000">animate</font></b><font color="#990000">()</font><br />
<font color="#FF0000">{</font><br />
 <font color="#008080">fix</font> DX<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">,</font>DY<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font><br />
<br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_LEFT<font color="#990000">]||</font>joy_left<font color="#990000">)</font> <font color="#990000">--</font>DX<font color="#990000">;</font><br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_RIGHT<font color="#990000">]||</font>joy_right<font color="#990000">)</font> <font color="#990000">++</font>DX<font color="#990000">;</font><br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_UP<font color="#990000">]||</font>joy_up<font color="#990000">)</font> <font color="#990000">--</font>DY<font color="#990000">;</font><br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_DOWN<font color="#990000">]||</font>joy_down<font color="#990000">)</font> <font color="#990000">++</font>DY<font color="#990000">;</font><br />
<br />
 <b><font color="#000000">move</font></b><font color="#990000">(</font>DX<font color="#990000">,</font>DY<font color="#990000">);</font><br />
<br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>frame<font color="#990000">)</font> <font color="#FF0000">{</font> image<font color="#990000">=(</font>RLE_SPRITE<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_CHOPPER1<font color="#990000">].</font>dat<font color="#990000">;</font> frame<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font> <font color="#FF0000">}</font><br />
       <b><font color="#0000FF">else</font></b> <font color="#FF0000">{</font> image<font color="#990000">=(</font>RLE_SPRITE<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_CHOPPER2<font color="#990000">].</font>dat<font color="#990000">;</font> frame<font color="#990000">=</font><font color="#993399">1</font><font color="#990000">;</font> <font color="#FF0000">}</font><br />
<br />
 <b><font color="#0000FF">return</font></b> FALSE<font color="#990000">;</font><br />
<font color="#FF0000">}</font><br />
<br />
<b><font color="#0000FF">class</font></b> <font color="#008080">chopper2</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> chopper <font color="#FF0000">{</font><br />
<b><font color="#0000FF">public</font></b><font color="#990000">:</font><br />
 <b><font color="#000000">chopper2</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">)</font> <font color="#990000">:</font> <b><font color="#000000">chopper</font></b><font color="#990000">(</font>_X<font color="#990000">,</font>_Y<font color="#990000">)</font> <font color="#FF0000">{}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">move</font></b><font color="#990000">(</font><font color="#008080">fix</font> DX<font color="#990000">,</font><font color="#008080">fix</font> DY<font color="#990000">)</font> <font color="#FF0000">{</font> X<font color="#990000">-=</font>DX<font color="#990000">;</font> Y<font color="#990000">-=</font>DY<font color="#990000">;</font> <b><font color="#000000">clippos</font></b><font color="#990000">();</font> <font color="#FF0000">}</font><br />
<font color="#FF0000">}</font><font color="#990000">;</font><br />
<br />
<font color="#009900">int</font> <b><font color="#000000">main</font></b><font color="#990000">()</font><br />
<font color="#FF0000">{</font><br />
 <b><font color="#000000">allegro_init</font></b><font color="#990000">();</font><br />
 <b><font color="#000000">install_keyboard</font></b><font color="#990000">();</font><br />
 <b><font color="#000000">initialise_joystick</font></b><font color="#990000">();</font><br />
<br />
 data<font color="#990000">=</font><b><font color="#000000">load_datafile</font></b><font color="#990000">(</font><font color="#FF0000">"tutorial.dat"</font><font color="#990000">);</font><br />
<br />
 <b><font color="#000000">set_gfx_mode</font></b><font color="#990000">(</font>GFX_VGA<font color="#990000">,</font><font color="#993399">320</font><font color="#990000">,</font><font color="#993399">200</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">);</font><br />
<br />
 <b><font color="#000000">set_palette</font></b><font color="#990000">((</font>RGB<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_GAMEPAL<font color="#990000">].</font>dat<font color="#990000">);</font><br />
<br />
 <i><font color="#9A1900">// create 320x192 backdrop</font></i><br />
 backdrop<font color="#990000">=</font><b><font color="#000000">create_bitmap</font></b><font color="#990000">(</font><font color="#993399">320</font><font color="#990000">,</font><font color="#993399">192</font><font color="#990000">);</font><br />
 <b><font color="#0000FF">for</font></b> <font color="#990000">(</font><font color="#009900">int</font> Y<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font> Y<font color="#990000">&lt;</font><font color="#993399">128</font><font color="#990000">;</font> Y<font color="#990000">++)</font> <b><font color="#000000">hline</font></b><font color="#990000">(</font>backdrop<font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font>Y<font color="#990000">,</font><font color="#993399">319</font><font color="#990000">,</font> <font color="#990000">(</font>Y<font color="#990000">/</font><font color="#993399">2</font><font color="#990000">)+</font><font color="#993399">128</font><font color="#990000">);</font><br />
 <b><font color="#0000FF">for</font></b> <font color="#990000">(</font><font color="#009900">int</font> Y<font color="#990000">=</font><font color="#993399">128</font><font color="#990000">;</font> Y<font color="#990000">&lt;</font><font color="#993399">192</font><font color="#990000">;</font> Y<font color="#990000">++)</font> <b><font color="#000000">hline</font></b><font color="#990000">(</font>backdrop<font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font>Y<font color="#990000">,</font><font color="#993399">319</font><font color="#990000">,</font> <font color="#990000">((</font>Y<font color="#990000">-</font><font color="#993399">128</font><font color="#990000">)/</font><font color="#993399">2</font><font color="#990000">)+</font><font color="#993399">192</font><font color="#990000">);</font><br />
<br />
 <i><font color="#9A1900">// create 320x200 double buffer</font></i><br />
 framebuf<font color="#990000">=</font><b><font color="#000000">create_bitmap</font></b><font color="#990000">(</font><font color="#993399">320</font><font color="#990000">,</font><font color="#993399">200</font><font color="#990000">);</font><br />
 <b><font color="#000000">clear</font></b><font color="#990000">(</font>framebuf<font color="#990000">);</font><br />
<br />
 <font color="#008080">background</font> Back<font color="#990000">;</font><br />
 <font color="#008080">chopper</font> <b><font color="#000000">Hero</font></b><font color="#990000">(</font><font color="#993399">50</font><font color="#990000">,</font><font color="#993399">100</font><font color="#990000">);</font><br />
 <font color="#008080">chopper2</font> <b><font color="#000000">AnotherHero</font></b><font color="#990000">(</font><font color="#993399">250</font><font color="#990000">,</font><font color="#993399">50</font><font color="#990000">);</font><br />
 sprites<font color="#990000">.</font><b><font color="#000000">push_back</font></b><font color="#990000">(&amp;</font>Back<font color="#990000">);</font><br />
 sprites<font color="#990000">.</font><b><font color="#000000">push_back</font></b><font color="#990000">(&amp;</font>Hero<font color="#990000">);</font><br />
 sprites<font color="#990000">.</font><b><font color="#000000">push_back</font></b><font color="#990000">(&amp;</font>AnotherHero<font color="#990000">);</font><br />
<br />
 <b><font color="#0000FF">while</font></b> <font color="#990000">(!</font>key<font color="#990000">[</font>KEY_ESC<font color="#990000">])</font> <font color="#FF0000">{</font><br />
  <i><font color="#9A1900">// draw sprites</font></i><br />
  <font color="#FF0000">{</font><br />
   sprite_list<font color="#990000">::</font><font color="#008080">const_iterator</font> spr<font color="#990000">=</font>sprites<font color="#990000">.</font><b><font color="#000000">begin</font></b><font color="#990000">();</font><br />
   <b><font color="#0000FF">while</font></b> <font color="#990000">(</font>spr<font color="#990000">!=</font>sprites<font color="#990000">.</font><b><font color="#000000">end</font></b><font color="#990000">())</font> <font color="#FF0000">{</font><br />
    <font color="#990000">(*</font>spr<font color="#990000">)-&gt;</font><b><font color="#000000">draw</font></b><font color="#990000">(</font>framebuf<font color="#990000">);</font><br />
    spr<font color="#990000">++;</font><br />
   <font color="#FF0000">}</font><br />
  <font color="#FF0000">}</font><br />
  <i><font color="#9A1900">// display frame</font></i><br />
  <b><font color="#000000">vsync</font></b><font color="#990000">();</font><br />
  <b><font color="#000000">blit</font></b><font color="#990000">(</font>framebuf<font color="#990000">,</font>screen<font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">320</font><font color="#990000">,</font><font color="#993399">200</font><font color="#990000">);</font><br />
  <i><font color="#9A1900">// animate sprites</font></i><br />
  <b><font color="#000000">poll_joystick</font></b><font color="#990000">();</font><br />
  <font color="#FF0000">{</font><br />
   sprite_list<font color="#990000">::</font><font color="#008080">iterator</font> spr<font color="#990000">=</font>sprites<font color="#990000">.</font><b><font color="#000000">begin</font></b><font color="#990000">();</font><br />
   <b><font color="#0000FF">while</font></b> <font color="#990000">(</font>spr<font color="#990000">!=</font>sprites<font color="#990000">.</font><b><font color="#000000">end</font></b><font color="#990000">())</font> <font color="#FF0000">{</font><br />
    <font color="#990000">(*</font>spr<font color="#990000">)-&gt;</font><b><font color="#000000">animate</font></b><font color="#990000">();</font><br />
    spr<font color="#990000">++;</font><br />
   <font color="#FF0000">}</font><br />
  <font color="#FF0000">}</font><br />
 <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">return</font></b> <font color="#993399">0</font><font color="#990000">;</font><br />
<font color="#FF0000">}</font></tt></pre>In the course of writing any application, and games are no exception, there are often times when parts of the code has to be rethought and rewritten. That is essentially what we have done here. We have moved the RLE sprite drawing code and some coordinate manipulation code into the base class. The base class' default clippos() makes sure no object falls below ground level. Its default outside() checks if an object is totally outside the screen in the horizontal direction, since this is the direction we want the game to scroll. chopper() overrides clippos() to keep the helicopter totally on-screen. (Note that it takes care of only three of the edges, and calls upon the inherited clippos() to take care of the fourth.) chopper2 overrides the move() method to reverse the direction moved, thus avoiding having to replace the entire animate() method. We have also created the background class that overrides the default draw() method to draw the backdrop, and put an instance of this class into the sprite list, thus simplifying the game loop even further.<br />
어플리케이션을 작성하는 도중에, 물론 <span id="POPS1239_392" class="pops">게임</span>도 어플리케이션의 일종이므로 예외가 아니다, 코드 구조를 바꾸고 하는것은 자주 발생하는 일이다. 우리가 지금 한것이 바로 그것이다. 우리는 RLE 스프라이트를 그리는 코드및 관련 코드를 베이스 클래스로 옮겼다.  베이스 클래스의 clippos() 는 어떤 오브젝트도 땅(ground)아래로 떨어지지 않도록 막아준다. outside()는 함수 이름처럼, 오브젝트가 (가로)화면 밖으로 빠져나갔는지 체크해준다. 가로는 우리가 게임에서 스크롤 시킬 방향이다. 뭐, 어쨌든. 그리고 chopper()는 clippos()를 오버라이드 했는데, 상하및 좌우 <span id="POPS2447_123" class="pops">스크린</span>을 벗어나지 않도록 수정했다. (참고로, 코드에서 보면 3면만 처리하도록 해 놓고,&nbsp;마지막 4번째 면은 상속받은 clippos()를 호출해서 처리해 버렸다.) chopper2 는 move()를 오버라이드 해서 움직이는 방향을 반대로 했다. 따라서 animate() 를 통짜로 수정할 필요가 없어져 버렸다. 우리는 또한, draw()를 오버라이드 해서 backdrop(배경)을 그리는 클래스를 생성했고, 클래스 인스턴스를 스프라이트 리스트에 집어 넣었다. 이로인해 게임 루프가 훨씬 간단해졌다. <span style="color:#ff6600;">(... 잘 이해는 안되지만, 간단해 졌다고 하니 뭐;;)</span><br />
<br />
<strong>6.2 Dynamic Sprites<br />
</strong><br />
You might also have noticed that we have made the animate() method return a bool. This was done as a preparation for the dynamic sprites we are now going to create. If a sprite is created dynamically, it should also be deleted when it is no longer needed, to avoid running out of memory. To signal this, we will let the animate() method return TRUE when the sprite is no longer needed. So, let's try it by writing a class that will handle the lethal stuff we are going to throw at our poor enemies, and that signals that it should be deleted when it hits the ground.<br />
당신이라면 (당연하게도) animate 메쏘드가 bool(true/false값만 가지는 타입)을 리턴하도록 했다는것을 알아차렸을 것이다. 이것은 우리가 앞으로 만들 다이나믹 스프라이트를 위해 미리 준비한 것이다. 만약 스프라이트가 동적으로 생성된다면, 스프라이트가 불필요해지면, <span id="POPS1868_573" class="pops">메모리</span>를 낭비를 피하기위해, 삭제되어야 할것이다. 이걸 어떻게 알아차릴까? 그러기 위해서 우리는 스프라이트가 불필요해지면 animate() 메쏘드가 TRUE를 리턴하도록 할것이다. 따라서, 우리는 우리 미사일에 맞은 불쌍한 적(enemy)은 앞서 설명한 방법으로 객체를 삭제하도록 할 것이다. <br />
Since it's a good idea to have defined the velocity at which our bombs will fall from the helicopter, we will add this somewhere at the top:<br />
우리 헬리콥터에서 썰어지는 미사일의 속도를 define하는것은 꽤나 괜찮은 생각같다. 따라서 아래와 같은 코드를 소스의 상단부 어딘가에 적어놓을 것이다.<br />
<pre><tt><b><font color="#000080">#define</font></b> BOMB_LAUNCH <font color="#993399">1</font><br />
<b><font color="#000080">#define</font></b> GRAVITY <font color="#993399">0.1</font></tt></pre>Then we add the weaponry class itself. Add this before chopper::animate():<br />
그리고, 우리는 weaponry(무기류) 클래스를 추가할 것이다. 이 클래스는 chopper::animate() 앞에 추가하자. <br />
<pre><tt><b><font color="#0000FF">class</font></b> <font color="#008080">projectile</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> sprite <font color="#FF0000">{</font><br />
 <font color="#008080">fix</font> DX<font color="#990000">,</font>DY<font color="#990000">;</font><br />
 <font color="#009900">int</font> force<font color="#990000">;</font><br />
<b><font color="#0000FF">public</font></b><font color="#990000">:</font><br />
 <b><font color="#000000">projectile</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">,</font>fix _DX<font color="#990000">,</font>fix _DY<font color="#990000">,</font>RLE_SPRITE<font color="#990000">*</font>img<font color="#990000">,</font><font color="#009900">int</font> power<font color="#990000">)</font><br />
  <font color="#990000">:</font> <b><font color="#000000">sprite</font></b><font color="#990000">(</font>_X<font color="#990000">,</font>_Y<font color="#990000">,</font>img<font color="#990000">)</font> <font color="#FF0000">{</font> DX<font color="#990000">=</font>_DX<font color="#990000">;</font> DY<font color="#990000">=</font>_DY<font color="#990000">;</font> force<font color="#990000">=</font>power<font color="#990000">;</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">bool</font> <b><font color="#000000">animate</font></b><font color="#990000">()</font> <font color="#FF0000">{</font><br />
  <b><font color="#000000">move</font></b><font color="#990000">(</font>DX<font color="#990000">,</font>DY<font color="#990000">);</font> DY<font color="#990000">+=</font>GRAVITY<font color="#990000">;</font><br />
  <b><font color="#0000FF">return</font></b> Y<font color="#990000">+</font>image<font color="#990000">-&gt;</font>h<font color="#990000">&gt;=</font>MAX_Y<font color="#990000">;</font><br />
 <font color="#FF0000">}</font><br />
<font color="#FF0000">}</font><font color="#990000">;</font></tt></pre>To launch bombs whenever Enter is pressed, change chopper::animate() to:<br />
엔터가 눌렸을때 폭탄을 투하하기 위해서, chopper::animate()를 다음과 같이 수정하자.<br />
<pre><tt><font color="#009900">bool</font> chopper<font color="#990000">::</font><b><font color="#000000">animate</font></b><font color="#990000">()</font><br />
<font color="#FF0000">{</font><br />
 <font color="#008080">fix</font> DX<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">,</font>DY<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font><br />
<br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_LEFT<font color="#990000">]||</font>joy_left<font color="#990000">)</font> <font color="#990000">--</font>DX<font color="#990000">;</font><br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_RIGHT<font color="#990000">]||</font>joy_right<font color="#990000">)</font> <font color="#990000">++</font>DX<font color="#990000">;</font><br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_UP<font color="#990000">]||</font>joy_up<font color="#990000">)</font> <font color="#990000">--</font>DY<font color="#990000">;</font><br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_DOWN<font color="#990000">]||</font>joy_down<font color="#990000">)</font> <font color="#990000">++</font>DY<font color="#990000">;</font><br />
<br />
 <b><font color="#000000">move</font></b><font color="#990000">(</font>DX<font color="#990000">,</font>DY<font color="#990000">);</font><br />
<br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_ENTER<font color="#990000">]||</font>joy_b1<font color="#990000">)</font> <font color="#FF0000">{</font><br />
  sprites<font color="#990000">.</font><b><font color="#000000">push_back</font></b><font color="#990000">(</font><b><font color="#0000FF">new</font></b> <b><font color="#000000">projectile</font></b><font color="#990000">(</font>X<font color="#990000">+</font><font color="#993399">32</font><font color="#990000">,</font>Y<font color="#990000">+</font><font color="#993399">14</font><font color="#990000">,</font><br />
   BOMB_LAUNCH<font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,(</font>RLE_SPRITE<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_BOMB<font color="#990000">].</font>dat<font color="#990000">,</font><font color="#993399">5</font><font color="#990000">));</font><br />
 <font color="#FF0000">}</font><br />
<br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>frame<font color="#990000">)</font> <font color="#FF0000">{</font> image<font color="#990000">=(</font>RLE_SPRITE<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_CHOPPER1<font color="#990000">].</font>dat<font color="#990000">;</font> frame<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font> <font color="#FF0000">}</font><br />
       <b><font color="#0000FF">else</font></b> <font color="#FF0000">{</font> image<font color="#990000">=(</font>RLE_SPRITE<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_CHOPPER2<font color="#990000">].</font>dat<font color="#990000">;</font> frame<font color="#990000">=</font><font color="#993399">1</font><font color="#990000">;</font> <font color="#FF0000">}</font><br />
<br />
 <b><font color="#0000FF">return</font></b> FALSE<font color="#990000">;</font><br />
<font color="#FF0000">}</font></tt></pre>Finally, to delete the sprites that are no longer needed, we need to change the animation code in the main game loop to:<br />
마지막으로, 더이상 불필요한 스프라이드를 삭제하기 위해서, 우리는 메인 게임 루프에서 animation코드를 다음처럼 바꿀것이다.<br />
<pre><tt><i><font color="#9A1900">// animate sprites</font></i><br />
  <b><font color="#000000">poll_joystick</font></b><font color="#990000">();</font><br />
  <font color="#FF0000">{</font><br />
   sprite_list<font color="#990000">::</font><font color="#008080">iterator</font> spr<font color="#990000">=</font>sprites<font color="#990000">.</font><b><font color="#000000">begin</font></b><font color="#990000">();</font><br />
   <b><font color="#0000FF">while</font></b> <font color="#990000">(</font>spr<font color="#990000">!=</font>sprites<font color="#990000">.</font><b><font color="#000000">end</font></b><font color="#990000">())</font> <font color="#FF0000">{</font><br />
    sprite<font color="#990000">*</font>itm<font color="#990000">=*</font>spr<font color="#990000">;</font><br />
    <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>itm<font color="#990000">-&gt;</font><b><font color="#000000">animate</font></b><font color="#990000">())</font> <font color="#FF0000">{</font><br />
     sprites<font color="#990000">.</font><b><font color="#000000">erase</font></b><font color="#990000">(</font>spr<font color="#990000">++);</font><br />
     <b><font color="#0000FF">delete</font></b> itm<font color="#990000">;</font><br />
    <font color="#FF0000">}</font> <b><font color="#0000FF">else</font></b> spr<font color="#990000">++;</font><br />
   <font color="#FF0000">}</font><br />
  <font color="#FF0000">}</font></tt></pre>This will save the current sprite, then call animate(). If it returns true, it will remove the element from the list, move the iterator to the next element, and then delete the sprite itself; otherwise, it will move the iterator as before.<br />
이것은 현재 스프라이트를 저장해 놓고 animate()를 호출한 다음에, 리턴값이 true라면 리스트에서 제거해 버리고 다음 element로 넘어가는 것이다. 그리고 스프라이트는 삭제를 해 버린다. 리턴값이 false라면 이전에 했던거랑 동일하게 동작하는거고...<br />
With this, the player is now able to pour out bombs at high volume, which is definitely going to be of much value against his enemies, once he gets any.<br />
이것과 함께, 플레이어는 이제 폭탄을 떨굴수 있다. (<span style="color:#ff6600;">...<span id="POPS7065_340" class="pops">영어</span>가 짧아 번역아 안되..됩니다..T^T</span>)<br />
<br />
<strong>6.3 Moving Bomb Launch<br />
</strong><br />
A somewhat unrealistic thing about the way we have launched these bombs, is their launch velocity when the helicopter is moving, which is currently absolute, and thus exactly the same as if the helicopter stood still. In our game, we want some more realism than that (even if the extreme payload of explosives the player has at his disposal is totally unrealistic), so we will make the initial bomb velocity relative to the current helicopter velocity. This also makes it much more fun to try to launch bombs as if they were projectiles by jerking the helicopter forward and upward just as the bomb is launching.<br />
근데, 뭔가 비현실적인것이 있는데 폭탄을 떨구면 헬기의 속도에 맞춰서 곡선으로 떨어져야 한다. 근데, 우리 프로그램은 헬기가 움직이지 않더라도 폭탄은 곡선으로 떨어진다. (뭐, 물론 잔탄수가 없는것도 말이 안되는거긴 하다만..) 하여간, 그래서 우리는 <span id="POPS23841_404" class="pops">비행기</span> 속도에 맞춰서 폭탄의 초기 속도를 설정할 것이다. 이것은 게임을 좀더 재미있게 만들것이다. <span style="color:#ff6600;">(...뭐 비슷한 내용인거 같다;;)</span><br />
First, to accurately calculate how much the helicopter has moved (its current velocity), we will let the base class keep track of what the last position was, by its animate() method.<br />
우선, 헬기의 속도를 계산하기 위해서(현재 속도) 우리는 베이스 클래스의 animate() 메쏘드에서 헬기의 마지막 좌표를 계속 추적할&nbsp;것이다.<br />
<pre><tt><b><font color="#0000FF">class</font></b> <font color="#008080">sprite</font> <font color="#FF0000">{</font><br />
<b><font color="#0000FF">protected</font></b><font color="#990000">:</font><br />
 <font color="#008080">fix</font> X<font color="#990000">,</font>Y<font color="#990000">,</font>LX<font color="#990000">,</font>LY<font color="#990000">;</font><br />
 RLE_SPRITE<font color="#990000">*</font>image<font color="#990000">;</font><br />
<b><font color="#0000FF">public</font></b><font color="#990000">:</font><br />
 <b><font color="#000000">sprite</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">)</font> <font color="#FF0000">{</font> LX<font color="#990000">=</font>X<font color="#990000">=</font>_X<font color="#990000">;</font> LY<font color="#990000">=</font>Y<font color="#990000">=</font>_Y<font color="#990000">;</font> image<font color="#990000">=</font>NULL<font color="#990000">;</font> <font color="#FF0000">}</font><br />
 <b><font color="#000000">sprite</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">,</font>RLE_SPRITE<font color="#990000">*</font>img<font color="#990000">)</font> <font color="#FF0000">{</font> LX<font color="#990000">=</font>X<font color="#990000">=</font>_X<font color="#990000">;</font> LY<font color="#990000">=</font>Y<font color="#990000">=</font>_Y<font color="#990000">;</font> image<font color="#990000">=</font>img<font color="#990000">;</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#990000">~</font><b><font color="#000000">sprite</font></b><font color="#990000">()</font> <font color="#FF0000">{}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">draw</font></b><font color="#990000">(</font>BITMAP<font color="#990000">*</font>dest<font color="#990000">)</font> <font color="#FF0000">{</font><br />
  <b><font color="#000000">draw_rle_sprite</font></b><font color="#990000">(</font>dest<font color="#990000">,</font>image<font color="#990000">,</font>X<font color="#990000">,</font>Y<font color="#990000">);</font><br />
 <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">clippos</font></b><font color="#990000">()</font> <font color="#FF0000">{</font> <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>Y<font color="#990000">+</font>image<font color="#990000">-&gt;</font>h<font class="Apple-style-span" color="#990000">&gt;</font>MAX_Y<font color="#990000">)</font> Y<font color="#990000">=</font>MAX_Y<font color="#990000">-</font>image<font color="#990000">-&gt;</font>h<font color="#990000">;</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">place</font></b><font color="#990000">(</font><font color="#008080">fix</font> NX<font color="#990000">,</font><font color="#008080">fix</font> NY<font color="#990000">)</font> <font color="#FF0000">{</font> X<font color="#990000">=</font>NX<font color="#990000">;</font> Y<font color="#990000">=</font>NY<font color="#990000">;</font> <b><font color="#000000">clippos</font></b><font color="#990000">();</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">move</font></b><font color="#990000">(</font><font color="#008080">fix</font> DX<font color="#990000">,</font><font color="#008080">fix</font> DY<font color="#990000">)</font> <font color="#FF0000">{</font> X<font color="#990000">+=</font>DX<font color="#990000">;</font> Y<font color="#990000">+=</font>DY<font color="#990000">;</font> <b><font color="#000000">clippos</font></b><font color="#990000">();</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">int</font> <b><font color="#000000">outside</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">)</font> <font color="#FF0000">{</font> <b><font color="#0000FF">return</font></b> <font color="#990000">(</font>_X&lt;<font color="#990000">-</font>image<font color="#990000">-&gt;</font>w<font color="#990000">)||(</font>_X&gt;<font color="#990000">=</font>SCREEN_W<font color="#990000">);</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">bool</font> <b><font color="#000000">animate</font></b><font color="#990000">()</font> <font color="#FF0000">{</font> LX<font color="#990000">=</font>X<font color="#990000">;</font> LY<font color="#990000">=</font>Y<font color="#990000">;</font> <b><font color="#0000FF">return</font></b> FALSE<font color="#990000">;</font> <font color="#FF0000">}</font><br />
<font color="#FF0000">}</font><font color="#990000">;</font></tt></pre>Of course, for this to work, the animate() method for the derived classes has to call this. The chopper class' animate() method, after adding the difference between the current and previous coordinates as the velocity to add to the bomb launch velocity, and doubling the speed of the helicopter itself, is now:<br />
물론, 실제 동작하기 위해서는 상속받은 클래스에서 animate()를 호출해야 한다. chopper클래스의 animate() 메쏘드의 경우, 헬기의 속도를 폭탄의 속도에 더해줘서 헬기속도의 두배가 되도록 한다. <span style="color:#ff6600;">(아.. 이것도 발번역.. T^T)</span><br />
<!-- Generator: GNU source-highlight 3.1<br />
by Lorenzo Bettini<br />
http://www.lorenzobettini.it<br />
http://www.gnu.org/software/src-highlite --><br />
<pre><tt><font color="#009900">bool</font> chopper<font color="#990000">::</font><b><font color="#000000">animate</font></b><font color="#990000">()</font><br />
<font color="#FF0000">{</font><br />
 sprite<font color="#990000">::</font><b><font color="#000000">animate</font></b><font color="#990000">();</font><br />
<br />
 <font color="#008080">fix</font> DX<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">,</font>DY<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font><br />
<br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_LEFT<font color="#990000">]||</font>joy_left<font color="#990000">)</font> DX<font color="#990000">-=</font><font color="#993399">2</font><font color="#990000">;</font><br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_RIGHT<font color="#990000">]||</font>joy_right<font color="#990000">)</font> DX<font color="#990000">+=</font><font color="#993399">2</font><font color="#990000">;</font><br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_UP<font color="#990000">]||</font>joy_up<font color="#990000">)</font> DY<font color="#990000">-=</font><font color="#993399">2</font><font color="#990000">;</font><br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_DOWN<font color="#990000">]||</font>joy_down<font color="#990000">)</font> DY<font color="#990000">+=</font><font color="#993399">2</font><font color="#990000">;</font><br />
<br />
 <b><font color="#000000">move</font></b><font color="#990000">(</font>DX<font color="#990000">,</font>DY<font color="#990000">);</font><br />
<br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_ENTER<font color="#990000">]||</font>joy_b1<font color="#990000">||(</font>mouse_b<font color="#990000">&amp;</font><font color="#993399">1</font><font color="#990000">))</font> <font color="#FF0000">{</font><br />
  sprites<font color="#990000">.</font><b><font color="#000000">push_back</font></b><font color="#990000">(</font><b><font color="#0000FF">new</font></b> <b><font color="#000000">projectile</font></b><font color="#990000">(</font>X<font color="#990000">+</font><font color="#993399">32</font><font color="#990000">,</font>Y<font color="#990000">+</font><font color="#993399">14</font><font color="#990000">,</font><br />
   X<font color="#990000">-</font>LX<font color="#990000">+</font>BOMB_LAUNCH<font color="#990000">,</font>Y<font color="#990000">-</font>LY<font color="#990000">,(</font>RLE_SPRITE<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_BOMB<font color="#990000">].</font>dat<font color="#990000">,</font><font color="#993399">5</font><font color="#990000">));</font><br />
 <font color="#FF0000">}</font><br />
<br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>frame<font color="#990000">)</font> <font color="#FF0000">{</font> image<font color="#990000">=(</font>RLE_SPRITE<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_CHOPPER1<font color="#990000">].</font>dat<font color="#990000">;</font> frame<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font> <font color="#FF0000">}</font><br />
       <b><font color="#0000FF">else</font></b> <font color="#FF0000">{</font> image<font color="#990000">=(</font>RLE_SPRITE<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_CHOPPER2<font color="#990000">].</font>dat<font color="#990000">;</font> frame<font color="#990000">=</font><font color="#993399">1</font><font color="#990000">;</font> <font color="#FF0000">}</font><br />
<br />
 <b><font color="#0000FF">return</font></b> FALSE<font color="#990000">;</font><br />
<font color="#FF0000">}</font></tt></pre><br />
<strong>6.4 Mouse Control<br />
</strong><br />
Another thing that I personally find makes the program much more fun to mess with, is to control the helicopter with the mouse. This enables it to move around the screen and launch bombs with ludicrous velocities, but still, why not have all the fun we can get? Unfortunately, this means we will have to dispense with the second helicopter. The full code is now:<br />
개인적으로 프로그램을 재미있게 할 방법으로 헬기를 마우스로 컨트롤 해보면 어떨까 하고 생각해 봤다. 이렇게 하면 헬기를 움직일수 있고 폭탄에 황당하리만한 속도를 줄수도 있다.<span style="color:#ff6600;">(!!)</span> 그렇다면, 왜 지금까지 안했을까? 불행하게도, 이것은 우리가 두번째 헬기를 만들수 없다는 것이다. <span style="color:#ff6600;">(대충 '2인용 게임을 만들수 없다`. 로 해석되는데.. 흠;;)</span>&nbsp;<div><b><font class="Apple-style-span" color="#FF0000">(...진짜 발번역... 이거 제대로 번역좀 해주세요 T^T)</font></b><br />
<!-- Generator: GNU source-highlight 3.1<br />
by Lorenzo Bettini<br />
http://www.lorenzobettini.it<br />
http://www.gnu.org/software/src-highlite --><br />
<pre><tt><b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;allegro.h&gt;</font><br />
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;stl.h&gt;</font><br />
<b><font color="#000080">#include</font></b> <font color="#FF0000">"tutorial.h"</font><br />
<br />
<b><font color="#000080">#define</font></b> MIN_Y <font color="#993399">8</font><br />
<b><font color="#000080">#define</font></b> MAX_Y <font color="#993399">180</font><br />
<b><font color="#000080">#define</font></b> BOMB_LAUNCH <font color="#993399">1</font><br />
<b><font color="#000080">#define</font></b> GRAVITY <font color="#993399">0.1</font><br />
<br />
DATAFILE<font color="#990000">*</font>data<font color="#990000">;</font><br />
BITMAP<font color="#990000">*</font>backdrop<font color="#990000">,*</font>framebuf<font color="#990000">;</font><br />
<font color="#009900">bool</font> usemouse<font color="#990000">=</font>FALSE<font color="#990000">;</font><br />
<br />
<b><font color="#0000FF">class</font></b> <font color="#008080">sprite</font> <font color="#FF0000">{</font><br />
<b><font color="#0000FF">protected</font></b><font color="#990000">:</font><br />
 <font color="#008080">fix</font> X<font color="#990000">,</font>Y<font color="#990000">,</font>LX<font color="#990000">,</font>LY<font color="#990000">;</font><br />
 RLE_SPRITE<font color="#990000">*</font>image<font color="#990000">;</font><br />
<b><font color="#0000FF">public</font></b><font color="#990000">:</font><br />
 <b><font color="#000000">sprite</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">)</font> <font color="#FF0000">{</font> LX<font color="#990000">=</font>X<font color="#990000">=</font>_X<font color="#990000">;</font> LY<font color="#990000">=</font>Y<font color="#990000">=</font>_Y<font color="#990000">;</font> image<font color="#990000">=</font>NULL<font color="#990000">;</font> <font color="#FF0000">}</font><br />
 <b><font color="#000000">sprite</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">,</font>RLE_SPRITE<font color="#990000">*</font>img<font color="#990000">)</font> <font color="#FF0000">{</font> LX<font color="#990000">=</font>X<font color="#990000">=</font>_X<font color="#990000">;</font> LY<font color="#990000">=</font>Y<font color="#990000">=</font>_Y<font color="#990000">;</font> image<font color="#990000">=</font>img<font color="#990000">;</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#990000">~</font><b><font color="#000000">sprite</font></b><font color="#990000">()</font> <font color="#FF0000">{}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">draw</font></b><font color="#990000">(</font>BITMAP<font color="#990000">*</font>dest<font color="#990000">)</font> <font color="#FF0000">{</font><br />
  <b><font color="#000000">draw_rle_sprite</font></b><font color="#990000">(</font>dest<font color="#990000">,</font>image<font color="#990000">,</font>X<font color="#990000">,</font>Y<font color="#990000">);</font><br />
 <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">clippos</font></b><font color="#990000">()</font> <font color="#FF0000">{</font> <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>Y<font color="#990000">+</font>image<font color="#990000">-&gt;</font>h<font color="#990000">&gt;</font>MAX_Y<font color="#990000">)</font> Y<font color="#990000">=</font>MAX_Y<font color="#990000">-</font>image<font color="#990000">-&gt;</font>h<font color="#990000">;</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">place</font></b><font color="#990000">(</font><font color="#008080">fix</font> NX<font color="#990000">,</font><font color="#008080">fix</font> NY<font color="#990000">)</font> <font color="#FF0000">{</font> X<font color="#990000">=</font>NX<font color="#990000">;</font> Y<font color="#990000">=</font>NY<font color="#990000">;</font> <b><font color="#000000">clippos</font></b><font color="#990000">();</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">move</font></b><font color="#990000">(</font><font color="#008080">fix</font> DX<font color="#990000">,</font><font color="#008080">fix</font> DY<font color="#990000">)</font> <font color="#FF0000">{</font> X<font color="#990000">+=</font>DX<font color="#990000">;</font> Y<font color="#990000">+=</font>DY<font color="#990000">;</font> <b><font color="#000000">clippos</font></b><font color="#990000">();</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">int</font> <b><font color="#000000">outside</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">)</font> <font color="#FF0000">{</font> <b><font color="#0000FF">return</font></b> <font color="#990000">(</font>_X<font color="#990000">&lt;-</font>image<font color="#990000">-&gt;</font>w<font color="#990000">)||(</font>_X<font color="#990000">&gt;=</font>SCREEN_W<font color="#990000">);</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">bool</font> <b><font color="#000000">animate</font></b><font color="#990000">()</font> <font color="#FF0000">{</font> LX<font color="#990000">=</font>X<font color="#990000">;</font> LY<font color="#990000">=</font>Y<font color="#990000">;</font> <b><font color="#0000FF">return</font></b> FALSE<font color="#990000">;</font> <font color="#FF0000">}</font><br />
<font color="#FF0000">}</font><font color="#990000">;</font><br />
<br />
<b><font color="#0000FF">typedef</font></b> <font color="#008080">list&lt;sprite*&gt;</font> sprite_list<font color="#990000">;</font><br />
<br />
<font color="#008080">sprite_list</font> sprites<font color="#990000">;</font><br />
<br />
<b><font color="#0000FF">class</font></b> <font color="#008080">background</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> sprite <font color="#FF0000">{</font><br />
<b><font color="#0000FF">public</font></b><font color="#990000">:</font><br />
 <b><font color="#000000">background</font></b><font color="#990000">()</font> <font color="#990000">:</font> <b><font color="#000000">sprite</font></b><font color="#990000">(</font><font color="#993399">0</font><font color="#990000">,</font>MIN_Y<font color="#990000">)</font> <font color="#FF0000">{}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">draw</font></b><font color="#990000">(</font>BITMAP<font color="#990000">*</font>dest<font color="#990000">)</font> <font color="#FF0000">{</font><br />
  <b><font color="#000000">blit</font></b><font color="#990000">(</font>backdrop<font color="#990000">,</font>dest<font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font>X<font color="#990000">,</font>Y<font color="#990000">,</font>backdrop<font color="#990000">-&gt;</font>w<font color="#990000">,</font>backdrop<font color="#990000">-&gt;</font>h<font color="#990000">);</font><br />
 <font color="#FF0000">}</font><br />
<font color="#FF0000">}</font><font color="#990000">;</font><br />
<br />
<b><font color="#0000FF">class</font></b> <font color="#008080">chopper</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> sprite <font color="#FF0000">{</font><br />
<b><font color="#0000FF">protected</font></b><font color="#990000">:</font><br />
 <font color="#009900">int</font> frame<font color="#990000">;</font><br />
<b><font color="#0000FF">public</font></b><font color="#990000">:</font><br />
 <b><font color="#000000">chopper</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">)</font><br />
  <font color="#990000">:</font> <b><font color="#000000">sprite</font></b><font color="#990000">(</font>_X<font color="#990000">,</font>_Y<font color="#990000">,(</font>RLE_SPRITE<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_CHOPPER<font color="#990000">].</font>dat<font color="#990000">)</font> <font color="#FF0000">{</font><br />
  frame<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font><br />
  <b><font color="#000000">position_mouse</font></b><font color="#990000">(</font>X<font color="#990000">,</font>Y<font color="#990000">);</font><br />
 <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">void</font> <b><font color="#000000">clippos</font></b><font color="#990000">()</font> <font color="#FF0000">{</font><br />
  <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>X<font color="#990000">&lt;</font><font color="#993399">0</font><font color="#990000">)</font> X<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font><br />
  <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>X<font color="#990000">+</font>image<font color="#990000">-&gt;</font>w<font color="#990000">&gt;</font>SCREEN_W<font color="#990000">)</font> X<font color="#990000">=</font>SCREEN_W<font color="#990000">-</font>image<font color="#990000">-&gt;</font>w<font color="#990000">;</font><br />
  <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>Y<font color="#990000">&lt;</font>MIN_Y<font color="#990000">)</font> Y<font color="#990000">=</font>MIN_Y<font color="#990000">;</font><br />
  sprite<font color="#990000">::</font><b><font color="#000000">clippos</font></b><font color="#990000">();</font><br />
 <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">bool</font> <b><font color="#000000">animate</font></b><font color="#990000">();</font><br />
<font color="#FF0000">}</font><font color="#990000">;</font><br />
<br />
<b><font color="#0000FF">class</font></b> <font color="#008080">projectile</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> sprite <font color="#FF0000">{</font><br />
 <font color="#008080">fix</font> DX<font color="#990000">,</font>DY<font color="#990000">;</font><br />
 <font color="#009900">int</font> force<font color="#990000">;</font><br />
<b><font color="#0000FF">public</font></b><font color="#990000">:</font><br />
 <b><font color="#000000">projectile</font></b><font color="#990000">(</font>fix _X<font color="#990000">,</font>fix _Y<font color="#990000">,</font>fix _DX<font color="#990000">,</font>fix _DY<font color="#990000">,</font>RLE_SPRITE<font color="#990000">*</font>img<font color="#990000">,</font><font color="#009900">int</font> power<font color="#990000">)</font><br />
  <font color="#990000">:</font> <b><font color="#000000">sprite</font></b><font color="#990000">(</font>_X<font color="#990000">,</font>_Y<font color="#990000">,</font>img<font color="#990000">)</font> <font color="#FF0000">{</font> DX<font color="#990000">=</font>_DX<font color="#990000">;</font> DY<font color="#990000">=</font>_DY<font color="#990000">;</font> force<font color="#990000">=</font>power<font color="#990000">;</font> <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">virtual</font></b> <font color="#009900">bool</font> <b><font color="#000000">animate</font></b><font color="#990000">()</font> <font color="#FF0000">{</font><br />
  <b><font color="#000000">move</font></b><font color="#990000">(</font>DX<font color="#990000">,</font>DY<font color="#990000">);</font> DY<font color="#990000">+=</font>GRAVITY<font color="#990000">;</font><br />
  <b><font color="#0000FF">return</font></b> Y<font color="#990000">+</font>image<font color="#990000">-&gt;</font>h<font color="#990000">&gt;=</font>MAX_Y<font color="#990000">;</font><br />
 <font color="#FF0000">}</font><br />
<font color="#FF0000">}</font><font color="#990000">;</font><br />
<br />
<font color="#009900">bool</font> chopper<font color="#990000">::</font><b><font color="#000000">animate</font></b><font color="#990000">()</font><br />
<font color="#FF0000">{</font><br />
 sprite<font color="#990000">::</font><b><font color="#000000">animate</font></b><font color="#990000">();</font><br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>usemouse<font color="#990000">)</font> <b><font color="#000000">place</font></b><font color="#990000">(</font>mouse_x<font color="#990000">,</font>mouse_y<font color="#990000">);</font><br />
<br />
 <font color="#008080">fix</font> DX<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">,</font>DY<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font><br />
<br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_LEFT<font color="#990000">]||</font>joy_left<font color="#990000">)</font> DX<font color="#990000">-=</font><font color="#993399">2</font><font color="#990000">;</font><br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_RIGHT<font color="#990000">]||</font>joy_right<font color="#990000">)</font> DX<font color="#990000">+=</font><font color="#993399">2</font><font color="#990000">;</font><br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_UP<font color="#990000">]||</font>joy_up<font color="#990000">)</font> DY<font color="#990000">-=</font><font color="#993399">2</font><font color="#990000">;</font><br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_DOWN<font color="#990000">]||</font>joy_down<font color="#990000">)</font> DY<font color="#990000">+=</font><font color="#993399">2</font><font color="#990000">;</font><br />
<br />
 <b><font color="#000000">move</font></b><font color="#990000">(</font>DX<font color="#990000">,</font>DY<font color="#990000">);</font><br />
<br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>usemouse<font color="#990000">)</font> <b><font color="#000000">position_mouse</font></b><font color="#990000">(</font>X<font color="#990000">,</font>Y<font color="#990000">);</font><br />
<br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>key<font color="#990000">[</font>KEY_ENTER<font color="#990000">]||</font>joy_b1<font color="#990000">||(</font>mouse_b<font color="#990000">&amp;</font><font color="#993399">1</font><font color="#990000">))</font> <font color="#FF0000">{</font><br />
  sprites<font color="#990000">.</font><b><font color="#000000">push_back</font></b><font color="#990000">(</font><b><font color="#0000FF">new</font></b> <b><font color="#000000">projectile</font></b><font color="#990000">(</font>X<font color="#990000">+</font><font color="#993399">32</font><font color="#990000">,</font>Y<font color="#990000">+</font><font color="#993399">14</font><font color="#990000">,</font><br />
   X<font color="#990000">-</font>LX<font color="#990000">+</font>BOMB_LAUNCH<font color="#990000">,</font>Y<font color="#990000">-</font>LY<font color="#990000">,(</font>RLE_SPRITE<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_BOMB<font color="#990000">].</font>dat<font color="#990000">,</font><font color="#993399">5</font><font color="#990000">));</font><br />
 <font color="#FF0000">}</font><br />
<br />
 <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>frame<font color="#990000">)</font> <font color="#FF0000">{</font> image<font color="#990000">=(</font>RLE_SPRITE<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_CHOPPER1<font color="#990000">].</font>dat<font color="#990000">;</font> frame<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font> <font color="#FF0000">}</font><br />
       <b><font color="#0000FF">else</font></b> <font color="#FF0000">{</font> image<font color="#990000">=(</font>RLE_SPRITE<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_CHOPPER2<font color="#990000">].</font>dat<font color="#990000">;</font> frame<font color="#990000">=</font><font color="#993399">1</font><font color="#990000">;</font> <font color="#FF0000">}</font><br />
<br />
 <b><font color="#0000FF">return</font></b> FALSE<font color="#990000">;</font><br />
<font color="#FF0000">}</font><br />
<br />
<font color="#009900">int</font> <b><font color="#000000">main</font></b><font color="#990000">()</font><br />
<font color="#FF0000">{</font><br />
 <b><font color="#000000">allegro_init</font></b><font color="#990000">();</font><br />
 <b><font color="#000000">install_keyboard</font></b><font color="#990000">();</font><br />
 <i><font color="#9A1900">// comment out the next line if you don't want mouse</font></i><br />
 usemouse<font color="#990000">=(</font><b><font color="#000000">install_mouse</font></b><font color="#990000">()!=-</font><font color="#993399">1</font><font color="#990000">);</font><br />
 <b><font color="#000000">initialise_joystick</font></b><font color="#990000">();</font><br />
<br />
 data<font color="#990000">=</font><b><font color="#000000">load_datafile</font></b><font color="#990000">(</font><font color="#FF0000">"tutorial.dat"</font><font color="#990000">);</font><br />
<br />
 <b><font color="#000000">set_gfx_mode</font></b><font color="#990000">(</font>GFX_VGA<font color="#990000">,</font><font color="#993399">320</font><font color="#990000">,</font><font color="#993399">200</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">);</font><br />
<br />
 <b><font color="#000000">set_palette</font></b><font color="#990000">((</font>RGB<font color="#990000">*)</font>data<font color="#990000">[</font>TUT_GAMEPAL<font color="#990000">].</font>dat<font color="#990000">);</font><br />
<br />
 <i><font color="#9A1900">// create 320x192 backdrop</font></i><br />
 backdrop<font color="#990000">=</font><b><font color="#000000">create_bitmap</font></b><font color="#990000">(</font><font color="#993399">320</font><font color="#990000">,</font><font color="#993399">192</font><font color="#990000">);</font><br />
 <b><font color="#0000FF">for</font></b> <font color="#990000">(</font><font color="#009900">int</font> Y<font color="#990000">=</font><font color="#993399">0</font><font color="#990000">;</font> Y<font color="#990000">&lt;</font><font color="#993399">128</font><font color="#990000">;</font> Y<font color="#990000">++)</font> <b><font color="#000000">hline</font></b><font color="#990000">(</font>backdrop<font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font>Y<font color="#990000">,</font><font color="#993399">319</font><font color="#990000">,</font> <font color="#990000">(</font>Y<font color="#990000">/</font><font color="#993399">2</font><font color="#990000">)+</font><font color="#993399">128</font><font color="#990000">);</font><br />
 <b><font color="#0000FF">for</font></b> <font color="#990000">(</font><font color="#009900">int</font> Y<font color="#990000">=</font><font color="#993399">128</font><font color="#990000">;</font> Y<font color="#990000">&lt;</font><font color="#993399">192</font><font color="#990000">;</font> Y<font color="#990000">++)</font> <b><font color="#000000">hline</font></b><font color="#990000">(</font>backdrop<font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font>Y<font color="#990000">,</font><font color="#993399">319</font><font color="#990000">,</font> <font color="#990000">((</font>Y<font color="#990000">-</font><font color="#993399">128</font><font color="#990000">)/</font><font color="#993399">2</font><font color="#990000">)+</font><font color="#993399">192</font><font color="#990000">);</font><br />
<br />
 <i><font color="#9A1900">// create 320x200 double buffer</font></i><br />
 framebuf<font color="#990000">=</font><b><font color="#000000">create_bitmap</font></b><font color="#990000">(</font><font color="#993399">320</font><font color="#990000">,</font><font color="#993399">200</font><font color="#990000">);</font><br />
 <b><font color="#000000">clear</font></b><font color="#990000">(</font>framebuf<font color="#990000">);</font><br />
<br />
 <font color="#008080">background</font> Back<font color="#990000">;</font><br />
 <font color="#008080">chopper</font> <b><font color="#000000">Hero</font></b><font color="#990000">(</font><font color="#993399">50</font><font color="#990000">,</font><font color="#993399">100</font><font color="#990000">);</font><br />
 sprites<font color="#990000">.</font><b><font color="#000000">push_back</font></b><font color="#990000">(&amp;</font>Back<font color="#990000">);</font><br />
 sprites<font color="#990000">.</font><b><font color="#000000">push_back</font></b><font color="#990000">(&amp;</font>Hero<font color="#990000">);</font><br />
<br />
 <b><font color="#0000FF">while</font></b> <font color="#990000">(!</font>key<font color="#990000">[</font>KEY_ESC<font color="#990000">])</font> <font color="#FF0000">{</font><br />
  <i><font color="#9A1900">// draw sprites</font></i><br />
  <font color="#FF0000">{</font><br />
   sprite_list<font color="#990000">::</font><font color="#008080">const_iterator</font> spr<font color="#990000">=</font>sprites<font color="#990000">.</font><b><font color="#000000">begin</font></b><font color="#990000">();</font><br />
   <b><font color="#0000FF">while</font></b> <font color="#990000">(</font>spr<font color="#990000">!=</font>sprites<font color="#990000">.</font><b><font color="#000000">end</font></b><font color="#990000">())</font> <font color="#FF0000">{</font><br />
    <font color="#990000">(*</font>spr<font color="#990000">)-&gt;</font><b><font color="#000000">draw</font></b><font color="#990000">(</font>framebuf<font color="#990000">);</font><br />
    spr<font color="#990000">++;</font><br />
   <font color="#FF0000">}</font><br />
  <font color="#FF0000">}</font><br />
  <i><font color="#9A1900">// display frame</font></i><br />
  <b><font color="#000000">vsync</font></b><font color="#990000">();</font><br />
  <b><font color="#000000">blit</font></b><font color="#990000">(</font>framebuf<font color="#990000">,</font>screen<font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">0</font><font color="#990000">,</font><font color="#993399">320</font><font color="#990000">,</font><font color="#993399">200</font><font color="#990000">);</font><br />
  <i><font color="#9A1900">// animate sprites</font></i><br />
  <b><font color="#000000">poll_joystick</font></b><font color="#990000">();</font><br />
  <font color="#FF0000">{</font><br />
   sprite_list<font color="#990000">::</font><font color="#008080">iterator</font> spr<font color="#990000">=</font>sprites<font color="#990000">.</font><b><font color="#000000">begin</font></b><font color="#990000">();</font><br />
   <b><font color="#0000FF">while</font></b> <font color="#990000">(</font>spr<font color="#990000">!=</font>sprites<font color="#990000">.</font><b><font color="#000000">end</font></b><font color="#990000">())</font> <font color="#FF0000">{</font><br />
    sprite<font color="#990000">*</font>itm<font color="#990000">=*</font>spr<font color="#990000">;</font><br />
    <b><font color="#0000FF">if</font></b> <font color="#990000">(</font>itm<font color="#990000">-&gt;</font><b><font color="#000000">animate</font></b><font color="#990000">())</font> <font color="#FF0000">{</font><br />
     sprites<font color="#990000">.</font><b><font color="#000000">erase</font></b><font color="#990000">(</font>spr<font color="#990000">++);</font><br />
     <b><font color="#0000FF">delete</font></b> itm<font color="#990000">;</font><br />
    <font color="#FF0000">}</font> <b><font color="#0000FF">else</font></b> spr<font color="#990000">++;</font><br />
   <font color="#FF0000">}</font><br />
  <font color="#FF0000">}</font><br />
 <font color="#FF0000">}</font><br />
 <b><font color="#0000FF">return</font></b> <font color="#993399">0</font><font color="#990000">;</font><br />
<font color="#FF0000">}</font></tt></pre>It is reasonably clear what we've done; install_mouse() returns -1 if a mouse is not installed; mouse_x and mouse_y contains the current mouse coordinates; position_mouse sets new coordinates (in case the keyboard or joystick was used to move the helicopter). You can now hold down the mouse button and move the mouse around to discover how the law of physics relate to gameplay (and jerky mouse motion).<br />
우리가 한것은 명확하다. install_mouse()는 PC에 마우스가 달려있지 않다면 -1을 리턴한다. mouse_x와 mouse_y는 현재 마우스의 좌표를 가지고 있다. position_mouse는 새로운 마우스 좌표를 설정한다. (keyboard나 joystick는 헬기를 움직이는데 사용된다.) 당신은 마우스 버튼을 누른채 움직이면 게임플레이에 영향을 주는 물리력을 확인할 수 있을것이다. <br />
For more exciting gameplay, proceed to the next chapter<br />
좀더 흥분되는<span style="color:#ff6600;">(..될리가..)</span> 게임플레이를 만들고 싶다면 다음 챕터를 보자.<br />
<br />
ref:<a href="http://www.ping.uio.no/~ovehk/allegro/tut6.html">http://www.ping.uio.no/~ovehk/allegro/tut6.html</a><br />
<br />
<span class="Apple-style-span" style="text-decoration: line-through;">자, 이제부터 번역 시~작!<br />
PS. 우왕~ 회사에서 내 인터넷 끊어버렸다. (네이버, 이글루, 레임, 루리웹 다 끊겼음. ㅋㅋ; 나, 언제 번역하냐;;)</span></div><br />
<a href="http://garden.egloos.com/10000396">이글루스 가든 - 하루에 한 장~ 꾸준히 번역하기</a><br/><br/>tag : <a href="/tag/allegro" rel="tag">allegro</a>,&nbsp;<a href="/tag/sprite" rel="tag">sprite</a>,&nbsp;<a href="/tag/tutorial" rel="tag">tutorial</a>,&nbsp;<a href="/tag/library" rel="tag">library</a>,&nbsp;<a href="/tag/game" rel="tag">game</a>,&nbsp;<a href="/tag/source" rel="tag">source</a>,&nbsp;<a href="/tag/알레그로" rel="tag">알레그로</a>,&nbsp;<a href="/tag/튜토리얼" rel="tag">튜토리얼</a>,&nbsp;<a href="/tag/라이브러리" rel="tag">라이브러리</a>,&nbsp;<a href="/tag/게임" rel="tag">게임</a>,&nbsp;<a href="/tag/소스" rel="tag">소스</a>,&nbsp;<a href="/tag/코드" rel="tag">코드</a>,&nbsp;<a href="/tag/code" rel="tag">code</a>			 ]]> 
		</description>
		<category>Study+more</category>
		<category>allegro</category>
		<category>sprite</category>
		<category>tutorial</category>
		<category>library</category>
		<category>game</category>
		<category>source</category>
		<category>알레그로</category>
		<category>튜토리얼</category>
		<category>라이브러리</category>
		<category>게임</category>
		<category>소스</category>
		<category>코드</category>
		<category>code</category>

		<comments>http://handmade.egloos.com/5075983#comments</comments>
		<pubDate>Fri, 02 Oct 2009 09:42:00 GMT</pubDate>
		<dc:creator>승네군</dc:creator>
	</item>
	<item>
		<title><![CDATA[ Regular Expression CaseStudy.1 ]]> </title>
		<link>http://handmade.egloos.com/5082781</link>
		<guid>http://handmade.egloos.com/5082781</guid>
		<description>
			<![CDATA[ 
  <blockquote>LXR linux-bk/drivers/usb/class/cdc-acm.c             Search Prefs<br />
   1/*<br />
   2 * cdc-acm.c<br />
   3 *<br />
   4 * Copyright (c) 1999 Armin Fuerst      <fuerst@in.tum.de><br />
   5 * Copyright (c) 1999 Pavel Machek      <pavel@suse.cz><br />
   6 * Copyright (c) 1999 Johannes Erdfelt  <johannes@erdfelt.com><br />
   7 * Copyright (c) 2000 Vojtech Pavlik    <vojtech@suse.cz><br />
   8 * Copyright (c) 2004 Oliver Neukum     <oliver@neukum.name><br />
   9 *<br />
  10 * USB Abstract Control Model driver for USB modems and ISDN adapters</oliver@neukum.name></vojtech@suse.cz></johannes@erdfelt.com></pavel@suse.cz></fuerst@in.tum.de></blockquote><br />
<br />
위 구문에서 앞에 라인 번호만 제거하고 싶을때는 다음과 같은 정규 표현식으로 가능하다.<br />
<blockquote>^[\ ?\d?][\ ?\d?][\ ?\d?]\d</blockquote><br />
맨 앞부터 시작(^), 공백이나 (\ ?) 숫자(\d?)가 존재<strong>하거나</strong> 하는 숫자가 3개([][][])가 있고, 마지막 숫자 하나(\d)는 무조건 존재해야 한다. <br />
<br />
<div><br />
ex) 스페이스는 투명하여 파악하기 힘든 관계로 _(밑줄)로 대체한다.<br />
<div>___1</div><div>1001</div></div><br/><br/>tag : <a href="/tag/정규표현식" rel="tag">정규표현식</a>,&nbsp;<a href="/tag/예제" rel="tag">예제</a>,&nbsp;<a href="/tag/케이스스터디" rel="tag">케이스스터디</a>,&nbsp;<a href="/tag/RegularExpression" rel="tag">RegularExpression</a>,&nbsp;<a href="/tag/regular-expression" rel="tag">regular-expression</a>			 ]]> 
		</description>
		<category>Study+more</category>
		<category>정규표현식</category>
		<category>예제</category>
		<category>케이스스터디</category>
		<category>RegularExpression</category>
		<category>regular-expression</category>

		<comments>http://handmade.egloos.com/5082781#comments</comments>
		<pubDate>Mon, 28 Sep 2009 13:22:37 GMT</pubDate>
		<dc:creator>승네군</dc:creator>
	</item>
	<item>
		<title><![CDATA[ 소스에 색을 입힐수가 있게 되었어영! ]]> </title>
		<link>http://handmade.egloos.com/5081141</link>
		<guid>http://handmade.egloos.com/5081141</guid>
		<description>
			<![CDATA[ 
  <a title="" href="http://handmade.egloos.com/5075698" target="_blank">소스에 색을 입히고 싶어여 엉엉~ T^T</a>  라고 징징거린지 어언 일주일.<br />
이번 주말을 맞아서, 계획대로 프로젝트(...라고 하기엔 장난질이잖;;)를 진행했다.<br />
<br />
스샷은 다음과 같구용. 리눅스에서만 돌꺼예영. <br />
<div style="text-align:center"><img class="image_mid" border="0" onmouseover="this.style.cursor='pointer'" alt="" src="http://pds16.egloos.com/pds/200909/27/72/c0024072_4abe37a5941a2.png" width="500" height="616.141732283" onclick="Control.Modal.openDialog(this, event, 'http://pds16.egloos.com/pds/200909/27/72/c0024072_4abe37a5941a2.png');" /></div>(뭐, 어쩌면 윈도에서 GTK 라이브러리 깔고 빌드하면 될듯 말듯 하지만;;)<br />
<br />
볼꺼리는 없지만, 코드도 올려는 놓을께영. 인터넷질 하면서 howto를 습득한 거라서.. 야메예염..ㅎㅎ;<br />
<a href="http://pds17.egloos.com/pds/200909/27/72/project_c-code2html.zip">project_c-code2html.zip</a><div><br />
</div><div>개발환경 -&gt;</div><div>OS: 리눅스, 정확히는 아크(아치..?) 리눅스</div><div>개발툴:&nbsp;Anjuta 2.26.2.2</div><div>언어: 쌩짜 C</div><div>라이브러리: GTK 2.6 인거 같은데, 정확하지는 않슴;;</div><div>이건 꼭 알아야해!: syntax-highlight 라는 툴을 내부적으로 사용하고 있음.&nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(시스템에 깔려 있어야 한다능.. 소스 까면 다 나온다능;;)</div><br />
<br />
PS. 아, 사람들 참.. 링크가 잘못되어 있다면 잘못되어 있다고 좀 알려주지..ㅎㅎ;<br/><br/>tag : <a href="/tag/리눅스" rel="tag">리눅스</a>,&nbsp;<a href="/tag/GTK" rel="tag">GTK</a>,&nbsp;<a href="/tag/syntax" rel="tag">syntax</a>,&nbsp;<a href="/tag/syntax-highlight" rel="tag">syntax-highlight</a>,&nbsp;<a href="/tag/소스강조" rel="tag">소스강조</a>,&nbsp;<a href="/tag/프로젝트" rel="tag">프로젝트</a>,&nbsp;<a href="/tag/소스" rel="tag">소스</a>,&nbsp;<a href="/tag/source" rel="tag">source</a>,&nbsp;<a href="/tag/code" rel="tag">code</a>,&nbsp;<a href="/tag/project" rel="tag">project</a>,&nbsp;<a href="/tag/linux" rel="tag">linux</a>			 ]]> 
		</description>
		<category>Linux+more</category>
		<category>리눅스</category>
		<category>GTK</category>
		<category>syntax</category>
		<category>syntax-highlight</category>
		<category>소스강조</category>
		<category>프로젝트</category>
		<category>소스</category>
		<category>source</category>
		<category>code</category>
		<category>project</category>
		<category>linux</category>

		<comments>http://handmade.egloos.com/5081141#comments</comments>
		<pubDate>Sat, 26 Sep 2009 15:53:15 GMT</pubDate>
		<dc:creator>승네군</dc:creator>
	</item>
</channel>
</rss>
