Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions msg/js/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Blockly.Msg['OPERATORS_ADD'] = '%1 + %2'
Blockly.Msg['OPERATORS_SUBTRACT'] = '%1 - %2'
Blockly.Msg['OPERATORS_MULTIPLY'] = '%1 * %2'
Blockly.Msg['OPERATORS_DIVIDE'] = '%1 / %2'
Blockly.Msg['OPERATORS_POWER'] = '%1 ^ %2'
Blockly.Msg['OPERATORS_RANDOM'] = 'pick random %1 to %2'
Blockly.Msg['OPERATORS_GT'] = '%1 > %2'
Blockly.Msg['OPERATORS_LT'] = '%1 < %2'
Expand Down
1 change: 1 addition & 0 deletions msg/json/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"OPERATORS_SUBTRACT": "%1 - %2",
"OPERATORS_MULTIPLY": "%1 * %2",
"OPERATORS_DIVIDE": "%1 / %2",
"OPERATORS_POWER": "%1 ^ %2",
"OPERATORS_RANDOM": "pick random %1 to %2",
"OPERATORS_GT": "%1 > %2",
"OPERATORS_LT": "%1 < %2",
Expand Down
1 change: 1 addition & 0 deletions msg/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ Blockly.Msg.OPERATORS_ADD = '%1 + %2'
Blockly.Msg.OPERATORS_SUBTRACT = '%1 - %2'
Blockly.Msg.OPERATORS_MULTIPLY = '%1 * %2'
Blockly.Msg.OPERATORS_DIVIDE = '%1 / %2'
Blockly.Msg.OPERATORS_POWER = '%1 ^ %2'
Blockly.Msg.OPERATORS_RANDOM = 'pick random %1 to %2'
Blockly.Msg.OPERATORS_GT = '%1 > %2'
Blockly.Msg.OPERATORS_LT = '%1 < %2'
Expand Down
22 changes: 22 additions & 0 deletions src/blocks/operators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,28 @@ Blockly.Blocks.operator_divide = {
},
}

Blockly.Blocks.operator_power = {
/**
* Block for rasing a number to a power.
*/
init: function (this: Blockly.Block) {
this.jsonInit({
message0: Blockly.Msg.OPERATORS_POWER,
args0: [
{
type: 'input_value',
name: 'NUM1',
},
{
type: 'input_value',
name: 'NUM2',
},
],
extensions: ['colours_operators', 'output_number'],
})
},
}

Blockly.Blocks.operator_random = {
/**
* Block for picking a random number.
Expand Down