Commit 7e3094d2 authored by Raphaël Bastide's avatar Raphaël Bastide

Title screen and debug state

parent 4b68e6b1
......@@ -4,6 +4,19 @@
html, body{
height: 100%;
}
h1{
font-size: 30vw;
line-height: .9em;
margin: 0;
position: absolute;
top:0;
left: 0;
width: 100%;
z-index: 100;
font-weight: 200;
text-align: center;
}
h1.hidden{display: none;}
body {
font:24px/1.2em 'version 4';
background: #7ceb9f;
......
......@@ -14,6 +14,7 @@
<title>Url Rider</title>
</head>
<body>
<h1>URL Rider</h1>
<aside>
<div id="unitlist"></div>
<div id="alertbox"></div>
......
var d = document
function getDistances(unit){
var realW = unit.bounds.max.x - unit.bounds.min.x
var realH = unit.bounds.max.y - unit.bounds.min.y
......@@ -14,8 +14,8 @@ function checkLock(unit){
}
}
function notifAlert(message){
var alertBox = document.getElementById("alertbox")
var alertLine = document.createElement('p')
var alertBox = d.getElementById("alertbox")
var alertLine = d.createElement('p')
alertLine.innerHTML = message
alertBox.appendChild(alertLine)
alertLine.classList.add('visible')
......@@ -32,3 +32,7 @@ function findObjectsByKey(array, key, value) {
}
return result
}
function title(){
var t = d.getElementsByTagName('h1')[0]
window.setTimeout(function(){t.classList.add('hidden')},1000)
}
......@@ -10,7 +10,8 @@ var Engine = Matter.Engine,
Bodies = Matter.Bodies,
Body = Matter.Body,
Events = Matter.Events;
var startX = 100,
var debug = false,
startX = 100,
startY = 200,
nextPos = 0,
lastDir = 0,
......@@ -30,7 +31,9 @@ var Engine = Matter.Engine,
terrain = window.location.hash.substr(1)
function launch(units){
if (!debug) {
title()
}
// create engine
var engine = Engine.create(),
world = engine.world;
......@@ -48,7 +51,6 @@ function launch(units){
}
});
// Building common objects
var ball = Bodies.circle(100, 100, 100, { friction:1, frictionAir:.003, restitution: 0.2})
ball.render.sprite.texture = 'img/ball.svg'
......@@ -66,7 +68,7 @@ function launch(units){
World.add(world,toBuild);
}
// Adding common objects to the world
World.add(world, [ball]);
// Extracting URL characters to build the terrain
......@@ -243,9 +245,7 @@ function launch(units){
}
}
});
World.add(world, [ball]);
var runner = Runner.create();
runner.isFixed = true
Engine.run(engine);
......
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