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