Made it work again

This commit is contained in:
Oliver Rümpelein 2014-10-16 13:22:15 +02:00
parent 80e21d23d9
commit 3b67537a88
4 changed files with 29 additions and 14 deletions

View file

@ -16,7 +16,7 @@
var cur_sel; // "Pointer" to current selected creature var cur_sel; // "Pointer" to current selected creature
var player={}; var player={};
/* iniitialize Players and creatures */ /* initialize Players ("Player") and creatures ("Beast") */
player["Gesina"]=new Player({"pname":"Gesina", "cname":"Aknya", "class":"Zauberin", "level":0, player["Gesina"]=new Player({"pname":"Gesina", "cname":"Aknya", "class":"Zauberin", "level":0,
"experience":0, "race":"Mensch", "size":2}, "experience":0, "race":"Mensch", "size":2},
{"body":6, "agility":6, "spirit":8}, {"body":6, "agility":6, "spirit":8},

View file

@ -1,17 +1,8 @@
body {
width: 800px;
margin: auto;
background: url('/assets/freielande.jpg') no-repeat 0 0, rgb(198,186,160);
background-size: 100% auto;
padding: 10px 0;
}
body>div { body>div {
postion:relative; postion:relative;
background: rgba(163,128,95,0.9); background: rgba(163,128,95,0.9);
border-radius: 20px; border-radius: 20px;
padding: 5px 10px 5px 10px; padding: 5px 10px 5px 10px;
width:
} }
h1 { h1 {
@ -36,9 +27,28 @@ h1 {
} }
#load { #load {
margin: 0px auto; margin: 0px auto 5px auto;
} }
#clear { #clear {
clear: both; clear: both;
} }
/* Don't show anything but warning, if too small */
@media all and (min-width: 800px) {
#small {
display:none;
}
body {
width: 800px;
margin: auto;
background: url('/assets/freielande.jpg') no-repeat 0 0, rgb(198,186,160);
background-size: 100% auto;
padding: 10px 0;
}
}
@media all and (max-width: 800px) {
#display {
display:none;
}
}

View file

@ -6,7 +6,7 @@
<link rel="stylesheet" href="assets/style.css" /> <link rel="stylesheet" href="assets/style.css" />
</head> </head>
<body> <body>
<div> <div id="display">
<h1>JSDSH - Javascript Dungeonslayers Helper</h1> <h1>JSDSH - Javascript Dungeonslayers Helper</h1>
<div id="game"></div> <div id="game"></div>
@ -18,6 +18,9 @@
<button id="load">Load</button> <button id="load">Load</button>
</div> </div>
<div id="small">
Die Anzeige dieser Seite benötigt eine Breite von mindestens 800 px!
</div>
<!-- Include 3rd-Party Libraries --> <!-- Include 3rd-Party Libraries -->
<script type="text/javascript" src="lib/crafty.js"></script> <script type="text/javascript" src="lib/crafty.js"></script>
<script type="text/javascript" src="lib/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="lib/jquery-1.11.1.min.js"></script>

View file

@ -56,6 +56,8 @@
this.id=id || ""; this.id=id || "";
this.h = h || 40; this.h = h || 40;
this.w = w || 40; this.w = w || 40;
this.x = x || 0;
this.y = y || 0;
this.thing(x,y,w,h,col) this.thing(x,y,w,h,col)
.collision() .collision()
.fourway(4) .fourway(4)
@ -77,7 +79,6 @@
(this.hit("coll")[0].overlap) ); (this.hit("coll")[0].overlap) );
} }
}); });
calc_center();
/* Mouse-actions: /* Mouse-actions:
* left click: select creature, save old position, make only this creature * left click: select creature, save old position, make only this creature
@ -87,6 +88,7 @@
*/ */
this.bind('MouseDown', function(e) { this.bind('MouseDown', function(e) {
if(e.mouseButton === Crafty.mouseButtons.LEFT) { if(e.mouseButton === Crafty.mouseButtons.LEFT) {
this.calc_center();
this.old_pos["x"]=this.x; this.old_pos["x"]=this.x;
this.old_pos["y"]=this.y; this.old_pos["y"]=this.y;
Crafty("Creature").each( function() { Crafty("Creature").each( function() {