<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Snake 101</title>
		<link>http://gamedesign.wikidot.com/forum/t-17598/snake-101</link>
		<description>Posts in the discussion thread &quot;Snake 101&quot; - A primitive snake-game.</description>
				<copyright></copyright>
		<lastBuildDate>Mon, 17 Aug 2026 23:50:53 +0000</lastBuildDate>
		
					<item>
				<guid>http://gamedesign.wikidot.com/forum/t-17598#post-43958</guid>
				<title>Re: Snake 101</title>
				<link>http://gamedesign.wikidot.com/forum/t-17598/snake-101#post-43958</link>
				<description></description>
				<pubDate>Tue, 28 Aug 2007 13:36:32 +0000</pubDate>
				<wikidot:authorName>u9</wikidot:authorName>				<wikidot:authorUserId>12755</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>not at all.. i used paint.net (although i don't care for it much.) I forgot to mention it, but the images have to be cut into seperate files. This was to make it easier and more understandable for my brother :)</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://gamedesign.wikidot.com/forum/t-17598#post-43951</guid>
				<title>Re: Snake 101</title>
				<link>http://gamedesign.wikidot.com/forum/t-17598/snake-101#post-43951</link>
				<description></description>
				<pubDate>Tue, 28 Aug 2007 13:33:34 +0000</pubDate>
				<wikidot:authorName>hartnell</wikidot:authorName>				<wikidot:authorUserId>10978</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>As I posted in the research thread, this is excellent research. However, when I went to download the sprites (my comp has become extremely disorganzied) and cut the images out of it, no image editor would open them. Did you have this problem?</p> <p>&#8212;hartnell</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://gamedesign.wikidot.com/forum/t-17598#post-43884</guid>
				<title>Snake 101</title>
				<link>http://gamedesign.wikidot.com/forum/t-17598/snake-101#post-43884</link>
				<description></description>
				<pubDate>Tue, 28 Aug 2007 09:48:43 +0000</pubDate>
				<wikidot:authorName>u9</wikidot:authorName>				<wikidot:authorUserId>12755</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Here's a little snake-game i made with my little brother to teach him programming. It is quite simple, but i think it turned out quite ok :) It is programmed in a demo version of BlitzPlus so i cannot make an executable. The demo is also limited to about 800 lines of code i think. Download it <a href="http://www.maneeshsethi.com/BlitzPlusDemo.exe">here</a> to try the game or port it to another language.</p> <div class="code"> <pre><code>SeedRnd(MilliSecs()) ; Definitions Type FoodType Field x Field y End Type Type HeadType Field x Field y Field direction End Type Type TailType Field x Field y Field direction Field pause End Type ; Double-buffered window Graphics 800,600,32,0 SetBuffer BackBuffer() ; Load graphics and rotate snake in 4 directions Dim gfxhead(4),gfxbody(4),gfxtail(4) gfxfood=LoadImage(&quot;gfx/snake_food.png&quot;) gfxhead(0)=LoadImage(&quot;gfx/snake_head.png&quot;) gfxbody(0)=LoadImage(&quot;gfx/snake_body.png&quot;) gfxtail(0)=LoadImage(&quot;gfx/snake_tail.png&quot;) For a=1 To 3 gfxhead(a)=CopyImage(gfxhead(0)) RotateImage(gfxhead(a),90*a) MidHandle gfxhead(a) gfxbody(a) = CopyImage(gfxbody(0)) RotateImage(gfxbody(a), 90*a) MidHandle gfxbody(a) gfxtail(a) = CopyImage(gfxtail(0)) RotateImage(gfxtail(a), 90*a) MidHandle gfxtail(a) Next MidHandle gfxfood MidHandle gfxhead(0) MidHandle gfxbody(0) MidHandle gfxtail(0) ; Game-logics variables Global score food.FoodType = New FoodType head.HeadType = New HeadType tail.TailType = New TailType ; Playfield 50x36 Dim track (50,36) ; Start the game start(food, head, tail) Repeat If KeyDown(200) And head\direction &lt;&gt; 2 Then head\direction = 0 ElseIf KeyDown(203) And head\direction &lt;&gt; 1 Then head\direction = 3 ElseIf KeyDown(205) And head\direction &lt;&gt; 3 Then head\direction = 1 ElseIf KeyDown(208) And head\direction &lt;&gt; 0 Then head\direction = 2 End If MoveSnake(head, tail) ; Eat food If food\x = head\x And food\y = head\y Then thisScore = Rand(1,10) tail\pause = tail\pause + thisScore score = score + thisScore * 10 PlaceFood(food) End If ; Do graphics Cls DrawImage(gfxfood, food\x * 16 +8, food\y * 16 +8) For x =0 To 49 For y =0 To 35 If track(x,y) &gt;= 0 Then DrawImage(gfxbody(track(x,y)),x * 16 +8,y * 16 +8) End If Next Next DrawImage(gfxhead(head\direction), head\x * 16 +8, head\y * 16 +8) DrawImage(gfxtail(tail\direction), tail\x * 16 +8, tail\y * 16 +8) Line(0,36 * 16, 799,36 * 16) Text(10, 580, &quot;Score: &quot; + Str(score)) Flip ; Collision detection (after graphics are drawn so one can actually see the collision) If track(head\x,head\y) &gt;= 0 Or (head\x = tail\x And head\y = tail\y) Then Delay(1000) Cls() Text(400, 290, &quot;Your score: &quot; + Str(score), 1, 1) Text(400, 300, &quot;Press return to start&quot;, 1, 1) Flip() Repeat Until KeyHit(28) Or KeyDown(1) ; Restart the game start(food, head, tail) End If ; Snake speed Delay(100) Until KeyDown(1) ; Functions Function MoveSnake(head.HeadType, tail.TailType) ; Move head track(head\x,head\y) = head\direction If head\direction = 0 Then head\y = head\y-1 If head\y &lt; 0 Then head\y = 35 ElseIf head\direction = 1 Then head\x = head\x+1 If head\x &gt; 49 Then head\x = 0 ElseIf head\direction = 2 Then head\y = head\y +1 If head\y &gt; 35 Then head\y = 0 ElseIf head\direction = 3 Then head\x =head\x-1 If head\x &lt; 0 Then head\x = 49 End If ; Move tail If tail\pause &gt; 0 Then tail\pause = tail\pause - 1 Else If tail\direction = 0 Then tail\y = tail\y-1 If tail\y &lt; 0 Then tail\y = 35 ElseIf tail\direction = 1 Then tail\x = tail\x+1 If tail\x &gt; 49 Then tail\x = 0 ElseIf tail\direction = 2 Then tail\y = tail\y +1 If tail\y &gt; 35 Then tail\y = 0 ElseIf tail\direction = 3 Then tail\x =tail\x-1 If tail\x &lt; 0 Then tail\x = 49 End If tail\direction = track(tail\x, tail\y) track(tail\x,tail\y) = -1 End If End Function Function PlaceSnake(head.HeadType, tail.TailType) head\x = 25 head\y = 18 head\direction = 0 tail\x = 25 tail\y = 19 tail\direction = 0 tail\pause = 1 End Function Function PlaceFood(food.FoodType) Repeat food\x = Rand(0,49) food\y = Rand(0,35) Until track(food\x, food\y) = -1 End Function Function Start(food.FoodType, head.HeadType, tail.TailType) score = 0 ; Score is global For x = 0 To 49 For y = 0 To 35 track(x,y) = -1 ; And track is global Next Next PlaceFood(food) PlaceSnake(head, tail) End Function</code></pre></div> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>