Skip to content

Commit

Permalink
add files
Browse files Browse the repository at this point in the history
  • Loading branch information
vanaigr committed Jul 11, 2024
1 parent 7f72408 commit 5dfe408
Show file tree
Hide file tree
Showing 173 changed files with 1,519 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/sprites/
/enemies.zip
Binary file added d3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,316 changes: 1,316 additions & 0 deletions data.js

Large diffs are not rendered by default.

120 changes: 120 additions & 0 deletions display.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
var minx = 1/0, maxx = -1/0, miny = 1/0, maxy = -1/0

var dedup = /^(.+?) [0-9]+/

var emenies = []
;(() => {
for(let i = 0; i < data.length; i++) {
let it = data[i]
if(it[2].startsWith('Cave')) continue;

it.hp = it[0]
it.xp = it[1]
it.name = it[2]
it.name_dedup = it.name.replace(dedup, "$1")
it.x = it[3]
it.y = it[4]
emenies.push(it)

minx = Math.min(minx, it.x)
maxx = Math.max(maxx, it.x)
miny = Math.min(miny, it.y)
maxy = Math.max(maxy, it.y)
}
})()

var view = document.getElementById('view')
var container = document.getElementById('cont')

var mx = (maxx - minx)
var my = (maxy - miny)
var mm = Math.max(mx, my)
var dd = 990 / mm

function cx(i) {
return 5 + (i - minx) * dd
}
function cy(i) {
return 5 + (maxy - i) * dd
}

function updSize(scale) {
document.body.style.setProperty('--size2', 10 / Math.max(scale, 5) + "px")
}

;(() => {
for(let i = 0; i < emenies.length; i++) {
let it = emenies[i]

var img = document.createElement('img')
img.src = 'sprites-dedup/' + it.name_dedup + '.png'
img.title = it.name + ' (' + it.hp + 'hp)';
img.draggable = "false"
// + ' (' + it.x + ', ' + it.y + ')';
let x = cx(it.x);
let y = cy(it.y);
img.style.left = x + 'px'
img.style.top = y + 'px'
img.classList.add('enemy')
if(x < 0 || x > 1000) console.log("x", x)
if(y < 0 || y > 1000) console.log("y", y)
view.appendChild(img)
}

var originX = 0, originY = 0;
var scale = 1;

container.addEventListener('wheel', (e) => {
e.preventDefault();
const rect = view.getBoundingClientRect();
const offsetX = originX + e.clientX - rect.left;
const offsetY = originY + e.clientY - rect.top;

const zoomFactor = 0.004;
var delta = 1 + Math.abs(e.deltaY) * -zoomFactor;
if(e.deltaY < 0) delta = 1 / delta

const newScale = Math.min(Math.max(0.2, scale * delta), 25);

const tx = offsetX + (originX - offsetX) * (newScale / scale)
const ty = offsetY + (originY - offsetY) * (newScale / scale)

scale = newScale;
originX = tx;
originY = ty;
view.style.transform = `matrix(${scale}, 0, 0, ${scale}, ${tx}, ${ty}`
updSize(scale)
});
updSize(scale)

let isPanning = false;
let prevX, prevY;

container.addEventListener('mousedown', (e) => {
isPanning = true;
prevX = e.clientX
prevY = e.clientY
});

container.addEventListener('mouseup', () => {
isPanning = false;
});

container.addEventListener('mousemove', (e) => {
if (isPanning) {
var curX = e.clientX
var curY = e.clientY

originX = originX + (curX - prevX)
originY = originY + (curY - prevY)

view.style.transform = `matrix(${scale}, 0, 0, ${scale}, ${originX}, ${originY}`
prevX = curX
prevY = curY
}
});

view.addEventListener('mouseleave', () => {
isPanning = false;
});
})()
54 changes: 54 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Enemies hp and xp</title>
<style>
#cont {
width: 100%;
height: 100%;
box-sizing: border-box;
overflow: hidden;
}
#view {
transform-origin: top left;
position: relative;
width: 1000px;
height: 1000px;
}
body {
--size2: 2px;
}
.enemy {
position: absolute;
width: calc(var(--size2) * 2);
height: calc(var(--size2) * 2);
transform: translate(calc(-1 * var(--size2)), calc(-1 * var(--size2)));
}
.overworld {
position: absolute;
top: -19px;
left: -9px;
transform-origin: top left;
transform: scale(0.3206); /*translate(-1580px, 430px);*/
}
.d3 {
position: absolute;
top: 135px;
left: 826px;
transform-origin: top left;
transform: scale(0.13);
}
</style>
</head>
<body>
<div id="cont">
<div id="view">
<img src="overworld.png" class="overworld" draggable="false">
<img src="d3.png" class="d3" draggable="false">
</div>
</div>

