Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

die place on minimap #151

Open
wants to merge 1 commit into
base: modern
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion www/assets/js/main_out.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@
var mouseX = NaN;
var mouseY = NaN;
var mouseZ = 1;
var oldcameraX = null;
var oldcameraY = null;

var settings = {
mobile: "createTouch" in document,
Expand Down Expand Up @@ -770,6 +772,16 @@
mainCtx.arc(myPosX, myPosY, 5, 0, PI_2, false);
mainCtx.closePath();
mainCtx.fill();
// show the last place where player die in minimap (correct my english xD)
if (oldcameraX, oldcameraY) {
var myPosX1 = beginX + ((oldcameraX + border.width / 2) / border.width * width);
var myPosY1 = beginY + ((oldcameraY + border.height / 2) / border.height * height);
mainCtx.fillStyle = settings.darkTheme ? "#DDD" : "#222";
mainCtx.beginPath();
mainCtx.arc(myPosX1, myPosY1, 5, 0, PI_2, false);
mainCtx.closePath();
mainCtx.fill();
}

// draw name above user's pos if he has a cell on the screen
var cell = null;
Expand Down Expand Up @@ -912,7 +924,7 @@
destroy: function(killerId) {
delete cells.byId[this.id];
if (cells.mine.remove(this.id) && cells.mine.length === 0)
showESCOverlay();
showESCOverlay(), oldcameraX = cameraX, oldcameraY = cameraY; //save this current camera position so we know where he die
this.destroyed = true;
this.dead = syncUpdStamp;
if (killerId && !this.diedBy)
Expand Down