Commit 7655bbc4 authored by Raphaël Bastide's avatar Raphaël Bastide

Style + Readme update

parent e5e6356b
......@@ -4,6 +4,14 @@ A game you play in the URL
![](burl.png)
## Modify
It is easy to add more bonuses and platforms. For that, check out [`js/units.json`](https://gitlab.com/raphaelbastide/burl/blob/master/js/units.json).
### How to add a platform type
**Soon**
## Thanks
- [Matter.js](http://brm.io/matter-js/), physics engine
......
......@@ -35,6 +35,8 @@ canvas{
border-radius: 20px;
margin-top: 30px;
transition: all .4s linear;
width:100%;
height: 50%;
}
aside, main{
position: relative;
......@@ -80,9 +82,16 @@ aside .inner{
#help{
background: #35f531;
}
.box.updated{
background: white!important;
}
a{color: inherit;}
.pause-btn{
.char{
background: white;
border-radius:20px;
padding: 0 .4em;
}
.pause-btn.button{
position: absolute;
right:10px;
bottom:10px;
......@@ -92,7 +101,7 @@ a{color: inherit;}
padding: 5px 10px;
border-radius: 20px;
}
.pause-btn:hover{background: white;}
.pause-btn.button:hover{background: white;}
.paused .pause-icon, .play-icon{display: none;}
.pause-icon, .paused .play-icon{display: block;}
.button{
......
......@@ -65,8 +65,6 @@
})();
window.addEventListener('hashchange', function() {
_paq.push(['setCustomUrl', '/' + window.location.hash.substr(1)]);
_paq.push(['setDocumentTitle', 'My New Title']);
_paq.push(['trackPageView']);
});
</script>
<!-- End Matomo Code -->
......
var d = document,
infobox = d.getElementById("infobox"),
inventory = d.getElementById('inventory'),
body = d.getElementsByTagName("body")[0]
body = d.getElementsByTagName("body")[0],
main = d.getElementsByTagName("main")[0]
function preloadImgs() {
var images = ['burl-ball.svg','burl-bonus.svg'];
......@@ -34,7 +34,6 @@ function promptInfo(message, open=false){
}
infoLine.classList.add('visible')
infoLine.classList.add('infoline')
// setTimeout(function(){ infoLine.classList.remove('visible') }, 5000);
getInfoNumber()
}
......@@ -80,7 +79,7 @@ function makeInventory(data){
var p = d.createElement('p')
var char = availableChar[i]
var unit = findObjectsByKey(data.units, 'char', char)[0]
p.innerHTML = char+' : '+unit.name
p.innerHTML = "<span class='char'>"+char+"</span> "+unit.name
p.setAttribute('data-char',char)
if (unit.isLocked) {
p.classList.add('locked')
......@@ -91,6 +90,10 @@ function makeInventory(data){
function updateInventory(charToUnlock){
var line = d.querySelectorAll('#inventory [data-char='+charToUnlock+']')[0]
line.classList.remove('locked')
inventory.classList.add('updated')
setTimeout(function(){
inventory.classList.remove('updated')
},100)
}
function resetInfo(){
......@@ -111,7 +114,7 @@ function testHash(data){
hashChar = hash.split('')
for (var i = 0; i < hashChar.length; i++) {
if (availableChar.indexOf(hashChar[i]) <= -1) { // incompatible character
promptInfo("["+hashChar[i]+"] is not a valid character", false)
promptInfo("<span class='char'>"+hashChar[i]+"</span> is not a valid character", false)
}else {
cleanHash.push(hashChar[i])
}
......
......@@ -14,13 +14,13 @@ function launch(units, isRefresh){
Events = Matter.Events;
var debug = false,
main = d.getElementsByTagName('main')[0],
pauseBtn = d.querySelectorAll(".pause-btn")[0],
pauseBtn = d.querySelectorAll(".pause-btn"),
startX = 100,
startY = 300,
nextPos = 0,
lastDir = 0,
canvasW = 1500,
canvasH = 800,
canvasH = 750,
strokeWidth = 5,
buildW = 400,
buildH = 30,
......@@ -189,7 +189,7 @@ function launch(units, isRefresh){
}
World.remove(world, bonus)
var message = '['+toUnLock.char+'] '+toUnLock.name+' unlocked!'
var message = '<span class="char">'+toUnLock.char+'</span> '+toUnLock.name+' unlocked!'
updateInventory(toUnLock.char)
promptInfo(message)
}
......@@ -303,9 +303,12 @@ function launch(units, isRefresh){
});
World.add(world, [ball]);
pauseBtn.addEventListener('click',function(){
togglePause()
})
for (var i = 0; i < pauseBtn.length; i++) {
pauseBtn[i].addEventListener('click',function(){
togglePause()
})
}
function togglePause(){
if (body.classList.contains('paused')) {
body.classList.remove('paused')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment