1
0
Fork 0

Update 14 -- evil bunny is there doing nothing

master
Ambrose Chua 2013-04-18 18:12:14 +08:00
parent 31c16d8807
commit b6623a532d
11 changed files with 63 additions and 23 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/index.html~
/main.css~
/main.js~

BIN
assets/bar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
assets/barfill.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
assets/eknife.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -1,5 +1,5 @@
CACHE MANIFEST CACHE MANIFEST
# v2.0.0d13 # v2.0.0d14
CACHE: CACHE:
index.html index.html
main.js main.js

View File

@ -16,10 +16,6 @@
<div id="kills"></div> <div id="kills"></div>
</div> </div>
<div id="dirh">
<div id="dir">&nbsp;</div>
</div>
<div id="tgpm"> <div id="tgpm">
<h1>Paused</h1> <h1>Paused</h1>
<div id="cont" class="btn">&#9654; Continue playing</div> <div id="cont" class="btn">&#9654; Continue playing</div>
@ -32,7 +28,7 @@
<div id="high" class="btn" onClick="alert('The bunnies have not made this work yet! ');">Highscores</div> <div id="high" class="btn" onClick="alert('The bunnies have not made this work yet! ');">Highscores</div>
<div class="btn" id="about">About</div> <div class="btn" id="about">About</div>
<a href="http://ambrosechua.github.com/thebunniesinc/" class="btn">How to play</a> <a href="http://ambrosechua.github.com/thebunniesinc/" class="btn">How to play</a>
<span style="font-size: 12px;">Alpha Version 2.0.0 release 13</span> <span style="font-size: 12px;">Alpha Version 2.0.0 release 14</span>
</div> </div>
<div id="aboutc"> <div id="aboutc">
@ -54,6 +50,15 @@ Parts of this game includes code from other sources. <br />
<canvas id="you"><h1>Aww, snap! </h1><p>Please use a updated browser to play. </p></canvas> <canvas id="you"><h1>Aww, snap! </h1><p>Please use a updated browser to play. </p></canvas>
<div id="frame">
<div id="bunny"></div>
<div class="enemy"></div>
</div>
<div id="dirh">
<div id="dir">&nbsp;</div>
</div>
<div id="map_canvas"></div> <div id="map_canvas"></div>
<div id="dpf">&#9650;</div> <div id="dpf">&#9650;</div>

View File

@ -74,7 +74,7 @@ right: 10px;
#bar { #bar {
background-color: rgba(0, 0, 0, 0.0); background-color: rgba(0, 0, 0, 0.0);
z-index: 1; z-index: 2;
color: #eee; color: #eee;
padding: 10px 0px; padding: 10px 0px;
position: absolute; position: absolute;
@ -206,3 +206,33 @@ float: left;
display: inline-block; display: inline-block;
margin-left: 30px; margin-left: 30px;
} }
#frame {
width: 0;
height: 0;
}
#bunny {
display: none;
width: 100px;
height: 175px;
position: absolute;
top: 50%;
left: 50%;
margin-top: -82.5px;
margin-left: -50px;
background: url(assets/you.png);
background-size: 100% 100%;
z-index: 3;
}
.enemy {
display: block;
width: 100px;
height: 175px;
position: absolute;
top: 0px;
left: 0px;
margin-top: 0px;
margin-left: 0px;
background: url(assets/eknife.png);
background-size: 100% 100%;
z-index: 1;
}

34
main.js
View File

@ -8,8 +8,10 @@ var interb=0;
var interl=0; var interl=0;
var interr=0; var interr=0;
var player={ var player={
x: 0, x: 0,
y: 0 y: 0,
health: 100,
weapon: 0
}; };
var evil=[]; var evil=[];
@ -19,19 +21,19 @@ return Math.atan2(bx-x, by-y)/Math.PI*-180;
function dpf() { function dpf() {
map.panBy(0, -step); map.panBy(0, -step);
player["x"]-=step; player.x-=step;
} }
function dpb() { function dpb() {
map.panBy(0, step); map.panBy(0, step);
player["x"]+=step; player.x+=step;
} }
function dpl() { function dpl() {
map.panBy(-step, 0); map.panBy(-step, 0);
player["y"]-=step; player.y-=step;
} }
function dpr() { function dpr() {
map.panBy(step, 0); map.panBy(step, 0);
player["y"]+=step; player.y+=step;
} }
window.addEventListener('load', function(e) { window.addEventListener('load', function(e) {
@ -95,15 +97,15 @@ $("#dpf, #dpb, #dpl, #dpr").css("display", "none");
//stackoverflow //stackoverflow
function getPosition(e) { function getPosition(e) {
var targ; var targ;
if (!e) if (!e)
e = window.event; e = window.event;
if (e.target) if (e.target)
targ = e.target; targ = e.target;
else if (e.srcElement) else if (e.srcElement)
targ = e.srcElement; targ = e.srcElement;
if (targ.nodeType == 3) if (targ.nodeType == 3)
targ = targ.parentNode; targ = targ.parentNode;
var x = e.pageX - $(targ).offset().left; var x = e.pageX - $(targ).offset().left;
var y = e.pageY - $(targ).offset().top; var y = e.pageY - $(targ).offset().top;
$("#dirh").css("transform", "rotate("+angle(x, y, $("#you").width()/2, $("#you").height()/2)+"deg)"); $("#dirh").css("transform", "rotate("+angle(x, y, $("#you").width()/2, $("#you").height()/2)+"deg)");
@ -284,6 +286,7 @@ function getready() {
$("#menu").fadeOut(); $("#menu").fadeOut();
$("#bar").css("background-color", "rgba(0, 0, 0, 0.5)"); $("#bar").css("background-color", "rgba(0, 0, 0, 0.5)");
$("#sec").html("Ready"); $("#sec").html("Ready");
$("#bunny").fadeIn();
setTimeout(function() { setTimeout(function() {
$("#sec").html("Set"); $("#sec").html("Set");
}, 2000); }, 2000);
@ -292,7 +295,6 @@ $("#sec").html("Go! ");
}, 4000); }, 4000);
setTimeout(function() { setTimeout(function() {
$("#kills").html("0 kills"); $("#kills").html("0 kills");
$("#tgp").fadeIn().click(function() { $("#tgp").fadeIn().click(function() {
end(); end();
}); });

BIN
xcf/bar.xcf Normal file

Binary file not shown.

BIN
xcf/barfill.xcf Normal file

Binary file not shown.

BIN
xcf/eknife.xcf Normal file

Binary file not shown.