Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaoticLeah committed Dec 27, 2023
1 parent 07d98fb commit 3fe7978
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 3 additions & 7 deletions scripts/Objects/Components/rigidbodyComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ export class RigidbodyComponent extends Component {
onGround = false
touchingLeftWall = false
touchingRightWall = false
constructor(parentObject, color) {
if (typeof color != "object") color = { color: color };
super(parentObject, color);
constructor(parentObject, data) {
super(parentObject, data);
this.objectPropertyTypes = {
velocityX: propertyTypes.NUMBER_INPUT,
velocityY: propertyTypes.NUMBER_INPUT,
Expand All @@ -22,7 +21,7 @@ export class RigidbodyComponent extends Component {
};
}

init(parentObject, color = "#ff0000") {
init(parentObject) {
this.parentObject = parentObject;
this.properties = { velocityX: 0, velocityY: 0, applyGravity: true, shouldCollide:false, mass: 1, damping: 0.98, terminalVelocity: 10 };
}
Expand Down Expand Up @@ -72,9 +71,6 @@ export class RigidbodyComponent extends Component {
if(this.onGround){
if(this.properties.velocityY > 0)
this.properties.velocityY = 0
// this.parentObject.incrementY(-0.1);
//this.parentObject.setY(collidingObject.object.getYWithoutEditorOffsetScreenCoords() - (this.parentObject.getHWithoutEditorOffsetScreenCoords()))
//console.log(collidingObject.object)
}

if(this.touchingLeftWall && this.properties.velocityX < 0)
Expand Down
1 change: 1 addition & 0 deletions scripts/Objects/ObjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function addObject(object, parentObjectId) {
}
object.getProperties().parentObjectId = parentObjectId.toString();
const parentIsDefined = getObject(parentObjectId) != undefined
//This happens when loading in a project since the loading will already come with children data
const alreadyHasChild = parentIsDefined && getObject(parentObjectId).hasChild(object.getProperties().id)
if (parentObjectId != "none" && parentIsDefined && !alreadyHasChild)
getObject(parentObjectId).addChild(object.getProperties().id);
Expand Down

0 comments on commit 3fe7978

Please sign in to comment.