First commit.
1
subsites/projects/sq/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
bak/
|
||||
BIN
subsites/projects/sq/bg.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
subsites/projects/sq/bg/1.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
subsites/projects/sq/bg/101.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
subsites/projects/sq/bg/102.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
subsites/projects/sq/bg/111.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
subsites/projects/sq/bg/112.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
subsites/projects/sq/gb.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
1
subsites/projects/sq/index.htm
Normal file
@@ -0,0 +1 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Satan's Quest</title><script type='text/javascript' src='script.js'></script></head><body></body></html>
|
||||
BIN
subsites/projects/sq/sa.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
296
subsites/projects/sq/script.js
Normal file
@@ -0,0 +1,296 @@
|
||||
/*
|
||||
This program is free software. It comes without any warranty, to
|
||||
the extent permitted by applicable law. You can redistribute it
|
||||
and/or modify it under the terms of the Do What The Fuck You Want
|
||||
To Public License, Version 2, as published by Sam Hocevar. See
|
||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
This code is MESSY! It is UNCOMMENTED! It is JAVASCRIPT!
|
||||
In short: It's not perfect. WTF.
|
||||
*/
|
||||
|
||||
function nothing() {
|
||||
// NOTHING
|
||||
}
|
||||
|
||||
function finalend() {
|
||||
head.removeChild(stylesheet)
|
||||
document.body.style.backgroundColor="#000"
|
||||
document.body.style.color="#fff"
|
||||
document.body.style.fontFamily="'lucida console','lucida sans',verdana,arial"
|
||||
document.body.style.fontSize="14px"
|
||||
document.body.innerHTML="DOS<br />>"
|
||||
document.title=""
|
||||
}
|
||||
|
||||
function gameover() {
|
||||
if (!goa) {
|
||||
goa=true
|
||||
dir=2
|
||||
mvn[2]=false
|
||||
document.onkeydown=nothing
|
||||
document.onkeyup=nothing
|
||||
gbdiv.style.top="43px"
|
||||
gbdiv.style.left="57px"
|
||||
|
||||
for (i=0;i<dirnum;i++) {
|
||||
mvn[i]=false
|
||||
for (ii=0;ii<gbl;ii++) {
|
||||
gb[i][ii].style.visibility="hidden"
|
||||
}
|
||||
}
|
||||
gb[2][0].style.visibility="visible"
|
||||
|
||||
msg="<img src='sa.png' style='float:right' />Well done. Satan has finally been defeated. The treasure you found consisted of gold and silver, but it also had a super amazing weapon, which you apparently just used to kill Satan.<br /><br />To the right is a picture of one of Satan's former minions."
|
||||
endtf=true
|
||||
boxmsg()
|
||||
}
|
||||
}
|
||||
|
||||
function boxmsgb() {
|
||||
bmdd.innerHTML=msg
|
||||
}
|
||||
|
||||
function boxmsg() {
|
||||
if (bcblo && bctm==1) bmd.style.display="block"
|
||||
else if (!bcblo && bctm==100) {
|
||||
bmdd.innerHTML=""
|
||||
if (ft) {
|
||||
document.onkeydown=mstart
|
||||
document.onkeyup=mstop
|
||||
ft=false
|
||||
}
|
||||
}
|
||||
bmd.style.width=Math.round(440*bctm/100)+"px"
|
||||
bmd.style.height=Math.round(200*bctm/100)+"px"
|
||||
bmd.style.marginLeft=Math.round(-1*440*bctm/100/2)+"px"
|
||||
bmd.style.marginTop=Math.round(-1*200*bctm/100/2)+"px"
|
||||
if (bcblo && bctm<100 || !bcblo && bctm>1) {
|
||||
if (bcblo) bctm++
|
||||
else bctm--
|
||||
bccgt=setTimeout("boxmsg()",1)
|
||||
}
|
||||
else {
|
||||
if (bcblo) {
|
||||
bcblo=false
|
||||
boxmsgb()
|
||||
}
|
||||
else {
|
||||
bcblo=true
|
||||
bmd.style.display="none"
|
||||
if (endtf) finalend()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function startmove(direction) {
|
||||
clearTimeout(at)
|
||||
clearTimeout(mt)
|
||||
dir=direction
|
||||
for (i=0;i<dirnum;i++) {
|
||||
if (i!=dir) {
|
||||
mvn[i]=false
|
||||
for (ii=0;ii<gbl;ii++) {
|
||||
gb[i][ii].style.visibility="hidden"
|
||||
}
|
||||
}
|
||||
}
|
||||
mvn[dir]=true
|
||||
ani()
|
||||
move()
|
||||
}
|
||||
|
||||
function stopmove(direction) {
|
||||
clearTimeout(at)
|
||||
clearTimeout(mt)
|
||||
dir=direction
|
||||
|
||||
gb[dir][0].style.visibility="visible"
|
||||
for (i=1;i<gbl;i++) {
|
||||
gb[dir][i].style.visibility="hidden"
|
||||
}
|
||||
s=1
|
||||
mvn[dir]=false
|
||||
}
|
||||
|
||||
function move() {
|
||||
gl=gbdiv.offsetLeft
|
||||
gt=gbdiv.offsetTop
|
||||
nl=gl
|
||||
nt=gt
|
||||
ng=false
|
||||
dt=false
|
||||
end=false
|
||||
//document.title=nl+" "+nt
|
||||
if ((dir==3 && nt==objft || dir==2 && nt==objrt) && nl>objla && nl<objlb || (dir==1 && nl==objlb || dir==0 && nl==objla) && nt>objrt && nt<objft) dt=true;ng=false
|
||||
if ((dir==3 && nt==nobjft || dir==2 && nt==nobjrt) && nl>nobjla && nl<nobjlb || (dir==1 && nl==nobjlb || dir==0 && nl==nobjla) && nt>nobjrt && nt<nobjft) dt=true;ng=false
|
||||
if (nl>28 && nl<92 && nt>16 && nt<64) {dt=true;ng=false;end=true}
|
||||
if (!dt) {
|
||||
if (nt<objl) objd.style.zIndex="1"
|
||||
else objd.style.zIndex="0"
|
||||
if (nt<nobjl) nobjd.style.zIndex="1"
|
||||
else nobjd.style.zIndex="0"
|
||||
if (dir<2) {
|
||||
ptml=dir*moveby*(-2)+moveby
|
||||
nl=gl+ptml
|
||||
if (nl>-4 && nl<580) ng=true
|
||||
}
|
||||
else {
|
||||
ptmt=(dir-2)*moveby*(-2)+moveby
|
||||
nt=gt+ptmt
|
||||
if (nt>-4 && nt<308) ng=true
|
||||
}
|
||||
}
|
||||
if (ng) {
|
||||
gbdiv.style.left=nl+"px"
|
||||
gbdiv.style.top=nt+"px"
|
||||
}
|
||||
else stopmove(dir)
|
||||
if (end) gameover()
|
||||
mt=setTimeout("move()",100)
|
||||
}
|
||||
|
||||
function ani() {
|
||||
for (i=0;i<gbl;i++) {
|
||||
if (i==s) gb[dir][i].style.visibility="visible"
|
||||
else gb[dir][i].style.visibility="hidden"
|
||||
}
|
||||
if (s<gbl-1) s++
|
||||
else s=1
|
||||
at=setTimeout("ani()",250)
|
||||
}
|
||||
|
||||
function mstart(e) {
|
||||
if (window.event)
|
||||
kc=window.event.keyCode
|
||||
else if (e)
|
||||
kc=e.which
|
||||
|
||||
if (kc==39 && !mvn[0]) startmove(0)
|
||||
else if (kc==37 && !mvn[1]) startmove(1)
|
||||
else if (kc==40 && !mvn[2]) startmove(2)
|
||||
else if (kc==38 && !mvn[3]) startmove(3)
|
||||
}
|
||||
|
||||
function mstop(e) {
|
||||
if (window.event)
|
||||
kc=window.event.keyCode
|
||||
else if (e)
|
||||
kc=e.which
|
||||
|
||||
if (kc==39 && mvn[0]) stopmove(0)
|
||||
else if (kc==37 && mvn[1]) stopmove(1)
|
||||
else if (kc==40 && mvn[2]) stopmove(2)
|
||||
else if (kc==38 && mvn[3]) stopmove(3)
|
||||
}
|
||||
|
||||
function load() {
|
||||
stylesheet=document.createElement("link")
|
||||
stylesheet.rel="stylesheet"
|
||||
stylesheet.type="text/css"
|
||||
stylesheet.href="style.css"
|
||||
head=document.getElementsByTagName("head")[0]
|
||||
head.appendChild(stylesheet)
|
||||
|
||||
gameload()
|
||||
}
|
||||
|
||||
function gameload() {
|
||||
s=1
|
||||
gbl=3
|
||||
dirnum=4
|
||||
dir=2
|
||||
mt=false
|
||||
at=false
|
||||
moveby=4
|
||||
bcblo=true
|
||||
bctm=1
|
||||
ft=true
|
||||
goa=false
|
||||
endtf=false
|
||||
|
||||
document.body.innerHTML=""
|
||||
|
||||
bmd=document.createElement("div")
|
||||
bmd.id="bmd"
|
||||
bmdd=document.createElement("div")
|
||||
bmdd.id="bmdd"
|
||||
bmdc=document.createElement("div")
|
||||
bmdc.id="bmdc"
|
||||
bmdc.innerHTML="OK"
|
||||
bmdc.onclick=function(){boxmsg()}
|
||||
bmd.appendChild(bmdd)
|
||||
bmd.appendChild(bmdc)
|
||||
document.body.appendChild(bmd)
|
||||
|
||||
msg="<img src='sq.png' style='margin-left:10px;display:block' />Welcome to Satan's Quest. This \"game\" is really simple. Navigate Gabruel the Angel with the arrow keys. You can't walk through objects (like a tree). Your goal is to find the treasure and terminate Satan once and for all. Your wit is your smartest weapon."
|
||||
boxmsg()
|
||||
|
||||
game=document.createElement("div")
|
||||
game.id="game"
|
||||
game.style.backgroundImage="url(bg/1.png)"
|
||||
objd=document.createElement("div")
|
||||
objd.style.width="146px"
|
||||
objd.style.height="220px"
|
||||
objd.style.top="90px"
|
||||
objd.style.left="247px"
|
||||
objd.style.backgroundImage="url(bg/101.png)"
|
||||
objdl=document.createElement("div")
|
||||
objdl.style.width="146px"
|
||||
objdl.style.height="220px"
|
||||
objdl.style.top="90px"
|
||||
objdl.style.left="247px"
|
||||
objdl.style.zIndex="0"
|
||||
objdl.style.backgroundImage="url(bg/102.png)"
|
||||
objl=156
|
||||
objft=168
|
||||
objrt=148
|
||||
objla=256
|
||||
objlb=320
|
||||
|
||||
nobjd=document.createElement("div")
|
||||
nobjd.style.width="74px"
|
||||
nobjd.style.height="98px"
|
||||
nobjd.style.top="47px"
|
||||
nobjd.style.left="52px"
|
||||
nobjd.style.backgroundImage="url(bg/111.png)"
|
||||
nobjdl=document.createElement("div")
|
||||
nobjdl.style.width="74px"
|
||||
nobjdl.style.height="98px"
|
||||
nobjdl.style.top="47px"
|
||||
nobjdl.style.left="52px"
|
||||
nobjdl.style.zIndex="0"
|
||||
nobjdl.style.backgroundImage="url(bg/112.png)"
|
||||
nobjl=16
|
||||
nobjft=20
|
||||
nobjrt=4
|
||||
nobjla=4
|
||||
nobjlb=116
|
||||
|
||||
gbdiv=document.createElement("div")
|
||||
gbdiv.id="gb"
|
||||
gbdiv.style.top="236px"
|
||||
gbdiv.style.left="312px"
|
||||
game.appendChild(objd)
|
||||
game.appendChild(objdl)
|
||||
game.appendChild(nobjd)
|
||||
game.appendChild(nobjdl)
|
||||
game.appendChild(gbdiv)
|
||||
|
||||
gb=new Array()
|
||||
mvn=new Array()
|
||||
for (i=0;i<4;i++) {
|
||||
gb[i]=new Array()
|
||||
for (ii=0;ii<3;ii++) {
|
||||
gb[i][ii]=document.createElement("div")
|
||||
gb[i][ii].id="gb"+i+""+ii+""
|
||||
gbdiv.appendChild(gb[i][ii])
|
||||
}
|
||||
mvn[i]=false
|
||||
}
|
||||
document.body.appendChild(game)
|
||||
}
|
||||
|
||||
window.onload=load
|
||||
BIN
subsites/projects/sq/sq.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
96
subsites/projects/sq/style.css
Normal file
@@ -0,0 +1,96 @@
|
||||
* {
|
||||
padding:0;
|
||||
margin:0
|
||||
}
|
||||
|
||||
body {
|
||||
background:#0094ff url(bg.png) center;
|
||||
}
|
||||
|
||||
#bmd {
|
||||
position:absolute;
|
||||
left:50%;
|
||||
top:50%;
|
||||
margin-left:0;
|
||||
margin-top:0;
|
||||
width:0;
|
||||
height:0;
|
||||
background-color:#666;
|
||||
border:2px solid #000;
|
||||
z-index:2;
|
||||
display:none;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
#bmdd {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
width:430px;
|
||||
height:365px;
|
||||
padding:5px;
|
||||
color:#fff;
|
||||
font:14px 'lucida console','lucida sans',verdana,arial;
|
||||
}
|
||||
|
||||
#bmdc {
|
||||
position:absolute;
|
||||
bottom:5px;
|
||||
left:50%;
|
||||
width:100px;
|
||||
height:20px;
|
||||
margin-left:-50px;
|
||||
text-align:center;
|
||||
color:#fff;
|
||||
font:18px 'lucida console';
|
||||
background:#444;
|
||||
cursor:pointer;
|
||||
z-index:3;
|
||||
}
|
||||
|
||||
#bmdc:hover {
|
||||
background:#888;
|
||||
}
|
||||
|
||||
#game {
|
||||
position:absolute;
|
||||
left:50%;
|
||||
top:50%;
|
||||
margin-left:-320px;
|
||||
margin-top:-200px;
|
||||
width:640px;
|
||||
height:400px;
|
||||
border:2px solid #000;
|
||||
}
|
||||
|
||||
#game div {
|
||||
position:absolute;
|
||||
}
|
||||
|
||||
#gb {
|
||||
position:absolute;
|
||||
width:64px;
|
||||
height:96px;
|
||||
}
|
||||
|
||||
#gb div {
|
||||
position:absolute;
|
||||
width:64px;
|
||||
height:96px;
|
||||
background-repeat:no-repeat;
|
||||
background-image:url(gb.png);
|
||||
visibility:hidden;
|
||||
}
|
||||
|
||||
#gb00 {background-position:0 0}
|
||||
#gb01 {background-position:-64px 0}
|
||||
#gb02 {background-position:-128px 0}
|
||||
#gb10 {background-position:0 -96px}
|
||||
#gb11 {background-position:-64px -96px}
|
||||
#gb12 {background-position:-128px -96px}
|
||||
#gb #gb20 {background-position:0 -192px;visibility:visible}
|
||||
#gb21 {background-position:-64px -192px}
|
||||
#gb22 {background-position:-128px -192px}
|
||||
#gb30 {background-position:0 -288px}
|
||||
#gb31 {background-position:-64px -288px}
|
||||
#gb32 {background-position:-128px -288px}
|
||||