首页 > 编程 > HTML > 正文

HTANoid 用hta编写的一个经典的游戏

2024-08-26 00:15:42
字体:
来源:转载
供稿:网友
This game is not finished. The purpose was just to show you that you can do some graphical things without having to use external pictures.
If you want to develop this game, please submit your updates.

File Name : htanoid.hta
Requirement : IE 6 ?
Author : Jean-Luc Antoine
Submitted : 17/05/2002
Category : Other


效果图:



实现代码:

代码如下:
<html xmlns:v="urn:schemas-microsoft-com:vml" XMLNS:t="urn:schemas-microsoft-com:time">
<head>

<HTA:APPLICATION
 APPLICATIONNAME="HTAnoid"
 BORDER="thick" | "dialog" | "none"  | "thin"
 BORDERSTYLE="normal" | "complex" | "raised"  | "static"  | "sunken"
 CAPTION="yes" CONTEXTMENU="yes"
 ID="oHTA" alert(oHTA.applicationName);
 INNERBORDER="yes" MAXIMIZEBUTTON="yes" MINIMIZEBUTTON="yes"
 NAVIGABLE="no" SCROLL="no" SCROLLFLAT="no"
 SELECTION="yes" SHOWINTASKBAR="yes" SINGLEINSTANCE="no"
 SYSMENU="yes" VERSION="0.5"
 WINDOWSTATE="normal" | "maximize" | "minimize">

<script language=vbscript>
Option explicit
Const C_ScreenW=400
Const C_NbX=12
Const C_NbY=10
Dim Terrain(10,12)
Dim RaqX,RaqW,Playing,BalleX,BalleY
Dim DirBX,DirBY 'Direction balle X,Y
Dim BordDroit
BordDroit=C_ScreenW-32

Sub Document_onKeyPress()
 Select Case UCase(Chr(Window.Event.keyCode))
 Case "P"
  Msgbox "pause"
  'Window.ClearTimeOut
 End Select
End Sub

Sub Document_onClick()
 Playing=True
 'document.title="click " & window.event.button
End Sub

Sub Document_onMouseMove()
 RaqX=window.event.clientX-RaqW '.shiftKey .keyCode .ctrlKey .button .altKey
 If RaqX<16 Then RaqX=16 'Mur gauche
 If RaqX+RaqW>BordDroit Then RaqX=BordDroit-RaqW
 Raquette.style.Left=RaqX
 If Not Playing Then
  BalleX=RaqX+RaqW/2
  Balle.Style.Left=BalleX
 End If
End Sub

Sub DrawLevel(n)
 Dim k,x,y
 set k=document.getElementById("Raquette")
 For y=0 To C_NbY
  For x=0 To C_NbX
   Terrain(y,x)=0 'Nb de coups restant à porter
  Next
 Next

 Select Case n
 Case 1
  'Bricks
  For y=0 To 5
   For x=0 To C_NbX
    k.insertAdjacentHTML "beforeBegin","<TABLE style='position:absolute;top=" & 102+14*y & ";left=" & 16+27*x _
    & ";width=25;height=10;' bgcolor=" & Array("silver","red","yellow","blue","magenta","lightgreen")(y) & "><TR><TD></TD></TR></TABLE>"
   Next
  Next
 End Select
 Randomize
 BalleY=400
 DirBX=Int(Rnd()*3)+1
 DirBY=0-(Int(Rnd()*4)+1)
End Sub

Sub Init
 Dim x,y,k

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表