Snippets

Lucky Kat Bento Snippets

Updated by Hernan Zhou

File bento-clickable.sublime-snippet Added

  • Ignore whitespace
  • Hide word diff
+<snippet>
+    <content><![CDATA[
+Clickable({
+    pointerDown: function (data) {},
+    pointerUp: function (data) {},
+    pointerMove: function (data) {},
+    // when clicking on the object
+    onClick: function (data) {},
+    onClickUp: function (data) {},
+    onClickMiss: function (data) {},
+    onHold: function (data) {},
+    onHoldLeave: function (data) {},
+    onHoldEnter: function (data) {},
+    onHoldEnd: function (data) {},
+    // desktop only
+    onHoverLeave: function (data) {},
+    onHoverEnter: function (data) {}
+})
+]]></content>
+    <tabTrigger>Clickable</tabTrigger>
+    <description>Bento Clickable component</description>
+</snippet>

File bento-clickbutton.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
 <snippet>
     <content><![CDATA[
 ClickButton({
-    name: '',
-    sfx: '',
-    image: Bento.assets.getImage(''),
-    frameCountX: 1,
-    frameCountY: 3,
-    position: new Vector2(0, 0),
-    float: false,
-    updateWhenPaused: 0,
+    z: ${1:0},
+    name: '${2}',
+    sfx: '${3}',
+    imageName: '${4}',
+    frameCountX: ${5:1},
+    frameCountY: ${6:3},
+    position: new Vector2(${7:0}, ${8:0}),
+    float: ${9:false},
+    updateWhenPaused: ${10:0},
     onClick: function () {
-        
+        ${11}
     }
-})
+});
 ]]></content>
     <tabTrigger>ClickButton</tabTrigger>
     <description>Bento ClickButton</description>