<script src="data.js"></script>
<script src="display.js"></script>
</body>
</html>
Binary file added overworld.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions sprite_dedup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import re
import json
import hashlib
import shutil

def remove(str):
pat = r'^(.+?) [0-9]+'
rep = r'\1'
return re.sub(pat, rep, str)


def calculate_file_hash(file_path):
md5_hash = hashlib.md5()
with open(file_path, "rb") as f:
for byte_block in iter(lambda: f.read(4096), b""):
md5_hash.update(byte_block)
return md5_hash.hexdigest()

hashes = {}

with open('data.js', 'r') as f:
data = json.load(f)
for item in data:
name = remove(item[2])
if name not in hashes:
hashes[name] = 0
shutil.copy("sprites/" + item[2] + ".png", 'sprites-dedup/' + name + '.png')
Binary file added sprites-dedup/Cave BloberT2 S2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave BusherT1 S2 Grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave CreeperT1 S1 Boosted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave CreeperT1 S1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave CreeperT1 S2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave CreeperT1 S3 Armored.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave CreeperT2 S1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave CreeperT2 S3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave CrosserT1 S1 Gamma.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave CrosserT1 S2 Solid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave DodgerT2 S1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave DodgerT3 S1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave DodgerT3 S2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave DoublerT1 S1 Bounce Aim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave DoublerT1 S1 Solid Bounce.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave DoublerT1 S1 Solid Static.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave FighterT1 S1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave FighterT1 S2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave FighterT1 S3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave FighterT2 S1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sprites-dedup/Cave FighterT3 S1.png
Binary file added sprites-dedup/Cave FighterT3 S3.png
Binary file added sprites-dedup/Cave Frogger T3 S3.png
Binary file added sprites-dedup/Cave JarrerT2 S1.png
Binary file added sprites-dedup/Cave JarrerT2 S2.png
Binary file added sprites-dedup/Cave Miniboss Blober T3 S3.png
Binary file added sprites-dedup/Cave PiercerT1 S1.png
Binary file added sprites-dedup/Cave PiercerT1 S2.png
Binary file added sprites-dedup/Cave PiercerT2 S1.png
Binary file added sprites-dedup/Cave PiercerT2 S3.png
Binary file added sprites-dedup/Cave ShooterT1 S1 Sniper.png
Binary file added sprites-dedup/Cave ShooterT1 S1 Solid Triple.png
Binary file added sprites-dedup/Cave ShooterT1 S2 Solid.png
Binary file added sprites-dedup/Cave Slider T3 S1.png
Binary file added sprites-dedup/Cave SneakerT1 S1.png
Binary file added sprites-dedup/Cave SpitterT3 S1.png
Binary file added sprites-dedup/Cave SpitterT3 S2.png
Binary file added sprites-dedup/Cave SpitterT3 S3.png
Binary file added sprites-dedup/Cave StrollerT1 S1.png
Binary file added sprites-dedup/Cave StrollerT1 S3.png
Binary file added sprites-dedup/Cave StrollerT3 S2.png
Binary file added sprites-dedup/Dungeon3 Boss3 T3 S3.png
Binary file added sprites-dedup/Dungeon3 CrosserT1 S2 Solid.png
Binary file added sprites-dedup/Dungeon3 FighterT1 S1.png
Binary file added sprites-dedup/Dungeon3 FighterT2 S1.png
Binary file added sprites-dedup/Dungeon3 FighterT3 S1.png
Binary file added sprites-dedup/Dungeon3 FisherT2 S1.png
Binary file added sprites-dedup/Dungeon3 FisherT2 S2.png
Binary file added sprites-dedup/Dungeon3 FisherT2 S3.png
Binary file added sprites-dedup/Dungeon3 FisherT3 S1.png
Binary file added sprites-dedup/Dungeon3 FisherT3 S2.png
Binary file added sprites-dedup/Dungeon3 FisherT3 S3.png
Binary file added sprites-dedup/Dungeon3 PiercerT3 S1.png
Binary file added sprites-dedup/Dungeon3 ShooterT2 S3.png
Binary file added sprites-dedup/Dungeon3 ShooterT3 S1 Sniper.png
Binary file added sprites-dedup/Dungeon3 Slider T3 S1.png
Binary file added sprites-dedup/Dungeon3 SpitterT2 S1.png
Binary file added sprites-dedup/Dungeon3 SpitterT2 S2.png
Binary file added sprites-dedup/Dungeon3 SpitterT3 S1.png
Binary file added sprites-dedup/Dungeon3 SpitterT3 S3.png
Binary file added sprites-dedup/Dungeon3 SquiderT2 S2.png
Binary file added sprites-dedup/Dungeon3 SquiderT3 S1.png
Binary file added sprites-dedup/Dungeon3 SquiderT3 S2.png
Binary file added sprites-dedup/Dungeon3 StrollerT2 S1.png
Binary file added sprites-dedup/Overworld BloberT3 S2 Crazy.png
Binary file added sprites-dedup/Overworld BusherT1 S2 Grid.png
Binary file added sprites-dedup/Overworld BusherT1 S2.png
Binary file added sprites-dedup/Overworld BusherT1 S3.png
Binary file added sprites-dedup/Overworld BusherT2 S2.png
Binary file added sprites-dedup/Overworld BusherT2 S3.png
Binary file added sprites-dedup/Overworld CreeperT1 S1 Boosted.png
Binary file added sprites-dedup/Overworld CreeperT1 S1.png
Binary file added sprites-dedup/Overworld CreeperT1 S3.png
Binary file added sprites-dedup/Overworld CreeperT2 S1 Crazy.png
Binary file added sprites-dedup/Overworld CreeperT2 S1.png
Binary file added sprites-dedup/Overworld CreeperT2 S2.png
Binary file added sprites-dedup/Overworld CreeperT2 S3 Crazy.png
Binary file added sprites-dedup/Overworld CreeperT2 S3 Giant.png
Binary file added sprites-dedup/Overworld CreeperT2 S3.png
Binary file added sprites-dedup/Overworld CreeperT3 S3 Giant.png
Binary file added sprites-dedup/Overworld CreeperT3 S3.png
Binary file added sprites-dedup/Overworld CrosserT1 S2 Gamma.png
Binary file added sprites-dedup/Overworld CrosserT1 S2 Solid.png
Binary file added sprites-dedup/Overworld CrosserT2 S3 Gamma.png
Binary file added sprites-dedup/Overworld CrosserT3 S2 Gamma.png
Binary file added sprites-dedup/Overworld DodgerT1 S1.png
Binary file added sprites-dedup/Overworld DodgerT1 S2.png
Binary file added sprites-dedup/Overworld DodgerT1 S3.png
Binary file added sprites-dedup/Overworld DodgerT2 S1.png
Binary file added sprites-dedup/Overworld DodgerT2 S3.png
Binary file added sprites-dedup/Overworld FighterT1 S1.png
Binary file added sprites-dedup/Overworld FighterT1 S2.png
Binary file added sprites-dedup/Overworld FighterT2 S1.png
Binary file added sprites-dedup/Overworld FighterT2 S2.png
Binary file added sprites-dedup/Overworld FighterT3 S1.png
Binary file added sprites-dedup/Overworld FisherT1 S2.png
Binary file added sprites-dedup/Overworld Frogger T1 S2.png
Binary file added sprites-dedup/Overworld Frogger T2 S2.png
Binary file added sprites-dedup/Overworld Frogger T3 S2.png
Binary file added sprites-dedup/Overworld Frogger T3 S3.png
Binary file added sprites-dedup/Overworld JarrerT2 S1.png
Binary file added sprites-dedup/Overworld JarrerT2 S2.png
Binary file added sprites-dedup/Overworld JarrerT2 S3.png
Binary file added sprites-dedup/Overworld JunkerT3 S2.png
Binary file added sprites-dedup/Overworld JunkerT3 S3.png
Binary file added sprites-dedup/Overworld Miniboss Busher T1 S3.png
Binary file added sprites-dedup/Overworld Miniboss Snaker T1 S3.png
Binary file added sprites-dedup/Overworld PiercerT1 S1.png
Binary file added sprites-dedup/Overworld PiercerT2 S1.png
Binary file added sprites-dedup/Overworld PiercerT2 S2.png
Binary file added sprites-dedup/Overworld PiercerT2 S3.png
Binary file added sprites-dedup/Overworld PiercerT3 S1.png
Binary file added sprites-dedup/Overworld ShooterT1 S1 Sniper.png
Binary file added sprites-dedup/Overworld ShooterT1 S1 Solid.png
Binary file added sprites-dedup/Overworld ShooterT1 S1.png
Binary file added sprites-dedup/Overworld ShooterT1 S2 Solid.png
Binary file added sprites-dedup/Overworld ShooterT1 S2.png
Binary file added sprites-dedup/Overworld ShooterT1 S3.png
Binary file added sprites-dedup/Overworld ShooterT2 S1 Sniper.png
Binary file added sprites-dedup/Overworld ShooterT2 S1.png
Binary file added sprites-dedup/Overworld ShooterT2 S2.png
Binary file added sprites-dedup/Overworld ShooterT2 S3.png
Binary file added sprites-dedup/Overworld ShooterT3 S2 Sniper.png
Binary file added sprites-dedup/Overworld ShooterT3 S2.png
Binary file added sprites-dedup/Overworld ShooterT3 S3.png
Binary file added sprites-dedup/Overworld Slider T3 S1.png
Binary file added sprites-dedup/Overworld SneakerT1 S1.png
Binary file added sprites-dedup/Overworld SneakerT1 S3.png
Binary file added sprites-dedup/Overworld SneakerT2 S1.png
Binary file added sprites-dedup/Overworld SneakerT2 S2.png
Binary file added sprites-dedup/Overworld SneakerT2 S3.png
Binary file added sprites-dedup/Overworld SneakerT3 S1.png
Binary file added sprites-dedup/Overworld SneakerT3 S2.png
Binary file added sprites-dedup/Overworld SpitterT1 S1.png
Binary file added sprites-dedup/Overworld SpitterT2 S1.png
Binary file added sprites-dedup/Overworld SpitterT2 S2.png
Binary file added sprites-dedup/Overworld SpitterT3 S1.png
Binary file added sprites-dedup/Overworld SpitterT3 S3.png
Binary file added sprites-dedup/Overworld SquiderT1 S1.png
Binary file added sprites-dedup/Overworld SquiderT1 S2.png
Binary file added sprites-dedup/Overworld SquiderT2 S1.png
Binary file added sprites-dedup/Overworld SquiderT2 S2.png
Binary file added sprites-dedup/Overworld SquiderT3 S1.png
Binary file added sprites-dedup/Overworld StrollerT1 S1.png
Binary file added sprites-dedup/Overworld StrollerT1 S2.png
Binary file added sprites-dedup/Overworld StrollerT1 S3.png
Binary file added sprites-dedup/Overworld StrollerT2 S1.png
Binary file added sprites-dedup/Overworld StrollerT2 S2.png
Binary file added sprites-dedup/Overworld StrollerT2 S3.png
Binary file added sprites-dedup/Overworld StrollerT3 S1.png
Binary file added sprites-dedup/Overworld StrollerT3 S2.png
Binary file added sprites-dedup/Overworld TimberT2 S3.png

0 comments on commit 5dfe408

Please sign in to comment.