Merge branch 'main' of https://github.com/R74nCom/sandboxels
This commit is contained in:
commit
ac9128f4b9
|
|
@ -14,6 +14,7 @@
|
|||
"machines":"機器",
|
||||
"special":"特別",
|
||||
"other":"別徳",
|
||||
"states":"狀態",
|
||||
"heat":"加熱",
|
||||
"cool":"冷卻",
|
||||
"erase":"擦",
|
||||
|
|
@ -549,5 +550,11 @@
|
|||
"rice":"米",
|
||||
"galvanized_steel":"鍍鋅鋼",
|
||||
"midas_touch":"點石成金",
|
||||
"liquid_ozone":"液臭氧"
|
||||
"liquid_ozone":"液臭氧",
|
||||
"ectoplasm":"外質",
|
||||
"soul":"鬼",
|
||||
"tombstone":"墳墓",
|
||||
"spider":"蜘蛛",
|
||||
"web":"蜘蛛網"
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ function updateStatsNew() {
|
|||
if (pixelMap[mousePos.x] != undefined) {
|
||||
var currentPixel = pixelMap[mousePos.x][mousePos.y];
|
||||
if (currentPixel != undefined) {
|
||||
stats += "<span id='stat-element' class='stat'>Elem:" + (elements[currentPixel.element].name || currentPixel.element).toUpperCase() + "</span>";
|
||||
stats += "<span id='stat-element' class='stat'>Elem:" + (elements[currentPixel.element].name || currentPixel.element).toString().toUpperCase() + "</span>";
|
||||
stats += "<span id='stat-temperature' class='stat'>Temp:" + formatTemp(currentPixel.temp) + "</span>";
|
||||
if (currentPixel.charge) {
|
||||
stats += "<span id='stat-charge' class='stat'>C" + currentPixel.charge + "</span>";
|
||||
|
|
@ -49,7 +49,7 @@ function updateStatsNew() {
|
|||
}
|
||||
// If the view is not null, show the view in all caps
|
||||
if (view != null) {
|
||||
stats += "<span id='stat-view' class='stat'>" + viewKey[view].toUpperCase() + "</span>";
|
||||
stats += "<span id='stat-view' class='stat'>" + viewKey[view].toString().toUpperCase() + "</span>";
|
||||
}
|
||||
statsDiv.innerHTML = stats;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
const styleElement = document.createElement('style');
|
||||
styleElement.innerHTML = `
|
||||
.tooltip {
|
||||
z-index: 1000;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tooltip .tooltiptext {
|
||||
visibility: hidden;
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
padding: 0.5em;
|
||||
border-radius: 0.5em;
|
||||
position: absolute;
|
||||
z-index: 1000;
|
||||
bottom: 100%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
pointer-events: none;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
.tooltip:hover .tooltiptext {
|
||||
visibility: visible;
|
||||
}
|
||||
`
|
||||
|
||||
document.head.appendChild(styleElement);
|
||||
|
||||
runAfterLoad(async () => {
|
||||
const data = await fetch('mods/chemFormulas.json').then((res) => res.json());
|
||||
for (const element in data) {
|
||||
if (elements[element]) {
|
||||
elements[element].hoverStat = () => data[element].length > 1 ? "Multiple compounds" : data[element][0].replace(/\<\/?su[bp]\>/g, "");
|
||||
document.querySelector(`button[element='${element}']`)?.classList.add('tooltip');
|
||||
const span = document.createElement('span');
|
||||
span.classList.add('tooltiptext');
|
||||
span.innerHTML = data[element].join("<br>");
|
||||
document.querySelector(`button[element='${element}']`)?.appendChild(span);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,241 @@
|
|||
{
|
||||
"sand": ["SiO<sub>2</sub>"],
|
||||
"dirt": ["Organic matter"],
|
||||
"mud": ["H<sub>2</sub>O", "Organic matter"],
|
||||
"wet_sand": ["SiO<sub>2</sub>", "H<sub>2</sub>O"],
|
||||
"rock": ["SiO<sub>2</sub>"],
|
||||
"rock_wall": ["SiO<sub>2</sub>"],
|
||||
"mudstone": ["SiO<sub>2</sub>", "H<sub>2</sub>O", "Organic matter"],
|
||||
"packed_sand": ["SiO<sub>2</sub>"],
|
||||
"snow": ["H<sub>2</sub>O"],
|
||||
"packed_snow": ["H<sub>2</sub>O"],
|
||||
"gravel": ["SiO<sub>2</sub>"],
|
||||
"clay": ["Al<sub>2</sub>Si<sub>2</sub>O<sub>5</sub>(OH)<sub>4</sub>", "H<sub>2</sub>O"],
|
||||
"clay_soil": ["Al<sub>2</sub>Si<sub>2</sub>O<sub>5</sub>(OH)<sub>4</sub>", "H<sub>2</sub>O", "Organic matter"],
|
||||
"permafrost": ["Organic matter", "SiO<sub>2</sub>", "H<sub>2</sub>O"],
|
||||
"mycelium": ["Organic matter"],
|
||||
"mulch": ["Organic matter"],
|
||||
"basalt": ["SiO<sub>2</sub>", "FeO", "CaO"],
|
||||
"tuff": ["SiO<sub>2</sub>", "Al<sub>2</sub>O<sub>3</sub>", "CaO", "K<sub>2</sub>O"],
|
||||
"limestone": ["CaCO<sub>3</sub>"],
|
||||
"quicklime": ["CaO"],
|
||||
"slaked_lime": ["Ca(OH)<sub>2</sub>"],
|
||||
"water": ["H<sub>2</sub>O"],
|
||||
"salt_water": ["H<sub>2</sub>O", "NaCl"],
|
||||
"sugar_water": ["H<sub>2</sub>O", "C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>"],
|
||||
"seltzer": ["H<sub>2</sub>O", "CO<sub>2</sub>"],
|
||||
"dirty_water": ["H<sub>2</sub>O", "Impurities"],
|
||||
"pool_water": ["H<sub>2</sub>O", "Cl<sub>2</sub>"],
|
||||
"slush": ["H<sub>2</sub>O"],
|
||||
"magma": ["SiO<sub>2</sub>", "FeO", "CaO"],
|
||||
"slime": ["H<sub>2</sub>O", "Organic matter"],
|
||||
"cement": ["CaO", "SiO<sub>2</sub>", "Al<sub>2</sub>O<sub>3</sub>"],
|
||||
"oil": ["C<sub>5</sub>H<sub>12</sub>", "C<sub>6</sub>H<sub>14</sub>", "C<sub>7</sub>H<sub>16</sub>", "C<sub>8</sub>H<sub>18</sub>", "C<sub>9</sub>H<sub>20</sub>", "C<sub>10</sub>H<sub>22</sub>", "C<sub>11</sub>H<sub>24</sub>", "C<sub>12</sub>H<sub>26</sub>"],
|
||||
"lamp_oil": ["C<sub>12</sub>H<sub>26</sub>", "C<sub>13</sub>H<sub>28</sub>", "C<sub>14</sub>H<sub>30</sub>", "C<sub>15</sub>H<sub>32</sub>", "C<sub>16</sub>H<sub>34</sub>"],
|
||||
"acid": ["HCl"],
|
||||
"neutral_acid": ["H<sub>2</sub>O", "HCl"],
|
||||
"glue": ["C<sub>4</sub>H<sub>6</sub>O<sub>2</sub>"],
|
||||
"soda": ["H<sub>2</sub>O", "C<sub>6</sub>H<sub>12</sub>O<sub>6</sub>", "CO<sub>2</sub>"],
|
||||
"melted_wax": ["C<sub>25</sub>H<sub>52</sub>"],
|
||||
"vinegar": ["H<sub>2</sub>O", "C<sub>2</sub>H<sub>4</sub>O<sub>2</sub>"],
|
||||
"alcohol": ["C<sub>2</sub>H<sub>5</sub>OH"],
|
||||
"soap": ["C<sub>17</sub>H<sub>35</sub>COONa"],
|
||||
"bleach": ["NaClO"],
|
||||
"mercury": ["Hg"],
|
||||
"tea": ["H<sub>2</sub>O", "C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>"],
|
||||
"coffee": ["H<sub>2</sub>O", "C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>"],
|
||||
"honey": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>"],
|
||||
"sap": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>"],
|
||||
"caramel": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>"],
|
||||
"molasses": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>"],
|
||||
"liquid_oxygen": ["O<sub>2</sub>"],
|
||||
"liquid_nitrogen": ["N<sub>2</sub>"],
|
||||
"cyanide": ["CN"],
|
||||
"concrete": ["CaO", "SiO<sub>2</sub>", "Al<sub>2</sub>O<sub>3</sub>"],
|
||||
"ash": ["SiO<sub>2</sub>", "CaO", "K<sub>2</sub>O"],
|
||||
"charcoal": ["C"],
|
||||
"hail": ["H<sub>2</sub>O"],
|
||||
"wax": ["C<sub>25</sub>H<sub>52</sub>"],
|
||||
"sodium": ["Na"],
|
||||
"calcium": ["Ca"],
|
||||
"potassium": ["K"],
|
||||
"magnesium": ["Mg"],
|
||||
"thermite": ["Al", "Fe<sub>2</sub>O<sub>3</sub>"],
|
||||
"slag": ["CaSiO<sub>3</sub>"],
|
||||
"amalgam": ["Hg", "Ag"],
|
||||
"sulfur": ["S"],
|
||||
"copper_sulfate": ["CuSO<sub>4</sub>"],
|
||||
"uranium": ["U"],
|
||||
"diamond": ["C"],
|
||||
"gold coin": ["Au"],
|
||||
"rust": ["Fe<sub>2</sub>O<sub>3</sub>"],
|
||||
"oxidized_copper": ["CuO"],
|
||||
"alga": ["AlGa"],
|
||||
"glass_shard": ["SiO<sub>2</sub>"],
|
||||
"rad_shard": ["SiO<sub>2</sub>", "U"],
|
||||
"color_sand": ["SiO<sub>2</sub>", "Fe<sub>2</sub>O<sub>3</sub>"],
|
||||
"borax": ["Na<sub>2</sub>B<sub>4</sub>O<sub>7</sub>"],
|
||||
"epsom_salt": ["MgSO<sub>4</sub>"],
|
||||
"potassium_salt": ["KCl"],
|
||||
"caustic_potash": ["KOH"],
|
||||
"sodium_acetate": ["NaC<sub>2</sub>H<sub>3</sub>O<sub>2</sub>"],
|
||||
"ice": ["H<sub>2</sub>O"],
|
||||
"rime": ["H<sub>2</sub>O"],
|
||||
"glass": ["SiO<sub>2</sub>"],
|
||||
"rad_glass": ["SiO<sub>2</sub>", "U"],
|
||||
"stained_glass": ["SiO<sub>2</sub>", "Metal oxides"],
|
||||
"plastic": ["(C<sub>8</sub>H<sub>8</sub>)<sub>n</sub>", "(C<sub>4</sub>H<sub>6</sub>)<sub>n</sub>", "(C<sub>3</sub>H<sub>3</sub>N)<sub>n</sub>"],
|
||||
"iron": ["Fe"],
|
||||
"copper": ["Cu"],
|
||||
"gold": ["Au"],
|
||||
"steel": ["Fe", "C"],
|
||||
"galvanized_steel": ["Fe", "Zn"],
|
||||
"zinc": ["Zn"],
|
||||
"silver": ["Ag"],
|
||||
"tin": ["Sn"],
|
||||
"lead": ["Pb"],
|
||||
"nickel": ["Ni"],
|
||||
"aluminum": ["Al"],
|
||||
"tungsten": ["W"],
|
||||
"brass": ["Cu", "Zn"],
|
||||
"bronze": ["Cu", "Sn"],
|
||||
"sterling": ["Ag", "Cu"],
|
||||
"gallium": ["Ga"],
|
||||
"rose_gold": ["Au", "Cu"],
|
||||
"purple_gold": ["Au", "Al"],
|
||||
"blue_gold": ["Au", "Ga"],
|
||||
"electrum": ["Au", "Ag"],
|
||||
"pyrite": ["FeS<sub>2</sub>"],
|
||||
"solder": ["Sn", "Pb"],
|
||||
"dry ice": ["CO<sub>2</sub>"],
|
||||
"nitrogen_ice": ["N<sub>2</sub>"],
|
||||
"light": ["γ"],
|
||||
"liquid_light": ["γ"],
|
||||
"laser": ["γ"],
|
||||
"radiation": ["α", "β", "γ"],
|
||||
"neutron": ["n"],
|
||||
"proton": ["p"],
|
||||
"electric": ["e<sup>-</sup>"],
|
||||
"lightning": ["e<sup>-</sup>"],
|
||||
"positron": ["e<sup>+</sup>"],
|
||||
"flash": ["γ"],
|
||||
"tnt": ["C<sub>7</sub>H<sub>5</sub>N<sub>3</sub>O<sub>6</sub>"],
|
||||
"c4": ["C<sub>3</sub>H<sub>6</sub>N<sub>6</sub>O<sub>6</sub>"],
|
||||
"dynamite": ["C<sub>3</sub>H<sub>5</sub>N<sub>3</sub>O<sub>9</sub>"],
|
||||
"gunpowder": ["KNO<sub>3</sub>", "S", "C"],
|
||||
"nitro": ["C<sub>3</sub>H<sub>5</sub>N<sub>3</sub>O<sub>9</sub>"],
|
||||
"steam": ["H<sub>2</sub>O"],
|
||||
"hydrogen": ["H<sub>2</sub>"],
|
||||
"oxygen": ["O<sub>2</sub>"],
|
||||
"nitrogen": ["N<sub>2</sub>"],
|
||||
"helium": ["He"],
|
||||
"anesthesia": ["N<sub>2</sub>O"],
|
||||
"carbon_dioxide": ["CO<sub>2</sub>"],
|
||||
"bubble": ["CO<sub>2</sub>"],
|
||||
"ammonia": ["NH<sub>3</sub>"],
|
||||
"propane": ["C<sub>3</sub>H<sub>8</sub>"],
|
||||
"methane": ["CH<sub>4</sub>"],
|
||||
"acid_gas": ["HCl"],
|
||||
"dioxin": ["C<sub>4</sub>H<sub>4</sub>O<sub>2</sub>"],
|
||||
"chlorine": ["Cl<sub>2</sub>"],
|
||||
"neon": ["Ne"],
|
||||
"smog": ["CO<sub>2</sub>", "CO", "NO<sub>2</sub>", "O<sub>3</sub>"],
|
||||
"cyanide_gas": ["HCN"],
|
||||
"ozone": ["O<sub>3</sub>"],
|
||||
"rad_steam": ["H<sub>2</sub>O", "U"],
|
||||
"salt": ["NaCl"],
|
||||
"sugar": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>"],
|
||||
"chocolate": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>", "C<sub>7</sub>H<sub>8</sub>N<sub>4</sub>O<sub>2</sub>", "C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>", "C<sub>18</sub>H<sub>36</sub>O<sub>2</sub>", "C<sub>16</sub>H<sub>32</sub>O<sub>2</sub>"],
|
||||
"baking_soda": ["NaHCO<sub>3</sub>"],
|
||||
"antipowder": ["Ry<sub>2</sub>O<sub>3</sub>"],
|
||||
"antimolten": ["Ry<sub>2</sub>O<sub>3</sub>"],
|
||||
"antiice": ["Ry<sub>7</sub>O<sub>12</sub>"],
|
||||
"antifluid": ["Ry<sub>7</sub>O<sub>12</sub>"],
|
||||
"antigas": ["Ry<sub>7</sub>O<sub>12</sub>"],
|
||||
"molten_glass": ["SiO<sub>2</sub>"],
|
||||
"molten_rad_glass": ["SiO<sub>2</sub>", "U"],
|
||||
"molten_salt": ["NaCl"],
|
||||
"molten_ash": ["SiO<sub>2</sub>", "CaO", "K<sub>2</sub>O"],
|
||||
"liquid_ammonia": ["NH<sub>3</sub>"],
|
||||
"liquid_propane": ["C<sub>3</sub>H<sub>8</sub>"],
|
||||
"liquid_methane": ["CH<sub>4</sub>"],
|
||||
"molten_stained_glass": ["SiO<sub>2</sub>", "Metal oxides"],
|
||||
"molten_plastic": ["(C<sub>8</sub>H<sub>8</sub>)<sub>n</sub>", "(C<sub>4</sub>H<sub>6</sub>)<sub>n</sub>", "(C<sub>3</sub>H<sub>3</sub>N)<sub>n</sub>"],
|
||||
"molten_tungsten": ["W"],
|
||||
"molten_gallium": ["Ga"],
|
||||
"gallium_gas": ["Ga"],
|
||||
"molten_copper": ["Cu"],
|
||||
"molten_copper_sulfate": ["CuSO<sub>4</sub>"],
|
||||
"molten_gold": ["Au"],
|
||||
"molten_silver": ["Ag"],
|
||||
"molten_iron": ["Fe"],
|
||||
"molten_nickel": ["Ni"],
|
||||
"molten_tin": ["Sn"],
|
||||
"molent_lead": ["Pb"],
|
||||
"molten_solder": ["Sn", "Pb"],
|
||||
"alcohol_gas": ["C<sub>2</sub>H<sub>5</sub>OH"],
|
||||
"molten_tuff": ["SiO<sub>2</sub>", "Al<sub>2</sub>O<sub>3</sub>", "CaO", "K<sub>2</sub>O"],
|
||||
"liquid_chlorine": ["Cl<sub>2</sub>"],
|
||||
"mercury_gas": ["Hg"],
|
||||
"solid_mercury": ["Hg"],
|
||||
"fat": ["C<sub>55</sub>H<sub>98</sub>O<sub>6</sub>"],
|
||||
"molten_chocolate": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>", "C<sub>7</sub>H<sub>8</sub>N<sub>4</sub>O<sub>2</sub>", "C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>", "C<sub>18</sub>H<sub>36</sub>O<sub>2</sub>", "C<sub>16</sub>H<sub>32</sub>O<sub>2</sub>"],
|
||||
"liquid_hydrogen": ["H<sub>2</sub>"],
|
||||
"liquid_helium": ["He"],
|
||||
"molten_sodium": ["Na"],
|
||||
"sodium_gas": ["Na"],
|
||||
"molten_calcium": ["Ca"],
|
||||
"molten_potassium": ["K"],
|
||||
"potassium_gas": ["K"],
|
||||
"molten_magnesium": ["Mg"],
|
||||
"molten_thermite": ["Al", "Fe<sub>2</sub>O<sub>3</sub>"],
|
||||
"molten_aluminum": ["Al"],
|
||||
"molten_zinc": ["Zn"],
|
||||
"liquid_neon": ["Ne"],
|
||||
"liquid_ozone": ["O<sub>3</sub>"],
|
||||
"molten_sulfur": ["S"],
|
||||
"sulfur_gas": ["S"],
|
||||
"molten_uranium": ["U"],
|
||||
"molten_slag": ["CaSiO<sub>3</sub>"],
|
||||
"molten_dirt": ["Organic matter"],
|
||||
"salt_ice": ["NaCl", "H<sub>2</sub>O"],
|
||||
"sugar_ice": ["C<sub>12</sub>H<sub>22</sub>O<sub>11</sub>", "H<sub>2</sub>O"],
|
||||
"seltzer_ice": ["H<sub>2</sub>O", "CO<sub>2</sub>"],
|
||||
"dirty_ice": ["H<sub>2</sub>O", "Impurities"],
|
||||
"pool_ice": ["H<sub>2</sub>O", "Cl<sub>2</sub>"],
|
||||
"antiice_ice": ["Ry<sub>2</sub>O"],
|
||||
"ammonia_ice": ["NH<sub>3</sub>"],
|
||||
"propane_ice": ["C<sub>3</sub>H<sub>8</sub>"],
|
||||
"methane_ice": ["CH<sub>4</sub>"],
|
||||
"acid_ice": ["HCl"],
|
||||
"soda_ice": ["H<sub>2</sub>O", "C<sub>6</sub>H<sub>12</sub>O<sub>6</sub>", "CO<sub>2</sub>"],
|
||||
"molten_steel": ["Fe", "C"],
|
||||
"molten_galvanized_steel": ["Fe", "Zn"],
|
||||
"molten_brass": ["Cu", "Zn"],
|
||||
"molten_bronze": ["Cu", "Sn"],
|
||||
"molten_sterling": ["Ag", "Cu"],
|
||||
"molten_rose_gold": ["Au", "Cu"],
|
||||
"molten_purple_gold": ["Au", "Al"],
|
||||
"molten_blue_gold": ["Au", "Ga"],
|
||||
"molten_electrum": ["Au", "Ag"],
|
||||
"molten_pyrite": ["FeS<sub>2</sub>"],
|
||||
"frozen_vinegar": ["H<sub>2</sub>O", "C<sub>2</sub>H<sub>4</sub>O<sub>2</sub>"],
|
||||
"alcohol_ice": ["C<sub>2</sub>H<sub>5</sub>OH"],
|
||||
"bleach_ice": ["NaClO"],
|
||||
"chlorine_ice": ["Cl<sub>2</sub>"],
|
||||
"tea_ice": ["H<sub>2</sub>O", "C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>"],
|
||||
"coffee_ice": ["H<sub>2</sub>O", "C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>"],
|
||||
"hydrogen_ice": ["H<sub>2</sub>"],
|
||||
"oxygen_ice": ["O<sub>2</sub>"],
|
||||
"molten_amalgam": ["Hg", "Ag"],
|
||||
"neon_ice": ["Ne"],
|
||||
"cyanide_ice": ["CN"],
|
||||
"slime_ice": ["H<sub>2</sub>O", "Organic matter"],
|
||||
"molten_alga": ["AlGa"],
|
||||
"molten_borax": ["Na<sub>2</sub>B<sub>4</sub>O<sub>7</sub>"],
|
||||
"molten_epsom_salt": ["MgSO<sub>4</sub>"],
|
||||
"molten_potassium_salt": ["KCl"],
|
||||
"molten_caustic_potash": ["KOH"],
|
||||
"molten_sodium_acetate": ["NaC<sub>2</sub>H<sub>3</sub>O<sub>2</sub>"],
|
||||
"frozen_nitro": ["C<sub>3</sub>H<sub>5</sub>N<sub>3</sub>O<sub>9</sub>"]
|
||||
}
|
||||
|
|
@ -106,7 +106,7 @@ elements.frozen_xenon = {
|
|||
elements.radon = {
|
||||
color: elements.neon.color,
|
||||
behavior: behaviors.GAS,
|
||||
colorOn: ["#d33d7c","#f73273","#c03190"],
|
||||
colorOn: ["#3dd3cb","#32f7e7","#31c0a8"],
|
||||
category: "gases",
|
||||
state: "gas",
|
||||
conduct: 0.8,
|
||||
|
|
@ -156,7 +156,7 @@ elements.radon = {
|
|||
elements.liquid_radon = {
|
||||
color: elements.neon.color,
|
||||
behavior: behaviors.LIQUID,
|
||||
colorOn: ["#d33d7c","#f73273","#c03190"],
|
||||
colorOn: ["#3dd3cb","#32f7e7","#31c0a8"],
|
||||
category: "states",
|
||||
state: "liquid",
|
||||
tempHigh: -58,
|
||||
|
|
@ -170,7 +170,7 @@ elements.liquid_radon = {
|
|||
elements.frozen_radon = {
|
||||
color: elements.neon.color,
|
||||
behavior: behaviors.WALL,
|
||||
colorOn: ["#d33d7c","#f73273","#c03190"],
|
||||
colorOn: ["#3dd3cb","#32f7e7","#31c0a8"],
|
||||
category: "states",
|
||||
state: "solid",
|
||||
tempHigh: -68,
|
||||
|
|
@ -182,7 +182,7 @@ elements.frozen_radon = {
|
|||
elements.oganesson = {
|
||||
color: elements.neon.color,
|
||||
behavior: behaviors.GAS,
|
||||
colorOn: ["#5bdce6","#56a9f7","#56b0e4"],
|
||||
colorOn: ["#b5e65b","#b9f756","#aee456"],
|
||||
category: "gases",
|
||||
state: "gas",
|
||||
conduct: 0.8,
|
||||
|
|
|
|||
335
mods/scenexe.js
335
mods/scenexe.js
|
|
@ -1,3 +1,11 @@
|
|||
/*
|
||||
____ _
|
||||
| _ \ __ _| |_ __ _
|
||||
| | | |/ _` | __/ _` |
|
||||
| |_| | (_| | || (_| |
|
||||
|____/ \__,_|\__\__,_|
|
||||
|
||||
*/
|
||||
polygonColors = function(sides){
|
||||
let baseColors = [
|
||||
/*
|
||||
|
|
@ -33,6 +41,68 @@ polygonColors = function(sides){
|
|||
return "rgb(0, 0, 0)"
|
||||
}
|
||||
}
|
||||
const usefulMiscColors = {
|
||||
playerBlue: "rgb(0, 176, 225)",
|
||||
barrelGray: "rgb(153, 153, 153)",
|
||||
playerGreen: "rgb(0, 224, 108)",
|
||||
playerRed: "rgb(240, 79, 84)",
|
||||
playerPurple: "rgb(216, 43, 207)",
|
||||
bodyGray: "rgb(95, 103, 108)",
|
||||
fallenGray: "rgb(192, 192, 192)",
|
||||
celestialPink: "rgb(237, 110, 222)"
|
||||
}
|
||||
const upgrades = {
|
||||
weapons: {
|
||||
annihilator: [
|
||||
{
|
||||
theta: 0,
|
||||
damage: 150,
|
||||
reload: 1,
|
||||
angle: 0,
|
||||
spread: 0,
|
||||
yoffset: 0,
|
||||
xoffset: 0,
|
||||
length: 1.9,
|
||||
width: 1,
|
||||
type: 0,
|
||||
bulletHealth: 60
|
||||
}
|
||||
],
|
||||
twin: [
|
||||
{
|
||||
theta: 0,
|
||||
damage: 150,
|
||||
reload: 1,
|
||||
angle: 0,
|
||||
spread: 0,
|
||||
yoffset: 0,
|
||||
xoffset: 0.5,
|
||||
length: 1.8,
|
||||
width: 0.45,
|
||||
type: 0,
|
||||
bulletHealth: 60
|
||||
},
|
||||
{
|
||||
theta: 0,
|
||||
damage: 150,
|
||||
reload: 1,
|
||||
angle: 0,
|
||||
spread: 0,
|
||||
yoffset: 0,
|
||||
xoffset: -0.5,
|
||||
length: 1.8,
|
||||
width: 0.45,
|
||||
type: 0,
|
||||
bulletHealth: 60
|
||||
}
|
||||
]
|
||||
},
|
||||
bodies: {
|
||||
|
||||
}
|
||||
}
|
||||
polygonList = []
|
||||
zoomLevel = 0.5
|
||||
isKeyDown = {
|
||||
w: false,
|
||||
a: false,
|
||||
|
|
@ -41,6 +111,66 @@ isKeyDown = {
|
|||
i: false,
|
||||
o: false
|
||||
}
|
||||
let mouseX = 0;
|
||||
let mouseY = 0;
|
||||
camera = [0, 0]
|
||||
scenexeplayer = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
facing: 0,
|
||||
vx: 0,
|
||||
vy: 0,
|
||||
level: 1,
|
||||
rotation: 0,
|
||||
radius: 40,
|
||||
collisionMass: 520,
|
||||
type: 1,
|
||||
bodyDamage: 5,
|
||||
maxHealth: 10000,
|
||||
health: 10000,
|
||||
regenDelay: 14,
|
||||
regenSpeed: 0.0001,
|
||||
timeSinceHurt: null,
|
||||
color: usefulMiscColors.playerBlue,
|
||||
barrels: [
|
||||
{
|
||||
theta: 0,
|
||||
damage: 150,
|
||||
reload: 1,
|
||||
angle: 0,
|
||||
spread: 0,
|
||||
yoffset: 0,
|
||||
xoffset: 0.5,
|
||||
length: 1.8,
|
||||
width: 0.45,
|
||||
type: 0,
|
||||
bulletHealth: 60
|
||||
},
|
||||
{
|
||||
theta: 0,
|
||||
damage: 150,
|
||||
reload: 1,
|
||||
angle: 0,
|
||||
spread: 0,
|
||||
yoffset: 0,
|
||||
xoffset: -0.5,
|
||||
length: 1.8,
|
||||
width: 0.45,
|
||||
type: 0,
|
||||
bulletHealth: 60
|
||||
}
|
||||
]
|
||||
}
|
||||
bullets = []
|
||||
debug = false
|
||||
/*
|
||||
_____ _ _
|
||||
| ___| _ _ __ ___| |_(_) ___ _ __ ___
|
||||
| |_ | | | | '_ \ / __| __| |/ _ \| '_ \/ __|
|
||||
| _|| |_| | | | | (__| |_| | (_) | | | \__ \
|
||||
|_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
|
||||
|
||||
*/
|
||||
function HSVtoRGB(h, s, v) {
|
||||
var r, g, b, i, f, p, q, t;
|
||||
if (arguments.length === 1) {
|
||||
|
|
@ -112,6 +242,13 @@ function makeVisible(color){
|
|||
colorObject.b = Math.max(40, colorObject.b)
|
||||
return objectToColor(colorObject)
|
||||
}
|
||||
function darkenPercent(color, percent){
|
||||
let colorObject = colorToObject(color)
|
||||
colorObject.r = Math.floor(colorObject.r * percent)
|
||||
colorObject.g = Math.floor(colorObject.g * percent)
|
||||
colorObject.b = Math.floor(colorObject.b * percent)
|
||||
return objectToColor(colorObject)
|
||||
}
|
||||
// when wasd keydown, set isKeyDown to true
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (event.key === "w") {
|
||||
|
|
@ -161,6 +298,18 @@ document.addEventListener("keyup", (event) => {
|
|||
}
|
||||
}
|
||||
})
|
||||
document.addEventListener("mousemove", (event) => {
|
||||
let rect = canvas.getBoundingClientRect();
|
||||
mouseX = event.clientX - rect.left;
|
||||
mouseY = event.clientY - rect.top;
|
||||
});
|
||||
let mouseDown = false;
|
||||
document.addEventListener("mousedown", (event) => {
|
||||
mouseDown = true;
|
||||
});
|
||||
document.addEventListener("mouseup", (event) => {
|
||||
mouseDown = false;
|
||||
});
|
||||
orbitalSpeed = function(sides){
|
||||
return 1/(1.00672*Math.pow(0.344151, sides) + 0.000002)
|
||||
}
|
||||
|
|
@ -210,8 +359,6 @@ function polygonCount(random){
|
|||
}
|
||||
}
|
||||
}
|
||||
polygonList = []
|
||||
zoomLevel = 0.5
|
||||
function newPolygon(sides){
|
||||
polygonList.push({
|
||||
sides: sides,
|
||||
|
|
@ -236,12 +383,8 @@ function newPolygon(sides){
|
|||
polygonSize = function(sides){
|
||||
return 18 * Math.pow(1.47, sides - 3)
|
||||
}
|
||||
for (var i = 0; i <= 400; i++){
|
||||
sides = polygonCount(Math.random())
|
||||
newPolygon(sides)
|
||||
}
|
||||
function drawPolygon(ctx, polygon, index){
|
||||
if (Math.abs(polygonList[index].x-camera[0]-polygon.radius<canvas.width/zoomLevel) && Math.abs(polygonList[index].y-camera[1])-polygon.radius<canvas.height/zoomLevel){
|
||||
if (Math.abs(polygonList[index].x-camera[0])-polygonList[index].radius<canvas.width/zoomLevel && Math.abs(polygonList[index].y-camera[1])-polygonList[index].radius<canvas.height/zoomLevel){
|
||||
let x = polygon.x
|
||||
let y = polygon.y
|
||||
let sides = polygon.sides
|
||||
|
|
@ -255,9 +398,9 @@ function drawPolygon(ctx, polygon, index){
|
|||
ctx.strokeStyle = darkenColor(polygonColors(sides))
|
||||
ctx.lineWidth = 5*zoomLevel
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(Math.sin(rotation)*radius+x, Math.cos(rotation)*radius+y)
|
||||
ctx.moveTo(Math.cos(rotation)*radius+x, Math.sin(rotation)*radius+y)
|
||||
for (var i = 0; i <= sides+1; i++){
|
||||
ctx.lineTo(Math.sin(rotation+2*Math.PI*i/sides)*radius+x, Math.cos(rotation+2*Math.PI*i/sides)*radius+y)
|
||||
ctx.lineTo(Math.cos(rotation+2*Math.PI*i/sides)*radius+x, Math.sin(rotation+2*Math.PI*i/sides)*radius+y)
|
||||
}
|
||||
ctx.fill()
|
||||
ctx.stroke()
|
||||
|
|
@ -270,10 +413,15 @@ function drawPolygon(ctx, polygon, index){
|
|||
ctx.moveTo(x-radius, y+radius+(10*zoomLevel))
|
||||
ctx.lineTo(x+radius, y+radius+(10*zoomLevel))
|
||||
ctx.stroke()
|
||||
ctx.strokeStyle = makeVisible(polygonColors(sides))
|
||||
ctx.strokeStyle = darkenPercent(polygonColors(sides), 0.4)
|
||||
ctx.lineWidth = 4*zoomLevel
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(x-radius, y+radius+(10*zoomLevel))
|
||||
ctx.lineTo(x+radius, y+radius+(10*zoomLevel))
|
||||
ctx.stroke()
|
||||
ctx.strokeStyle = makeVisible(polygonColors(sides))
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(x-radius, y+radius+(10*zoomLevel))
|
||||
ctx.lineTo(x-radius+(radius*2*hppercent), y+radius+(10*zoomLevel))
|
||||
//console.log(hppercent)
|
||||
ctx.stroke()
|
||||
|
|
@ -284,7 +432,7 @@ function drawPolygon(ctx, polygon, index){
|
|||
if(debug){
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(x, y)
|
||||
ctx.lineTo(Math.sin(rotation)*2*radius+x, Math.cos(rotation)*2*radius+y)
|
||||
ctx.lineTo(Math.cos(rotation)*2*radius+x, Math.sin(rotation)*2*radius+y)
|
||||
ctx.strokeStyle = "rgb(0, 0, 255)"
|
||||
ctx.stroke()
|
||||
// draw a line to represent velocity
|
||||
|
|
@ -297,7 +445,6 @@ function drawPolygon(ctx, polygon, index){
|
|||
ctx.lineWidth = 10*zoomLevel
|
||||
ctx.fillStyle = "rgb(255, 255, 255)"
|
||||
ctx.strokeStyle = "rgb(0, 0, 0)"
|
||||
ctx.font = `bold ${zoomLevel*30}px Helvetica`
|
||||
//ctx.strokeText(Math.round(polygon.collisionMass), x, y)
|
||||
//ctx.fillText(Math.round(polygon.collisionMass), x, y)
|
||||
// draw text on healthbar
|
||||
|
|
@ -308,10 +455,92 @@ function drawPolygon(ctx, polygon, index){
|
|||
}
|
||||
}
|
||||
}
|
||||
debug = false
|
||||
function rotatePoint(point, angle) {
|
||||
let x = point.x;
|
||||
let y = point.y;
|
||||
return {
|
||||
x: Math.cos(angle) * x - Math.sin(angle) * y,
|
||||
y: Math.sin(angle) * x + Math.cos(angle) * y
|
||||
};
|
||||
}
|
||||
function addPoint(point1, point2){
|
||||
return {
|
||||
x: point1.x + point2.x,
|
||||
y: point1.y + point2.y
|
||||
}
|
||||
}
|
||||
function drawBullet(ctx, bullet){
|
||||
let x = bullet.x
|
||||
let y = bullet.y
|
||||
let radius = bullet.radius
|
||||
let rotation = bullet.rotation
|
||||
ctx.fillStyle = scenexeplayer.color
|
||||
ctx.strokeStyle = darkenColor(usefulMiscColors.playerBlue)
|
||||
ctx.lineWidth = 5*zoomLevel
|
||||
ctx.beginPath()
|
||||
ctx.arc(x, y, radius, 0, 2*Math.PI)
|
||||
ctx.fill()
|
||||
ctx.stroke()
|
||||
}
|
||||
function drawPlayer(ctx, player){
|
||||
ctx.fillStyle = "rgb(0, 176, 225)"
|
||||
ctx.strokeStyle = darkenColor("rgb(0, 176, 225)")
|
||||
let x = player.x
|
||||
let y = player.y
|
||||
let radius = player.radius
|
||||
// draw barrels
|
||||
for (barrel of player.barrels){
|
||||
if (barrel.type == 0){ // rectangular barrel
|
||||
ctx.fillStyle = usefulMiscColors.barrelGray
|
||||
ctx.strokeStyle = darkenColor(usefulMiscColors.barrelGray)
|
||||
ctx.lineWidth = 5*zoomLevel
|
||||
let playerPoint = {
|
||||
x: player.x,
|
||||
y: player.y
|
||||
}
|
||||
let barrelPoints = [
|
||||
{
|
||||
x: -(barrel.width*player.radius)+(barrel.xoffset*player.radius),
|
||||
y: barrel.yoffset*player.radius
|
||||
},
|
||||
{
|
||||
x: (barrel.width*player.radius)+(barrel.xoffset*player.radius),
|
||||
y: barrel.yoffset*player.radius
|
||||
},
|
||||
{
|
||||
x: (barrel.width*player.radius)+(barrel.xoffset*player.radius),
|
||||
y: barrel.yoffset*player.radius+player.radius*barrel.length
|
||||
},
|
||||
{
|
||||
x: -(barrel.width*player.radius)+(barrel.xoffset*player.radius),
|
||||
y: barrel.yoffset*player.radius+player.radius*barrel.length
|
||||
}
|
||||
]
|
||||
//console.log(barrelPoints)
|
||||
let barrelPointsRotated = [
|
||||
rotatePoint(barrelPoints[0], player.rotation-2*Math.PI/4+barrel.theta+barrel.angle),
|
||||
rotatePoint(barrelPoints[1], player.rotation-2*Math.PI/4+barrel.theta+barrel.angle),
|
||||
rotatePoint(barrelPoints[2], player.rotation-2*Math.PI/4+barrel.theta+barrel.angle),
|
||||
rotatePoint(barrelPoints[3], player.rotation-2*Math.PI/4+barrel.theta+barrel.angle)
|
||||
]
|
||||
//console.log(barrelPointsRotated)
|
||||
let barrelPointsTranslated = [
|
||||
addPoint(barrelPointsRotated[0], playerPoint),
|
||||
addPoint(barrelPointsRotated[1], playerPoint),
|
||||
addPoint(barrelPointsRotated[2], playerPoint),
|
||||
addPoint(barrelPointsRotated[3], playerPoint)
|
||||
]
|
||||
//console.log(barrelPointsTranslated)
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(barrelPointsTranslated[0].x, barrelPointsTranslated[0].y)
|
||||
ctx.lineTo(barrelPointsTranslated[1].x, barrelPointsTranslated[1].y)
|
||||
ctx.lineTo(barrelPointsTranslated[2].x, barrelPointsTranslated[2].y)
|
||||
ctx.lineTo(barrelPointsTranslated[3].x, barrelPointsTranslated[3].y)
|
||||
ctx.lineTo(barrelPointsTranslated[0].x, barrelPointsTranslated[0].y)
|
||||
ctx.fill()
|
||||
ctx.stroke()
|
||||
}
|
||||
}
|
||||
ctx.fillStyle = player.color
|
||||
ctx.strokeStyle = darkenColor(player.color)
|
||||
ctx.lineWidth = 5*zoomLevel
|
||||
ctx.beginPath()
|
||||
ctx.arc(player.x, player.y, player.radius, 0, 2*Math.PI)
|
||||
|
|
@ -326,10 +555,15 @@ function drawPlayer(ctx, player){
|
|||
ctx.moveTo(player.x-player.radius, player.y+player.radius+(10*zoomLevel))
|
||||
ctx.lineTo(player.x+player.radius, player.y+player.radius+(10*zoomLevel))
|
||||
ctx.stroke()
|
||||
ctx.strokeStyle = makeVisible("rgb(0, 176, 225)")
|
||||
ctx.strokeStyle = darkenPercent(player.color, 0.4)
|
||||
ctx.lineWidth = 4*zoomLevel
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(player.x-player.radius, player.y+player.radius+(10*zoomLevel))
|
||||
ctx.lineTo(player.x+player.radius, player.y+player.radius+(10*zoomLevel))
|
||||
ctx.stroke()
|
||||
ctx.strokeStyle = makeVisible(player.color)
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(player.x-player.radius, player.y+player.radius+(10*zoomLevel))
|
||||
ctx.lineTo(player.x-player.radius+(player.radius*2*player.health/player.maxHealth), player.y+player.radius+(10*zoomLevel))
|
||||
ctx.stroke()
|
||||
}
|
||||
|
|
@ -338,7 +572,7 @@ function drawPlayer(ctx, player){
|
|||
// draw a line to represent angle
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(player.x, player.y)
|
||||
ctx.lineTo(Math.sin(player.rotation)*2*player.radius+player.x, Math.cos(player.rotation)*2*player.radius+player.y)
|
||||
ctx.lineTo(Math.cos(player.rotation)*2*player.radius+player.x, Math.sin(player.rotation)*2*player.radius+player.y)
|
||||
ctx.strokeStyle = "rgb(0, 0, 255)"
|
||||
ctx.stroke()
|
||||
// draw a line
|
||||
|
|
@ -352,9 +586,8 @@ function drawPlayer(ctx, player){
|
|||
ctx.lineWidth = 10*zoomLevel
|
||||
ctx.fillStyle = "rgb(255, 255, 255)"
|
||||
ctx.strokeStyle = "rgb(0, 0, 0)"
|
||||
ctx.font = `bold ${zoomLevel*30}px Helvetica`
|
||||
ctx.strokeText(Math.round(player.collisionMass), player.x, player.y)
|
||||
ctx.fillText(Math.round(player.collisionMass), player.x, player.y)
|
||||
ctx.strokeText(`${Math.round(player.collisionMass)}`, player.x, player.y)
|
||||
ctx.fillText(`${Math.round(player.collisionMass)}`, player.x, player.y)
|
||||
// draw text on healthbar
|
||||
ctx.strokeText(Math.round(player.health)+"/"+Math.round(player.maxHealth), player.x, player.y+player.radius+(10*zoomLevel))
|
||||
ctx.fillText(Math.round(player.health)+"/"+Math.round(player.maxHealth), player.x, player.y+player.radius+(10*zoomLevel))
|
||||
|
|
@ -382,26 +615,24 @@ function cameraZoom(ctx, object, multiplier, camera){
|
|||
objectreturn.radius = objectreturn.radius * multiplier
|
||||
return objectreturn
|
||||
}
|
||||
camera = [0, 0]
|
||||
scenexeplayer = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
vx: 0,
|
||||
vy: 0,
|
||||
rotation: 0,
|
||||
radius: 40,
|
||||
collisionMass: 520,
|
||||
type: 1,
|
||||
bodyDamage: 5,
|
||||
maxHealth: 10000,
|
||||
health: 10000,
|
||||
regenDelay: 14,
|
||||
regenSpeed: 0.0001,
|
||||
timeSinceHurt: null
|
||||
}
|
||||
keybinds["KeyI"] = function(){}
|
||||
keybinds["KeyM"] = function(){}
|
||||
renderPostPixel(function(ctx){
|
||||
/*
|
||||
____ ___ _ _ _ _ _ _
|
||||
/ ___| __ _ _ __ ___ ___ |_ _|_ __ (_) |_ __ _| (_)______ _| |_(_) ___ _ __
|
||||
| | _ / _` | '_ ` _ \ / _ \ | || '_ \| | __/ _` | | |_ / _` | __| |/ _ \| '_ \
|
||||
| |_| | (_| | | | | | | __/ | || | | | | || (_| | | |/ / (_| | |_| | (_) | | | |
|
||||
\____|\__,_|_| |_| |_|\___| |___|_| |_|_|\__\__,_|_|_/___\__,_|\__|_|\___/|_| |_|
|
||||
|
||||
*/
|
||||
for (var i = 0; i <= 400; i++){
|
||||
sides = polygonCount(Math.random())
|
||||
newPolygon(sides)
|
||||
}
|
||||
setInterval(function(){
|
||||
if (ctx === null){return}
|
||||
window.clearInterval(tickInterval)
|
||||
window.clearInterval(renderInterval)
|
||||
clearLayers()
|
||||
if (pixelMap){pixelMap = [], currentPixels = [], paused = true}
|
||||
ctx.fillStyle = "rgb(205, 205, 205)"
|
||||
|
|
@ -445,8 +676,8 @@ renderPostPixel(function(ctx){
|
|||
//calculate angle of collision
|
||||
angle = Math.atan2(polygon2.y - polygon1.y, polygon2.x - polygon1.x)
|
||||
// update velocity
|
||||
polygon1.vx -= (Math.cos(angle) * (polygon1.radius + polygon2.radius - distance)/2)/(polygon1.collisionMass/polygon2.collisionMass**(1/2.5))
|
||||
polygon1.vy -= (Math.sin(angle) * (polygon1.radius + polygon2.radius - distance)/2)/(polygon1.collisionMass/polygon2.collisionMass**(1/2.5))
|
||||
polygon1.vx -= (Math.cos(angle) * (polygon1.radius + polygon2.radius - distance)/2)/Math.max(polygon1.collisionMass/polygon2.collisionMass**(1/2.5), 1/7)
|
||||
polygon1.vy -= (Math.sin(angle) * (polygon1.radius + polygon2.radius - distance)/2)/Math.max(polygon1.collisionMass/polygon2.collisionMass**(1/2.5), 1/7)
|
||||
if (polygon2.type != polygon1.type){
|
||||
polygon1.health -= polygon2.bodyDamage
|
||||
polygon1.timeSinceHurt = 0
|
||||
|
|
@ -475,8 +706,8 @@ renderPostPixel(function(ctx){
|
|||
let polygon = polygonList[poly]
|
||||
polygon.rotation += 1/orbitalSpeed(polygon.sides)
|
||||
// add some velocity towards wherever its facing
|
||||
polygon.vx += Math.sin(polygon.rotation)/orbitalSpeed(polygon.sides)*8
|
||||
polygon.vy += Math.cos(polygon.rotation)/orbitalSpeed(polygon.sides)*8
|
||||
polygon.vx += Math.sin(polygon.rotation)/orbitalSpeed(polygon.sides)*8*(polygon.random < 0.5 ? -1 : 1)
|
||||
polygon.vy += Math.cos(polygon.rotation)/orbitalSpeed(polygon.sides)*8*(polygon.random < 0.5 ? -1 : 1)
|
||||
if (polygon.health <= 0){
|
||||
polygonList.splice(poly, 1)
|
||||
}
|
||||
|
|
@ -514,8 +745,26 @@ renderPostPixel(function(ctx){
|
|||
}
|
||||
if (isKeyDown.i){
|
||||
zoomLevel += 0.02
|
||||
ctx.font = `bold ${zoomLevel*30}px Helvetica`
|
||||
}
|
||||
if (isKeyDown.o){
|
||||
zoomLevel -= 0.02
|
||||
if (zoomLevel < 0.02){
|
||||
zoomLevel = 0.02
|
||||
}
|
||||
ctx.font = `bold ${zoomLevel*30}px Helvetica`
|
||||
}
|
||||
})
|
||||
// angle player towards mouse
|
||||
scenexeplayer.rotation = Math.atan2(mouseY - canvas.height/2, mouseX - canvas.width/2)
|
||||
// if mouse down make barrels shoot bullets out
|
||||
if (mouseDown){
|
||||
for (barrel of scenexeplayer.barrels){
|
||||
// first, calculate angle of barrel
|
||||
let angle = Math.atan2(mouseY - canvas.height/2, mouseX - canvas.width/2)
|
||||
angle += barrel.theta + barrel.angle
|
||||
// calculate point of origin within barrel and rotate/translate accordingly
|
||||
|
||||
}
|
||||
}
|
||||
scenexeplayer.radius = (59.99*Math.pow(1.00972, scenexeplayer.level))/2
|
||||
}, 1000/60)
|
||||
Loading…
Reference in New Issue