Removed Stuff

This commit is contained in:
2025-10-29 16:48:03 -05:00
parent ab79e95734
commit e6daabf16d

View File

@ -2,7 +2,6 @@ let images = {};
let simulator = []; let simulator = [];
let maxSpeed = 1; let maxSpeed = 1;
let backgroundImage; let backgroundImage;
let worldScale;
let LEFT = [-1,0]; let LEFT = [-1,0];
const entityTypes = Object.freeze({ const entityTypes = Object.freeze({
@ -69,18 +68,18 @@ function createEntity(x, y, vx, vy, ax, ay, rot, rotv, type, id=0, iframes=Math.
} }
}else{ }else{
simulator.push({ simulator.push({
x: x, x: x,
y: y, y: y,
ax: ax, ax: ax,
ay: ay, ay: ay,
vx: vx, vx: vx,
vy: vy, vy: vy,
rot: rot, rot: rot,
rotv: rotv, rotv: rotv,
mass: getMass(type), mass: getMass(type),
forcex: 0.0, forcex: 0.0,
forcey: 0.0, forcey: 0.0,
type: type, type: type,
show: true, show: true,
ueid: id, ueid: id,
iframes: iframes iframes: iframes
@ -103,11 +102,11 @@ function getRandomType(){
function physicsUpdate(entity){ function physicsUpdate(entity){
if (entity.show){ if (entity.show){
entity.vx += entity.ax; entity.vx += entity.ax;
entity.vy += entity.ay; entity.vy += entity.ay;
entity.x += entity.vx; entity.x += entity.vx;
entity.y += entity.vy; entity.y += entity.vy;
entity.rot += entity.rotv; entity.rot += entity.rotv;
if (entity.iframes > 0) entity.iframes -= 1; if (entity.iframes > 0) entity.iframes -= 1;
if (entity.iframes == 0) simulator.forEach((other_entity) =>{ if (entity.iframes == 0) simulator.forEach((other_entity) =>{
checkCollision(entity, other_entity); checkCollision(entity, other_entity);
@ -129,11 +128,11 @@ function checkCollision(entity1, entity2){
line(entity1.x,entity1.y, entity2.x, entity2.y); line(entity1.x,entity1.y, entity2.x, entity2.y);
console.log("Collision at", entity1.x, entity1.y, entity1.iframes, entity2.x, entity2.y, dist); console.log("Collision at", entity1.x, entity1.y, entity1.iframes, entity2.x, entity2.y, dist);
} }
Explode(entity1); Explode(entity1);
Explode(entity2); Explode(entity2);
} }
} }
} }
function Explode(entity){ function Explode(entity){
if(entity.type == entityTypes.METERORITE_SMALL){ if(entity.type == entityTypes.METERORITE_SMALL){
@ -163,16 +162,16 @@ function drawBackground(refImage){
function drawEntity(entity){ function drawEntity(entity){
if (entity.show){ if (entity.show){
push(); push();
imageMode(CENTER); imageMode(CENTER);
translate(entity.x, entity.y, 0); translate(entity.x, entity.y, 0);
if (entity.type == entityTypes.COMET){ if (entity.type == entityTypes.COMET){
rotate((Math.atan2(entity.vx, entity.vy) - Math.atan2(-1,0)) * 180/Math.PI); rotate((Math.atan2(entity.vx, entity.vy) - Math.atan2(-1,0)) * 180/Math.PI);
}else{ }else{
rotate(entity.rot); rotate(entity.rot);
} }
image(images[entity.type], 0,0); image(images[entity.type], 0,0);
pop(); pop();
} }
} }
@ -190,7 +189,7 @@ function setup(){
describe("A space physics simulator"); describe("A space physics simulator");
canvas.position(0,0); canvas.position(0,0);
worldScale = createSlider();
//Load Entities //Load Entities
for(var i = 0; i <= Settings.entityCount; i+=1){ for(var i = 0; i <= Settings.entityCount; i+=1){
@ -214,7 +213,6 @@ function mouseClicked(){
simulator.forEach((entity) =>{ simulator.forEach((entity) =>{
}) })
console.log(worldScale.value());
} }
function draw(){ function draw(){