Skip to content

Commit

Permalink
⚡ Catnip: Add xprev, yprev blocks to the Movement category
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmoMyzrailGorynych committed Jun 29, 2024
1 parent 40643a3 commit 6017003
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/data/i18n/English.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@
"get direction": "direction",
"y of copy": "y of a copy",
"x of copy": "x of a copy",
"x prev": "previous x",
"y prev": "previous y",
"get width": "width",
"get height": "height",
"set width": "Set width to",
Expand Down Expand Up @@ -1804,12 +1806,21 @@
"Button": "Button",
"RepeatingTexture": "Repeating texture",
"SpritedCounter": "Sprited Counter",
"TextBox": "Text box"
"TextBox": "Text box",
"ScrollBox": "Scrollbox",
"Select": "Select menu",
"ItemList": "Item list"
},
"nineSliceTop": "Top slice, in pixels",
"nineSliceRight": "Right slice, in pixels",
"nineSliceBottom": "Bottom slice, in pixels",
"nineSliceLeft": "Left slice, in pixels",
"layoutItemsHeading": "Items layout",
"horizontalPadding": "Horizontal padding, in pixels",
"verticalPadding": "Vertical padding, in pixels",
"horizontalSpacing": "Horizontal item spacing, in pixels",
"verticalSpacing": "Vertical item spacing, in pixels",
"alignItems": "Align items:",
"autoUpdateNineSlice": "Automatically update collision shape",
"autoUpdateNineSliceHint": "If a panel changes its size, it will automatically update its collision shape. You usually don't need that for purely cosmetic elements, or the ones that never change their size after creation. You can still update its collision shape at any time with u.reshapeNinePatch(this) call.",
"panelHeading": "Texture slicing settings",
Expand Down
28 changes: 28 additions & 0 deletions src/node_requires/catnip/stdLib/movement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,34 @@ const blocks: (IBlockCommandDeclaration | IBlockComputedDeclaration)[] = [{
lib: 'core.movement',
code: 'x of'
}]
}, {
name: 'x previous',
type: 'computed',
code: 'x prev',
icon: 'move',
i18nKey: 'x prev',
jsTemplate: () => 'this.xprev',
lib: 'core.movement',
pieces: [],
typeHint: 'number',
mutators: [{
lib: 'core.movement',
code: 'y prev'
}]
}, {
name: 'y previous',
type: 'computed',
code: 'y prev',
icon: 'move',
i18nKey: 'y prev',
jsTemplate: () => 'this.yprev',
lib: 'core.movement',
pieces: [],
typeHint: 'number',
mutators: [{
lib: 'core.movement',
code: 'x prev'
}]
}];

export default blocks;

0 comments on commit 6017003

Please sign in to comment.