tricksty77

Members
  • Content Count

    11
  • Joined

  • Last visited

About tricksty77

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. tricksty77

    Spine plugin & removeAsset

    Hi, in order to be able to remove some assets from spine i have added this line in spine.js, otherwise when i removeAssets the pages from the atlas of spine i get an early return Let me know if this is helping you in some way.
  2. tricksty77

    Search inside all the module files

    Could be very useful a function to search inside all the files of different modules (maybe ctrl shift F) thanks and keep up the amazing work.
  3. tricksty77

    Bug while updating text

    Thanks, this workaround apparently resolve the issue i have. The caching I am doing is becouse I want to change the color of the text and this seems to be the only way to go for now. Probably this is not the most perfect way but at least it works. Many thanks
  4. tricksty77

    Bug while updating text

    yes here it is media.zip
  5. tricksty77

    Bug while updating text

    I have cleaned the sample a little bit more and I attach all the files needed to run please run this sample and try the behavior 1 press and hold test button 2 press refresh 3 press and hold the test button see the difference between 1 and 3 game.module( 'game.main' ) // Required Plugins .require( 'plugin.essentials', ) .body(function() { // Required Assets // Title Screen game.addAsset('button1.png'); game.addAsset('button2.png'); game.addAsset('energyBut.png'); game.addAsset('Arial.fnt'); // Main Menu Scene game.createScene('MainMenu', { backgroundColor: '#ffce53', playerInfo: {}, contextInfo: {}, init: function() { // UI initialization this.startButton11 = new game.ForgeButton('button1.png','button2.png',0.5 * game.width, 0.2*game.height, 'Refresh', {}, 100, 1, '#000000','#FFFFFF', function() { game.scene.updateEnergyText(game.scene.energyText); game.scene.updateEnergyText(game.scene.energyText1); }); this.startButton11.addTo(this.stage) this.startButton11.scaleAmount=0; this.startButton = new game.ForgeButton('button1.png','button2.png',0.5 * game.width, 0.4*game.height, 'Test Button', {}, 100, 1, '#000000','#FFFFFF', function() { }); this.startButton.addTo(this.stage) this.startButton.scaleAmount=0; this.energyText = this.createEnergyText(this.startButton.sprite2, 300); this.energyText1 = this.createEnergyText(this.startButton.sprite, 150); }, createEnergyText: function(hook, xx) { var sprite2 = new game.Sprite('energyBut.png'); sprite2.anchorCenter(); sprite2.position.x = xx; sprite2.position.y = -100; sprite2.addTo(hook); etext = new game.Text("x", {}); etext.addTo(sprite2); etext.anchorCenter(); etext.fontClass.letterSpacing=0; var size = 120; var factor = etext.height / size; etext.height = size; etext.width = etext.width / factor; etext.position.y=-(size/7); etext.position.x=0; this.updateEnergyText(etext); return etext; }, updateEnergyText: function(etext) { etext.setText('xx'); etext.cache = true; etext._cachedSprite.tint = '#000000'; etext._cachedSprite.tintAlpha = 1; }, }); // Custom Classes game.createClass('ForgeButton', 'Button', { //We extend the standard button staticInit: function(texture1, texture2, x, y, text, textProps, size, letterSpacing, tint1, tint2, callback) { this.super(texture2, x, y, callback); this.callback = callback; this.sprite.alpha=0; this.sprite2 = new game.Sprite(texture1); this.sprite2.anchorCenter(); this.sprite2.alpha=1; this.sprite2.buttonMode = true; this.sprite2.position.x = x; this.sprite2.position.y = y; this.sprite2.interactive = true; this.sprite2.mousedown = this.mousedown.bind(this); this.sprite2.mouseup = this.mouseup.bind(this); this.sprite2.mouseupoutside = this.mouseup.bind(this); this.text1 = new game.Text(text, textProps); this.text1.anchorCenter(); this.text1.addTo(this.sprite2); this.text2 = new game.Text(text, textProps); this.text2.anchorCenter(); this.text2.addTo(this.sprite); var factor = this.text1.height / size; this.text1.height = size; this.text1.width /= factor; this.text1.position.y=-(size/7); this.text1.fontClass.letterSpacing=letterSpacing; this.text1.updateText(); this.text1.cache = true; this.text1._cachedSprite.tint = tint1; this.text1._cachedSprite.tintAlpha = 1; this.text2.height = size; this.text2.width /= factor; this.text2.position.y=-(size/7); this.text2.fontClass.letterSpacing=letterSpacing; this.text2.updateText(); this.text2.cache = true; this.text2._cachedSprite.tint = tint2; this.text2._cachedSprite.tintAlpha = 1; this.sprite2.click = this.click.bind(this); }, addTo: function(container) { this.super(container); container.addChild(this.sprite2); }, mousedown: function() { if (this.clickSound) game.audio.playSound(this.clickSound); this.sprite2.alpha=0; this.sprite.alpha=1; this.sprite.mousedown(); }, mouseup: function() { if (this.clickSound1) game.audio.playSound(this.clickSound1); this.sprite2.alpha=1; this.sprite.alpha=0; this.sprite.mouseup(); }, click: function() { //if (this.clickSound) game.audio.playSound(this.clickSound); if (typeof this.callback === 'function') { this.callback(); } } }); }); Arial.fnt
  6. tricksty77

    Bug while updating text

    Ok i understand that the code is not so clean. even with the set text the problem remain updateEnergyText: function(etext) { etext.setText('XX'); etext.cache = true; etext._cachedSprite.tint = '#000000'; etext._cachedSprite.tintAlpha = 1; }, If you can try to run the code it will be clear what is the problem. after you have pressed the refresh button the pressed text over the text button will be empty (even if there is XX inside the text property) the etext parameter is not used unitialized the first line i use is etext= new blah blah but i realized that this is not passed by ref value so i had to add the return etext (but still this had no impact on the behavior i see)
  7. tricksty77

    Bug while updating text

    Hi, I have found a strange behavior while updating some text there is a different behavior if the text is cached(i need to cache it to change the tint) or not In particular i have 1 button that switch between 2 images one images is alpha 0 and the other is alpha 1 when i press the button i change the alpha from 1 to 0 and from 0 to 1 until now all is ok. these two sprites have 2 other child sprites and also these works like expected those 2 other sprites have two text attached and here is where the problems lies when i update the text property that is in these 2 texts, if the texts is set to cached, only the text that is shown is updated. the other become an empty sprite with nothing inside this is the starting behavior this is the expected behavior now if i press the refresh button, the refresh button change the content of the two textboxes and now upon pressing the button i get this empty text box (the class inside has the correct text property but the cached image is wrong) game.module( 'game.main' ) // Required Plugins .require( 'plugin.essentials', ) .body(function() { // Required Assets // Title Screen game.addAsset('button1.png'); game.addAsset('button2.png'); game.addAsset('energyBut.png'); game.addAsset('click1.wav'); game.addAsset('click2.wav'); game.addAsset('Patrick.fnt'); // Main Menu Scene game.createScene('MainMenu', { backgroundColor: '#ffce53', playerInfo: {}, contextInfo: {}, init: function() { // UI initialization this.startButton11 = new game.ForgeButton('button1.png','button2.png',0.5 * game.width, 0.2*game.height, 'Refresh', {}, 100, 1, '#000000','#FFFFFF', function() { game.scene.updateEnergyText(game.scene.energyText); game.scene.updateEnergyText(game.scene.energyText1); }); this.startButton11.addTo(this.stage) this.startButton11.scaleAmount=0; this.startButton = new game.ForgeButton('button1.png','button2.png',0.5 * game.width, 0.4*game.height, 'Test Button', {}, 100, 1, '#000000','#FFFFFF', function() { }); this.startButton.addTo(this.stage) this.startButton.scaleAmount=0; this.energyText = this.createEnergyText(this.startButton.sprite2, this.energyText, 300); this.energyText1 = this.createEnergyText(this.startButton.sprite, this.energyText1, 150); }, createEnergyText: function(hook, etext, xx) { var sprite2 = new game.Sprite('energyBut.png'); sprite2.anchorCenter(); sprite2.position.x = xx; sprite2.position.y = -100; sprite2.addTo(hook); etext = new game.Text("x", {}); etext.addTo(sprite2); etext.anchorCenter(); etext.fontClass.letterSpacing=0; var size = 120; var factor = etext.height / size; etext.height = size; etext.width = etext.width / factor; etext.position.y=-(size/7); etext.position.x=0; this.updateEnergyText(etext); return etext; }, updateEnergyText: function(etext) { etext.text = 'x'; etext.updateText(); etext.cache = true; etext._cachedSprite.tint = '#000000'; etext._cachedSprite.tintAlpha = 1; }, }); // Custom Classes game.createClass('ForgeButton', 'Button', { //We extend the standard button staticInit: function(texture1, texture2, x, y, text, textProps, size, letterSpacing, tint1, tint2, callback) { this.super(texture2, x, y, callback); this.callback = callback; this.sprite.alpha=0; this.sprite2 = new game.Sprite(texture1); this.sprite2.anchorCenter(); this.sprite2.alpha=1; this.sprite2.buttonMode = true; this.sprite2.position.x = x; this.sprite2.position.y = y; this.sprite2.interactive = true; this.sprite2.mousedown = this.mousedown.bind(this); this.sprite2.mouseup = this.mouseup.bind(this); this.sprite2.mouseupoutside = this.mouseup.bind(this); this.text1 = new game.Text(text, textProps); this.text1.anchorCenter(); this.text1.addTo(this.sprite2); this.text2 = new game.Text(text, textProps); this.text2.anchorCenter(); this.text2.addTo(this.sprite); var factor = this.text1.height / size; this.text1.height = size; this.text1.width /= factor; this.text1.position.y=-(size/7); this.text1.fontClass.letterSpacing=letterSpacing; this.text1.updateText(); this.text1.cache = true; this.text1._cachedSprite.tint = tint1; this.text1._cachedSprite.tintAlpha = 1; this.text2.height = size; this.text2.width /= factor; this.text2.position.y=-(size/7); this.text2.fontClass.letterSpacing=letterSpacing; this.text2.updateText(); this.text2.cache = true; this.text2._cachedSprite.tint = tint2; this.text2._cachedSprite.tintAlpha = 1; this.sprite2.click = this.click.bind(this); }, addTo: function(container) { this.super(container); container.addChild(this.sprite2); }, scaleIn: function(delay) { delay = delay || 0; this.sprite2.scale.set(0); game.Tween.add(this.sprite2.scale, { x: 1, y: 1 }, this.scaleSpeed, { easing: this.scaleEasing, delay: delay, onStart: this._onScaleInStart.bind(this), onComplete: this._scaleInEnd.bind(this) }).start(); }, rotate: function(random) { this.super(random), this.sprite2.rotation = -this.rotateAmount; this.rotateTween = game.Tween.add(this.sprite2, { rotation: this.rotateAmount }, this.rotateSpeed, { repeat: Infinity, yoyo: true, easing: this.rotateEasing }).start(); if (random) this.rotateTween.currentTime = this.rotateTween.duration.random(); }, setPosition: function(x,y) { this.sprite.position.x = x; this.sprite.position.y = y; this.sprite2.position.x = x; this.sprite2.position.y = y; }, mousedown: function() { if (this.clickSound) game.audio.playSound(this.clickSound); this.sprite2.alpha=0; this.sprite.alpha=1; this.sprite.mousedown(); }, mouseup: function() { if (this.clickSound1) game.audio.playSound(this.clickSound1); this.sprite2.alpha=1; this.sprite.alpha=0; this.sprite.mouseup(); }, click: function() { //if (this.clickSound) game.audio.playSound(this.clickSound); if (typeof this.callback === 'function') { this.callback(); } } }); }); Many thanks
  8. tricksty77

    Font, loading & letterSpacing Sample

    Neat! Works like a charm thanks. In the documentation there was written I could use JSON to build a font but this is simpler and smaller thanks!
  9. tricksty77

    Font, loading & letterSpacing Sample

    I had build a font with BMFont which was loaded properly in panda but when I converted the xml in json I had problem in the Font Contructor I had the needs to change the text.js in the engine in order to make this works (the json file was not loaded properly) I would like to share with you a sample I have done (I think other people will find useful if is moved into the panda examples) game.module( 'game.main' ) .body(function() { game.addAsset('test1_0.png'); game.addAsset('example.json'); game.createScene('Main', { init: function() { this.text = new game.Text('Hello Panda!'); this.text.addTo(this.stage); this.json = game.getJSON('example.json'); this.font = new game.Font(this.json); this.font.letterSpacing = 1; this.text.fontClass = this.font; this.text.updateText(); }, mousedown: function() { this.font.letterSpacing = 10; this.text.updateText(); }, mouseup: function() { this.font.letterSpacing = 1; this.text.updateText(); } }); }); P S: I also want to signal that this very same segment of text.js code will not works if the font is splitted in multiple bitmap so pay attention to that when you export fonts from BMFont. (try to squeeze all chars into a single png) media.zip
  10. tricksty77

    Facebook Instant Game (tic tak toe sample)

    Many Thanks... We'll wait for any update on that
  11. I had deployed the example in a newly created facebook app While testing the Tic tak toe exaple I find the follow error... in initDone Function error.message is Failed to fetch requested matches and the game wont progress any idea on what is failing?