File bento-define-component.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
 <snippet>
     <content><![CDATA[
 /**
- * Component description
+ * ${1:Component description}
  */
-bento.define('', [
+bento.define('${2}', [
     'bento',
     'bento/math/vector2',
     'bento/math/rectangle',
         var viewport = Bento.getViewport();
         var entity;
         var component = {
-            name: '',
+            name: '${3}',
             start: function (data) {},
             destroy: function (data) {},
             update: function (data) {},

File bento-define-entity-module.sublime-snippet Added

  • Ignore whitespace
  • Hide word diff
+<snippet>
+    <!-- A standard bento define snippet with sprite and entity to fill in -->
+    <content><![CDATA[
+/**
+ * ${1:Module description}
+ */
+bento.define('${2}', [
+    'bento',
+    'bento/math/vector2',
+    'bento/math/rectangle',
+    'bento/components/sprite',
+    'bento/components/clickable',
+    'bento/entity',
+    'bento/eventsystem',
+    'bento/gui/clickbutton',
+    'bento/gui/counter',
+    'bento/gui/text',
+    'bento/utils',
+    'bento/tween'
+], function (
+    Bento,
+    Vector2,
+    Rectangle,
+    Sprite,
+    Clickable,
+    Entity,
+    EventSystem,
+    ClickButton,
+    Counter,
+    Text,
+    Utils,
+    Tween
+) {
+    'use strict';
+    return function (settings) {
+        /*settings = {
+            // describe your settings object parameters
+            position: Vector2 // positions the entity
+        }*/
+        var viewport = Bento.getViewport();
+        var sprite = new Sprite({
+            imageName: '${3}',
+            frameCountX: 1,
+            frameCountY: 1,
+            animations: {
+                default: {
+                    speed: 0,
+                    frames: [0]
+                }
+            }
+        });
+        var behavior = {
+            name: '${4:behaviorComponent}',
+            start: function (data) {},
+            destroy: function (data) {},
+            update: function (data) {},
+            draw: function (data) {}
+        };
+        var entity = new Entity({
+            z: 0,
+            name: '${5}',
+            family: [''],
+            position: settings.position || new Vector2(0, 0),
+            originRelative: new Vector2(0, 0),
+            updateWhenPaused: 0,
+            components: [
+                sprite,
+                behavior
+            ]
+        });
+        return entity;
+    };
+});
+]]></content>
+    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
+    <tabTrigger>bento</tabTrigger>
+    <description>Bento Entity Definition</description>
+</snippet>

File bento-define-screen.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
     <!-- A standard bento screen define snippet -->
     <content><![CDATA[
 /**
- * Screen description
+ * ${1:Screen description}
  */
-bento.define('', [
+bento.define('${2}', [
     'bento',
     'bento/math/vector2',
     'bento/math/rectangle',
     Tween
 ) {
     'use strict';
-    var onShow = function () {
-        /* Screen starts here */
+    var onShow = function (data) {
+        ${3:/* Screen starts here */}
     };
 
     return new Screen({
     <tabTrigger>bento</tabTrigger>
     <description>Bento Screen Definition</description>
     <!-- <scope>source.python</scope> -->
-</snippet>
+</snippet>

File bento-define.sublime-snippet Deleted

  • Ignore whitespace
  • Hide word diff
-<snippet>
-    <!-- A standard bento define snippet with sprite and entity to fill in -->
-    <content><![CDATA[
-/**
- * Module description
- */
-bento.define('', [
-    'bento',
-    'bento/math/vector2',
-    'bento/math/rectangle',
-    'bento/components/sprite',
-    'bento/components/clickable',
-    'bento/entity',
-    'bento/eventsystem',
-    'bento/gui/clickbutton',
-    'bento/gui/counter',
-    'bento/gui/text',
-    'bento/utils',
-    'bento/tween'
-], function (
-    Bento,
-    Vector2,
-    Rectangle,
-    Sprite,
-    Clickable,
-    Entity,
-    EventSystem,
-    ClickButton,
-    Counter,
-    Text,
-    Utils,
-    Tween
-) {
-    'use strict';
-    return function (settings) {
-        /*settings = {
-            // describe your settings object parameters
-            position: Vector2 // positions the entity
-        }*/
-        var viewport = Bento.getViewport();
-        var sprite = new Sprite({
-            imageName: '',
-            frameCountX: 1,
-            frameCountY: 1,
-            animations: {
-                'default': {
-                    speed: 0,
-                    frames: [0]
-                }
-            }
-        });
-        var entity = new Entity({
-            z: 0,
-            name: '',
-            family: [''],
-            position: settings.position || new Vector2(0, 0),
-            originRelative: new Vector2(0, 0),
-            updateWhenPaused: 0,
-            components: [
-                sprite
-            ]
-        });
-        return entity;
-    };
-});
-]]></content>
-    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
-    <tabTrigger>bento</tabTrigger>
-    <description>Bento Entity Definition</description>
-</snippet>

File bento-entity.sublime-snippet Deleted

  • Ignore whitespace
  • Hide word diff
-<snippet>
-	<content><![CDATA[
-Entity({
-    z: 0,
-    name: '',
-    family: [''],
-    updateWhenPaused: 0,
-    float: false,
-    position: new Vector2(0, 0),
-    originRelative: new Vector2(0, 0),
-    components: [
-        new Sprite({
-            imageName: '',
-            frameCountX: 1,
-            frameCountY: 1,
-            animations: {
-                'default': {
-                    speed: 0,
-                    frames: [0]
-                }
-            }
-        })
-    ]
-})
-]]></content>
-	<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
-	<tabTrigger>Entity</tabTrigger>
-</snippet>

File bento-foreach.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
 <snippet>
     <content><![CDATA[
-Utils.forEach(${1:array}, function (${2:item}, iterator, length, breakLoop) {
+Utils.forEach(${1:array}, function (${2:item}, i, l, breakLoop) {
     ${3:// code here}
 });
 ]]></content>
     <tabTrigger>forEach</tabTrigger>
     <!-- Optional: Set a scope to limit where the snippet will trigger -->
     <!-- <scope>source.python</scope> -->
-</snippet>
+</snippet>

File bento-sprite.sublime-snippet Added

  • Ignore whitespace
  • Hide word diff
+<snippet>
+    <content><![CDATA[
+Sprite({
+    imageName: '${1}',
+    frameCountX: ${2: 1},
+    frameCountY: ${3: 1},
+    animations: {
+        default: {
+            speed: 0,
+            frames: [0]
+        }
+    }
+});
+]]></content>
+    <tabTrigger>Sprite</tabTrigger>
+    <description>Bento Sprite component</description>
+</snippet>

File bento-text.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
 <snippet>
     <content><![CDATA[
 Text({
-    z: 0,
-    name: 'text',
-    position: new Vector2(0, 0),
-    text: 'Hello',
-    font: 'font',
-    fontSize: 16,
-    fontColor: '#ffffff',
-    align: 'left',
-    textBaseline: 'bottom',
-    margin: new Vector2(0, 0),
-    ySpacing: 0,
-    lineWidth: 0,
-    strokeStyle: '#000000',
-    innerStroke: false,
-    pixelStroke: false // workaround for Cocoon bug
-})
+    z: ${1:0},
+    position: new Vector2(${2:0}, ${3:0}),
+    text: '${4}',
+    font: '${5:font}',
+    fontSize: ${6:16},
+    fontColor: '${7:#ffffff}',
+    align: '${8:left}',
+    textBaseline: '${9:bottom}',
+    ySpacing: ${10:0},
+    lineWidth: ${11:0},
+    strokeStyle: '${12:#000000}',
+    innerStroke: ${13:false},
+    pixelStroke: ${14:false} // workaround for Cocoon bug
+});
 ]]></content>
     <tabTrigger>Text</tabTrigger>
     <description>Bento Text</description>

File bento-tween.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
 <snippet>
     <content><![CDATA[
 Tween({
-    from: 0,
-    to: 1,
-    'in': 60,
-    ease: Tween.LINEAR,
+    from: ${1:0},
+    to: ${2:1},
+    'in': ${3:60},
+    ease: ${4:Tween.LINEAR},
     onUpdate: function (v, t) {
-
+        ${5}
     },
     onComplete: function () {
-        
+        ${6}
     }
 });
 ]]></content>
Updated by Hernan Zhou

File bento-foreach.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
 <snippet>
     <content><![CDATA[
-Utils.forEach(${1:array}, function (${2:item}, i, l, breakLoop) {
+Utils.forEach(${1:array}, function (${2:item}, iterator, length, breakLoop) {
     ${3:// code here}
 });
 ]]></content>
Updated by Hernan Zhou

File bento-define-screen.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
     'bento/components/clickable',
     'bento/entity',
     'bento/eventsystem',
+    'bento/gui/clickbutton',
+    'bento/gui/counter',
+    'bento/gui/text',
     'bento/utils',
     'bento/screen',
     'bento/tween'
     Clickable,
     Entity,
     EventSystem,
+    ClickButton,
+    Counter,
+    Text,
     Utils,
     Screen,
     Tween

File bento-define.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
     'bento/components/sprite',
     'bento/components/clickable',
     'bento/entity',
+    'bento/eventsystem',
     'bento/gui/clickbutton',
     'bento/gui/counter',
     'bento/gui/text',
-    'bento/eventsystem',
     'bento/utils',
     'bento/tween'
 ], function (
     Sprite,
     Clickable,
     Entity,
+    EventSystem,
     ClickButton,
     Counter,
     Text,
-    EventSystem,
     Utils,
     Tween
 ) {

File bento-entity.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
     name: '',
     family: [''],
     updateWhenPaused: 0,
+    float: false,
     position: new Vector2(0, 0),
     originRelative: new Vector2(0, 0),
     components: [

File bento-text.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
     <content><![CDATA[
 Text({
     z: 0,
+    name: 'text',
     position: new Vector2(0, 0),
     text: 'Hello',
     font: 'font',

File bento-tween.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
     from: 0,
     to: 1,
     'in': 60,
-    ease: 'linear',
-    'do': function (v, t) {
+    ease: Tween.LINEAR,
+    onUpdate: function (v, t) {
 
     },
     onComplete: function () {
Updated by Hernan Zhou

File bento-define.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
         var entity = new Entity({
             z: 0,
             name: '',
+            family: [''],
             position: settings.position || new Vector2(0, 0),
             originRelative: new Vector2(0, 0),
             updateWhenPaused: 0,
-            family: [''],
             components: [
                 sprite
             ]

File bento-entity.sublime-snippet Modified

  • Ignore whitespace
  • Hide word diff
 Entity({
     z: 0,
     name: '',
+    family: [''],
+    updateWhenPaused: 0,
     position: new Vector2(0, 0),
     originRelative: new Vector2(0, 0),
-    family: [''],
-    components: [new Sprite({
-        imageName: '',
-        frameCountX: 1,
-        frameCountY: 1,
-        animations: {
-            'default': {
-                speed: 0,
-                frames: [0]
+    components: [
+        new Sprite({
+            imageName: '',
+            frameCountX: 1,
+            frameCountY: 1,
+            animations: {
+                'default': {
+                    speed: 0,
+                    frames: [0]
+                }
             }
-        }
-    })]
+        })
+    ]
 })
 ]]></content>
 	<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
Updated by Hernan Zhou

File bento-foreach.sublime-snippet Added

  • Ignore whitespace
  • Hide word diff
+<snippet>
+    <content><![CDATA[
+Utils.forEach(${1:array}, function (${2:item}, i, l, breakLoop) {
+    ${3:// code here}
+});
+]]></content>
+    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
+    <tabTrigger>forEach</tabTrigger>
+    <!-- Optional: Set a scope to limit where the snippet will trigger -->
+    <!-- <scope>source.python</scope> -->
+</snippet>
  1. 1
  2. 2
  3. 3
  4. 4
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.