Microsoft Small Basic

Program Listing:
Embed this in your website
'Copyright © All Rights Reserved
'ProfessionalOfSmallBasic

init()


'initialise--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub init
GraphicsWindow.Top=-30
GraphicsWindow.Left=-10
GraphicsWindow.Width=Desktop.Width
GraphicsWindow.Height=Desktop.Height
GraphicsWindow.BackgroundColor="cyan"
grass=ImageList.LoadImage("http://img-fotki.yandex.ru/get/6402/160878850.4ce/0_88f38_e6cefdd0_XL.png")
GraphicsWindow.DrawResizedImage(grass,0,Desktop.Height/2,Desktop.Width,Desktop.Height/2)
trgt=ImageList.LoadImage("http://appinventor.mit.edu/explore/sites/all/files/ai2tutorials/moleMash2/mole.png")
NN=10
For i=1 To NN
  target[i]=Shapes.AddImage(trgt)
  n[i]=Math.GetRandomNumber(Desktop.Width-50)
  m[i]=Desktop.Height-Math.GetRandomNumber(Desktop.Height/2)-50
EndFor
crsr=ImageList.LoadImage("http://img513.imageshack.us/img513/5213/type5pickvp6.png")
cursor=Shapes.AddImage(crsr)
Mouse.HideCursor()
GraphicsWindow.MouseDown=onmousedown
score=0
EndSub


'loop--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
loop:
x=Mouse.MouseX-25
y=Mouse.MouseY
Shapes.Move(cursor,x,y)
For i=1 To NN
  Shapes.Move(target[i],n[i],m[i])
EndFor
scoretable()
Goto loop


'events------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub onmousedown
  For i=1 To NN
    If x>n[i]-25 And x<n[i]+25 and y>m[i]-25 And y<m[i]+25 Then
      n[i]=Math.GetRandomNumber(Desktop.Width-50)
      m[i]=Desktop.Height-Math.GetRandomNumber(Desktop.Height/2)-50
      score=score+1
    EndIf
  EndFor
EndSub


'scoretable--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub scoretable
  GraphicsWindow.BrushColor="cyan"
  GraphicsWindow.FillRectangle(0,0,150,50)
  GraphicsWindow.FontSize=21
  GraphicsWindow.BrushColor="black"
  GraphicsWindow.DrawText(0,0,"Dead Mole:"+score)
EndSub


'The END----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Copyright (c) Microsoft Corporation. All rights reserved.