<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Small Basic : point</title><link>http://blogs.msdn.com/smallbasic/archive/tags/point/default.aspx</link><description>Tags: point</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Sample of the Week</title><link>http://blogs.msdn.com/smallbasic/archive/2008/11/01/featured-sample-of-the-week.aspx</link><pubDate>Sat, 01 Nov 2008 22:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9028476</guid><dc:creator>vijayeg</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/smallbasic/comments/9028476.aspx</comments><wfw:commentRss>http://blogs.msdn.com/smallbasic/commentrss.aspx?PostID=9028476</wfw:commentRss><description>&lt;P&gt;This week's featured sample of the week comes from &lt;A class="" href="http://social.msdn.microsoft.com/en-US/profile/?user=mcleod_ideafix" mce_href="http://social.msdn.microsoft.com/en-US/profile/?user=mcleod_ideafix"&gt;mcleod_ideafix&lt;/A&gt;.&amp;nbsp; This is a fun little&amp;nbsp;point and shoot game, involving the Turtle in a clever way.&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; FONT-FAMILY: Consolas, Courier New; BACKGROUND-COLOR: #666666"&gt;&lt;PRE&gt;'Point-and-shoot   
'(C)1989 McLeod/IdeaFix. http://www.zxprojects.com   
  
'Target size   
TargetSize=30   
winner=0   
wanttoplay=1   
  
'A vector-screen style window   
GraphicsWindow.BackgroundColor="Black"  
GraphicsWindow.PenColor="Green"  
GraphicsWindow.Clear()   
  
Game()   
  
Sub Game   
    While (wanttoplay=1)   
        GetRnd()   
        DrawTarget()   
        Turtle.PenUp()   
           
        'Game loop   
        While (winner=0)   
            Shoot()   
        EndWhile   
           
        winner=0   
        TextWindow.Write("Another game? (y/n) ")   
        answ = TextWindow.Read()   
        If (Text.StartsWith(Text.ConvertToLowerCase(answ),"n")) Then  
            wanttoplay=0   
        Else  
            GraphicsWindow.Clear()   
            Turtle.PenDown()   
            GraphicsWindow.PenColor="Green"  
        EndIf   
    EndWhile   
EndSub   
  
Sub Shoot   
    TextWindow.Write("Angle? ")   
    ang=TextWindow.ReadNumber()   
    TextWindow.Write("Distance? ")   
    dist=TextWindow.ReadNumber()   
  
    Turtle.Turn(ang)   
    Turtle.Move(dist)   
    Turtle.Turn(-ang)   
       
    xs=dist*Math.Cos(Math.GetRadians(ang))   
    ys=dist*Math.Sin(Math.GetRadians(ang))   
       
    If (xs&amp;gt;=xmin And xs&amp;lt;=xmax And ys&amp;gt;=ymin And ys&amp;lt;=ymax) Then  
        Sound.PlayChimes()   
        Turtle.Speed=100   
        Turtle.Move(-15)   
        Turtle.PenDown()   
        'The boom! visual effect   
        For n=1 To 36   
            GraphicsWindow.PenColor=GraphicsWindow.GetRandomColor()   
            Turtle.Move(30)   
            Turtle.Turn(150)   
        EndFor   
        Turtle.PenUp()   
        Turtle.Move(15)   
        Turtle.Turn(ang)   
        Turtle.Move(-dist)   
        Turtle.Turn(-ang)           
        Turtle.Hide()        
        TextWindow.WriteLine("Target cleared!! You WIN")   
        winner=1   
    Else  
        TextWindow.Write("Target failed!! Try again (press RETURN)")   
        TextWindow.Read()   
        Turtle.Speed=100   
        Turtle.Turn(ang)   
        Turtle.Move(-dist)   
        Turtle.Turn(-ang)   
        Turtle.Speed=7   
        winner=0   
    EndIf   
EndSub   
  
Sub GetRnd   
    'These variables should store the current Height and Width of 
    'GraphicsWindow, but it seems not to work   
    he=480   
    wi=640   
       
    If (he &amp;lt; wi) Then  
        distance=40+Math.GetRandomNumber(he/2-TargetSize-40)   
    Else  
        distance=40+Math.GetRandomNumber(wi/2-TargetSize-40)   
    EndIf   
    angle=Math.GetRandomNumber(360)   
       
    xmin=distance*Math.Cos(Math.GetRadians(angle))   
    ymin=distance*Math.Sin(Math.GetRadians(angle))   
    xmax=xmin+TargetSize   
    ymax=ymin+TargetSize   
EndSub   
  
Sub DrawTarget   
    Turtle.Speed=100       
    Turtle.PenUp()   
    Turtle.Turn(angle)   
    Turtle.Move(distance)   
    Turtle.Turn(-angle)   
    Turtle.PenDown()   
    For n=1 To 4   
        Turtle.Move(TargetSize)   
        Turtle.TurnRight()   
    EndFor   
    Turtle.PenUp()   
    Turtle.Turn(angle)   
    Turtle.Move(-distance)   
    Turtle.Turn(-angle)   
    Turtle.PenDown()   
    Turtle.Speed=7   
EndSub
&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;And here's the screenshot. &lt;/P&gt;
&lt;P&gt;&lt;IMG style="WIDTH: 477px; HEIGHT: 375px" height=375 src="http://blogs.msdn.com/photos/vijayeg/images/9028475/477x375.aspx" width=477 mce_src="http://blogs.msdn.com/photos/vijayeg/images/9028475/477x375.aspx"&gt; &lt;/P&gt;
&lt;P&gt;Do you want your samples to be featured here?&amp;nbsp; Post them in &lt;A class="" href="http://social.msdn.microsoft.com/Forums/en-US/smallbasic/threads/" mce_href="http://social.msdn.microsoft.com/Forums/en-US/smallbasic/threads/"&gt;our forums&lt;/A&gt; and we'll pick one each week.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9028476" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/smallbasic/archive/tags/turtle/default.aspx">turtle</category><category domain="http://blogs.msdn.com/smallbasic/archive/tags/sample/default.aspx">sample</category><category domain="http://blogs.msdn.com/smallbasic/archive/tags/point/default.aspx">point</category><category domain="http://blogs.msdn.com/smallbasic/archive/tags/small+basic/default.aspx">small basic</category></item></channel></rss>