Skip to content

Commit

Permalink
Fix collision with itself.
Browse files Browse the repository at this point in the history
Fixes a bug where using the collision block that was colliding with itself was causing a bBasic compilation error.
Changed so that if the block is configured to check collision with something against itself, it will always return `true`.

Merge pull request #118 from haroldo-ok/fix-collision-with-itself
Fix #116
  • Loading branch information
haroldo-ok authored Oct 10, 2024
2 parents 8f899db + 8ed2f1a commit 5b797f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vcs-game-maker",
"version": "0.25.4",
"version": "0.25.5",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
6 changes: 4 additions & 2 deletions src/generators/bbasic/collision.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ export default (Blockly) => {
Blockly.VARIABLE_CATEGORY_NAME);
const var1 = Blockly.BBasic.nameDB_.getName(block.getFieldValue('VAR1'),
Blockly.VARIABLE_CATEGORY_NAME);
// Variable getter.
const code = `collision(${var0}, ${var1})`;

const code = var0 === var1 ? 'true' :
`collision(${var0}, ${var1})`;

return [code, Blockly.BBasic.ORDER_ATOMIC];
};
};

0 comments on commit 5b797f3

Please sign in to comment.