Deletions missed by previous commits
This commit is contained in:
parent
190a995167
commit
97b0946c06
268
LD46.html
268
LD46.html
|
@ -1,268 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' lang='' xml:lang=''>
|
||||
<head>
|
||||
<meta charset='utf-8' />
|
||||
<meta name='viewport' content='width=device-width, user-scalable=no' />
|
||||
<link id='-gd-engine-icon' rel='icon' type='image/png' href='favicon.png' />
|
||||
<title></title>
|
||||
<style type='text/css'>
|
||||
|
||||
body {
|
||||
touch-action: none;
|
||||
margin: 0;
|
||||
border: 0 none;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
#canvas {
|
||||
display: block;
|
||||
margin: 0;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#canvas:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.godot {
|
||||
font-family: 'Noto Sans', 'Droid Sans', Arial, sans-serif;
|
||||
color: #e0e0e0;
|
||||
background-color: #3b3943;
|
||||
background-image: linear-gradient(to bottom, #403e48, #35333c);
|
||||
border: 1px solid #45434e;
|
||||
box-shadow: 0 0 1px 1px #2f2d35;
|
||||
}
|
||||
|
||||
|
||||
/* Status display
|
||||
* ============== */
|
||||
|
||||
#status {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
/* don't consume click events - make children visible explicitly */
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#status-progress {
|
||||
width: 366px;
|
||||
height: 7px;
|
||||
background-color: #38363A;
|
||||
border: 1px solid #444246;
|
||||
padding: 1px;
|
||||
box-shadow: 0 0 2px 1px #1B1C22;
|
||||
border-radius: 2px;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
@media only screen and (orientation:portrait) {
|
||||
#status-progress {
|
||||
width: 61.8%;
|
||||
}
|
||||
}
|
||||
|
||||
#status-progress-inner {
|
||||
height: 100%;
|
||||
width: 0;
|
||||
box-sizing: border-box;
|
||||
transition: width 0.5s linear;
|
||||
background-color: #202020;
|
||||
border: 1px solid #222223;
|
||||
box-shadow: 0 0 1px 1px #27282E;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#status-indeterminate {
|
||||
visibility: visible;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#status-indeterminate > div {
|
||||
width: 4.5px;
|
||||
height: 0;
|
||||
border-style: solid;
|
||||
border-width: 9px 3px 0 3px;
|
||||
border-color: #2b2b2b transparent transparent transparent;
|
||||
transform-origin: center 21px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#status-indeterminate > div:nth-child(1) { transform: rotate( 22.5deg); }
|
||||
#status-indeterminate > div:nth-child(2) { transform: rotate( 67.5deg); }
|
||||
#status-indeterminate > div:nth-child(3) { transform: rotate(112.5deg); }
|
||||
#status-indeterminate > div:nth-child(4) { transform: rotate(157.5deg); }
|
||||
#status-indeterminate > div:nth-child(5) { transform: rotate(202.5deg); }
|
||||
#status-indeterminate > div:nth-child(6) { transform: rotate(247.5deg); }
|
||||
#status-indeterminate > div:nth-child(7) { transform: rotate(292.5deg); }
|
||||
#status-indeterminate > div:nth-child(8) { transform: rotate(337.5deg); }
|
||||
|
||||
#status-notice {
|
||||
margin: 0 100px;
|
||||
line-height: 1.3;
|
||||
visibility: visible;
|
||||
padding: 4px 6px;
|
||||
visibility: visible;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<canvas id='canvas'>
|
||||
HTML5 canvas appears to be unsupported in the current browser.<br />
|
||||
Please try updating or use a different browser.
|
||||
</canvas>
|
||||
<div id='status'>
|
||||
<div id='status-progress' style='display: none;' oncontextmenu='event.preventDefault();'><div id ='status-progress-inner'></div></div>
|
||||
<div id='status-indeterminate' style='display: none;' oncontextmenu='event.preventDefault();'>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
<div id='status-notice' class='godot' style='display: none;'></div>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='LD46.js'></script>
|
||||
<script type='text/javascript'>//<![CDATA[
|
||||
|
||||
var engine = new Engine;
|
||||
var setStatusMode;
|
||||
var setStatusNotice;
|
||||
|
||||
(function() {
|
||||
|
||||
const EXECUTABLE_NAME = 'LD46';
|
||||
const MAIN_PACK = 'LD46.pck';
|
||||
const INDETERMINATE_STATUS_STEP_MS = 100;
|
||||
|
||||
var canvas = document.getElementById('canvas');
|
||||
var statusProgress = document.getElementById('status-progress');
|
||||
var statusProgressInner = document.getElementById('status-progress-inner');
|
||||
var statusIndeterminate = document.getElementById('status-indeterminate');
|
||||
var statusNotice = document.getElementById('status-notice');
|
||||
|
||||
var initializing = true;
|
||||
var statusMode = 'hidden';
|
||||
|
||||
var animationCallbacks = [];
|
||||
function animate(time) {
|
||||
animationCallbacks.forEach(callback => callback(time));
|
||||
requestAnimationFrame(animate);
|
||||
}
|
||||
requestAnimationFrame(animate);
|
||||
|
||||
function adjustCanvasDimensions() {
|
||||
var scale = window.devicePixelRatio || 1;
|
||||
var width = window.innerWidth;
|
||||
var height = window.innerHeight;
|
||||
canvas.width = width * scale;
|
||||
canvas.height = height * scale;
|
||||
canvas.style.width = width + "px";
|
||||
canvas.style.height = height + "px";
|
||||
}
|
||||
animationCallbacks.push(adjustCanvasDimensions);
|
||||
adjustCanvasDimensions();
|
||||
|
||||
setStatusMode = function setStatusMode(mode) {
|
||||
|
||||
if (statusMode === mode || !initializing)
|
||||
return;
|
||||
[statusProgress, statusIndeterminate, statusNotice].forEach(elem => {
|
||||
elem.style.display = 'none';
|
||||
});
|
||||
animationCallbacks = animationCallbacks.filter(function(value) {
|
||||
return (value != animateStatusIndeterminate);
|
||||
});
|
||||
switch (mode) {
|
||||
case 'progress':
|
||||
statusProgress.style.display = 'block';
|
||||
break;
|
||||
case 'indeterminate':
|
||||
statusIndeterminate.style.display = 'block';
|
||||
animationCallbacks.push(animateStatusIndeterminate);
|
||||
break;
|
||||
case 'notice':
|
||||
statusNotice.style.display = 'block';
|
||||
break;
|
||||
case 'hidden':
|
||||
break;
|
||||
default:
|
||||
throw new Error('Invalid status mode');
|
||||
}
|
||||
statusMode = mode;
|
||||
}
|
||||
|
||||
function animateStatusIndeterminate(ms) {
|
||||
|
||||
var i = Math.floor(ms / INDETERMINATE_STATUS_STEP_MS % 8);
|
||||
if (statusIndeterminate.children[i].style.borderTopColor == '') {
|
||||
Array.prototype.slice.call(statusIndeterminate.children).forEach(child => {
|
||||
child.style.borderTopColor = '';
|
||||
});
|
||||
statusIndeterminate.children[i].style.borderTopColor = '#dfdfdf';
|
||||
}
|
||||
}
|
||||
|
||||
setStatusNotice = function setStatusNotice(text) {
|
||||
|
||||
while (statusNotice.lastChild) {
|
||||
statusNotice.removeChild(statusNotice.lastChild);
|
||||
}
|
||||
var lines = text.split('\n');
|
||||
lines.forEach((line) => {
|
||||
statusNotice.appendChild(document.createTextNode(line));
|
||||
statusNotice.appendChild(document.createElement('br'));
|
||||
});
|
||||
};
|
||||
|
||||
engine.setProgressFunc((current, total) => {
|
||||
|
||||
if (total > 0) {
|
||||
statusProgressInner.style.width = current/total * 100 + '%';
|
||||
setStatusMode('progress');
|
||||
if (current === total) {
|
||||
// wait for progress bar animation
|
||||
setTimeout(() => {
|
||||
setStatusMode('indeterminate');
|
||||
}, 500);
|
||||
}
|
||||
} else {
|
||||
setStatusMode('indeterminate');
|
||||
}
|
||||
});
|
||||
|
||||
function displayFailureNotice(err) {
|
||||
var msg = err.message || err;
|
||||
console.error(msg);
|
||||
setStatusNotice(msg);
|
||||
setStatusMode('notice');
|
||||
initializing = false;
|
||||
};
|
||||
|
||||
if (!Engine.isWebGLAvailable()) {
|
||||
displayFailureNotice('WebGL not available');
|
||||
} else {
|
||||
setStatusMode('indeterminate');
|
||||
engine.setCanvas(canvas);
|
||||
engine.startGame(EXECUTABLE_NAME, MAIN_PACK).then(() => {
|
||||
setStatusMode('hidden');
|
||||
initializing = false;
|
||||
}, displayFailureNotice);
|
||||
}
|
||||
})();
|
||||
//]]></script>
|
||||
</body>
|
||||
</html>
|
||||
|
BIN
favicon.png
BIN
favicon.png
Binary file not shown.
Before Width: | Height: | Size: 3.2 KiB |
|
@ -1,34 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/favicon.png-05a5f25b7b35b567a640a7daf7751a8e.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://favicon.png"
|
||||
dest_files=[ "res://.import/favicon.png-05a5f25b7b35b567a640a7daf7751a8e.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
46
item.gd
46
item.gd
|
@ -1,46 +0,0 @@
|
|||
extends Sprite
|
||||
|
||||
var held = false
|
||||
onready var beltmap = $"../BeltTiles"
|
||||
|
||||
var dir_vectors = [Vector2(1,0), Vector2(0,-1), Vector2(-1,0), Vector2(0,1)]
|
||||
|
||||
export var cx := 5 # offset for edge feet
|
||||
export var cy := 5 # offset for edge feet
|
||||
onready var foot_vectors = [Vector2(0,0), Vector2(cx,cy), Vector2(cx,-cy), Vector2(-cx,-cy), Vector2(-cx,cy)]
|
||||
var foot_weights = [3, 1, 1, 1, 1]
|
||||
var total_weight = 7
|
||||
#var stuck_vec = null
|
||||
#var stuck_dir = -1 # For going off the end of belts
|
||||
|
||||
|
||||
func get_belt_direction(tx, ty):
|
||||
var xflip = beltmap.is_cell_x_flipped(tx, ty)
|
||||
var tp = beltmap.is_cell_transposed(tx, ty)
|
||||
return int(tp) + int(xflip)*2
|
||||
|
||||
func get_belt_rect(vec):
|
||||
var origin = beltmap.map_to_world(vec)
|
||||
return Rect2(to_local(origin), Vector2(8, 8))
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
var belt_speed = delta * 8
|
||||
|
||||
var direction = Vector2(0, 0)
|
||||
for i in len(foot_vectors):
|
||||
var vec = beltmap.world_to_map(position + foot_vectors[i].rotated(rotation))
|
||||
if beltmap.get_cell(vec.x, vec.y) >= 0:
|
||||
direction += dir_vectors[get_belt_direction(vec.x, vec.y)] * foot_weights[i]
|
||||
position += direction/total_weight * belt_speed
|
||||
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseButton:
|
||||
if not event.pressed:
|
||||
held = false
|
||||
elif get_rect().has_point(to_local(event.position)):
|
||||
held = true
|
||||
elif event is InputEventMouseMotion:
|
||||
if held:
|
||||
position += event.relative
|
|
@ -1,84 +0,0 @@
|
|||
extends KinematicBody2D
|
||||
|
||||
|
||||
var held = false
|
||||
var grabbed_vector = null
|
||||
onready var beltmap = $"../BeltTiles"
|
||||
|
||||
var dir_vectors = [Vector2(1,0), Vector2(0,-1), Vector2(-1,0), Vector2(0,1)]
|
||||
|
||||
const max_speed := 200
|
||||
export var rungs := 13
|
||||
export var cx := 2.0 # offset for edge feet
|
||||
export var cy := 5.0 # offset for edge feet
|
||||
var foot_vectors
|
||||
var foot_weights
|
||||
var total_weight
|
||||
#var stuck_vec = null
|
||||
#var stuck_dir = -1 # For going off the end of belts
|
||||
|
||||
func _ready():
|
||||
total_weight = 1 + rungs*4
|
||||
foot_vectors = [Vector2(0, 0)]
|
||||
foot_weights = [3]
|
||||
for i in rungs:
|
||||
foot_vectors.append(Vector2(cx*(i+1), cy))
|
||||
foot_vectors.append(Vector2(-cx*(i+1), cy))
|
||||
foot_vectors.append(Vector2(cx*(i+1), -cy))
|
||||
foot_vectors.append(Vector2(-cx*(i+1), -cy))
|
||||
foot_weights.append(1)
|
||||
foot_weights.append(1)
|
||||
foot_weights.append(1)
|
||||
foot_weights.append(1)
|
||||
|
||||
func get_belt_direction(tx, ty):
|
||||
var xflip = beltmap.is_cell_x_flipped(tx, ty)
|
||||
var tp = beltmap.is_cell_transposed(tx, ty)
|
||||
return int(tp) + int(xflip)*2
|
||||
|
||||
func get_belt_rect(vec):
|
||||
var origin = beltmap.map_to_world(vec)
|
||||
return Rect2(to_local(origin), Vector2(8, 8))
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _physics_process(delta):
|
||||
var belt_speed = 8
|
||||
|
||||
var direction = Vector2(0, 0)
|
||||
for i in len(foot_vectors):
|
||||
var vec = beltmap.world_to_map(position + foot_vectors[i].rotated(rotation))
|
||||
if beltmap.get_cell(vec.x, vec.y) >= 0:
|
||||
direction += dir_vectors[get_belt_direction(vec.x, vec.y)] * foot_weights[i]
|
||||
direction /= total_weight*0.5
|
||||
direction.x = clamp(direction.x, -1, 1)
|
||||
direction.y = clamp(direction.y, -1, 1)
|
||||
move_and_slide(direction * belt_speed)
|
||||
|
||||
if held: # Cursor drag code
|
||||
var ggv = to_global(grabbed_vector)
|
||||
var dv = get_global_mouse_position() - ggv
|
||||
var dvn = dv.normalized()
|
||||
var dvm = dv.length()
|
||||
var velo = dvn * min(dvm*dvm, max_speed)
|
||||
# move_and_slide(dvn * min(dvm*dvm, max_speed)) # Simple movement
|
||||
var collision = move_and_collide(velo*delta)
|
||||
if collision and collision.remainder.length_squared()>0:
|
||||
if collision.collider is KinematicBody2D:
|
||||
var col2 = collision.collider.move_and_collide(collision.remainder)
|
||||
if col2 and col2.remainder.length_squared()>0:
|
||||
if col2.collider is KinematicBody2D:
|
||||
col2.collider.move_and_collide(col2.remainder)
|
||||
collision.collider.move_and_collide(col2.remainder)
|
||||
move_and_collide(col2.remainder)
|
||||
move_and_collide(collision.remainder)
|
||||
else:
|
||||
move_and_collide(collision.remainder.slide(collision.normal))
|
||||
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseButton:
|
||||
if not event.pressed:
|
||||
held = false
|
||||
elif $sprite.get_rect().has_point(to_local(event.position)):
|
||||
held = true
|
||||
grabbed_vector = to_local(event.position)
|
Loading…
Reference in New Issue