Skip to content

Commit

Permalink
Update app.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jcdevgame authored Jun 7, 2024
1 parent d7de57d commit 006b665
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ callForeverProgram() {
newblock func
*/

function newBlock(nameSPRT,SPRTx,SPRTy,SPRTwidth,SPRTheight,SPRTanchored, SPRTcolor, SPRTmass, SPRTflipHorizontally, SPRTflipVertically, SPRTGravity, SPRThasonclick, SPRTprogram, SPRTforeverprogram, SPRTonclickprogram, SPRTlayer) {
function newBlock(nameSPRT,SPRTx,SPRTy,SPRTwidth,SPRTheight,SPRTanchored, SPRTcolor, SPRTmass, SPRTflipHorizontally, SPRTflipVertically, SPRTGravity, SPRThasonclick, SPRTprogram, SPRTforeverprogram, SPRTonclickprogram, SPRTlayer, SPRTname) {
blockCount++;
let blockName = "block" + blockCount;
const block = new Sprite(100, 100, 50, 50, true, "#050dff", 1, false);
Expand Down Expand Up @@ -473,6 +473,10 @@ function newBlock(nameSPRT,SPRTx,SPRTy,SPRTwidth,SPRTheight,SPRTanchored, SPRTco
newButton.id = blockName;
block.button = newButton;

if (nameSPRT == true){
blockName = SPRTname;
}

newButton.innerHTML = blockName;

document.getElementById("explorer").appendChild(newButton);
Expand All @@ -496,7 +500,6 @@ function newBlock(nameSPRT,SPRTx,SPRTy,SPRTwidth,SPRTheight,SPRTanchored, SPRTco

propertyInput.addEventListener("change", function() {
if (property === "name") {

const newName = propertyInput.value;

GameObjects[newName] = GameObjects[blockName];
Expand All @@ -505,6 +508,7 @@ function newBlock(nameSPRT,SPRTx,SPRTy,SPRTwidth,SPRTheight,SPRTanchored, SPRTco
newButton.innerHTML = newName;

blockName = newName;

} else if (property === "layer") {

const newLayer = parseInt(propertyInput.value, 10);
Expand Down Expand Up @@ -781,7 +785,7 @@ fileInput.addEventListener('change', function(event) {
console.log('onclickprogram:', object.onclickprogram);
console.log('layer:', object.layer);

newBlock(true, object.x, object.y, object.width, object.height, object.anchored, object.color, object.mass, object.flipHorizontally, object.flipVertically, object.Gravity, object.hasonclick, object.program, object.foreverprogram, object.onclickprogram, object.layer);
newBlock(true, object.x, object.y, object.width, object.height, object.anchored, object.color, object.mass, object.flipHorizontally, object.flipVertically, object.Gravity, object.hasonclick, object.program, object.foreverprogram, object.onclickprogram, object.layer, objectName);
}
};
reader.readAsText(file);
Expand Down

0 comments on commit 006b665

Please sign in to comment.