Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from lmssiehdev/master
Browse files Browse the repository at this point in the history
refactor(client): more cleanups
  • Loading branch information
leia-uwu authored Mar 11, 2024
2 parents 64983c8 + b986ed3 commit 09b36f5
Show file tree
Hide file tree
Showing 20 changed files with 1,936 additions and 1,839 deletions.
1 change: 0 additions & 1 deletion client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,6 @@ <h3 class='news-header'>What's New!</h3>
</div>
<div id="start-bottom-middle">
<a href='changelog.html' target="_blank" class="footer-after">ver 0.8.82</a>
<a href='proxy.txt' target="_blank" data-l10n='index-proxy-sites'>proxy sites</a>
</div>
<div id='start-bottom-right-wrapper'>
<div id='start-bottom-right'>
Expand Down
32 changes: 16 additions & 16 deletions client/src/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,44 @@ export class Camera {
return this.ppu * this.O;
}

pointToScreen(e) {
pointToScreen(point) {
return {
x:
this.screenWidth * 0.5 +
(e.x - this.pos.x) * this.z(),
(point.x - this.pos.x) * this.z(),
y:
this.screenHeight * 0.5 -
(e.y - this.pos.y) * this.z()
(point.y - this.pos.y) * this.z()
};
}

j(e) {
screenToPoint(screen) {
return {
x:
this.pos.x +
(e.x - this.screenWidth * 0.5) / this.z(),
(screen.x - this.screenWidth * 0.5) / this.z(),
y:
this.pos.y +
(this.screenHeight * 0.5 - e.y) / this.z()
(this.screenHeight * 0.5 - screen.y) / this.z()
};
}

pixels(e) {
return e * this.O;
pixels(p) {
return p * this.O;
}

scaleToScreen(e) {
return e * this.z();
scaleToScreen(s) {
return s * this.z();
}

setShakeEnabled(e) {
this.shakeEnabled = e;
setShakeEnabled(en) {
this.shakeEnabled = en;
}

addShake(e, t) {
const r = v2.length(v2.sub(this.pos, e));
const a = math.delerp(r, 40, 10) * t;
this.shakeInt = Math.max(this.shakeInt, a);
addShake(pos, intensity) {
const dist = v2.length(v2.sub(this.pos, pos));
const newInt = math.delerp(dist, 40, 10) * intensity;
this.shakeInt = Math.max(this.shakeInt, newInt);
}

applyShake() {
Expand Down
Loading

0 comments on commit 09b36f5

Please sign in to comment.