• Content Count

  • Joined

  • Last visited

About Todi

  • Rank
    Advanced Member

Contact Methods

  • Twitter

Recent Profile Visitors

1326 profile views
  1. Hi guys, So, I stuck in a little problem here. I'm building a chat system for my casual game, but I'd like to put icons in the middle of the text, like Whats App messages with emoticons. Does anyone know how can I do it or have any ideas to solve it? EDIT: Just to clarify, the text and emoticons (images/sprites) must be rendered in the same sentence, like when we sent a message with emoticons on the WAPP chat. Thanks!
  2. I forked this repository and modified some things to do what I needed. Feel free to use and abuse!
  3. Thanks! I knew it! In that time, I had to clone a Google Play Services project in Java and adapt to my desires. I released this game and it worked very well!
  4. Hello guys, So, I'm trying to implement the Google Play Services inside my game for the players challenge their friends with leaderboards scores and achievements. As I'm using Cordova, I have two ways: plugins or javascript libs. The first one is really old and limited, besides it not work well. And in the other hand we have the JS library of Google Web (REST) that you can find here and here So, I'd tested both and the second is more interesting and complete than the first one. However, I can't load the OAuth2 to start using the REST calls and complete my game logic. Reading about this, I discovered that the webview don't save cookies, and when I have not set the parameter cookie_policy to "none" I get this error: And, when I set cookie_policy to "none", I have this error: I already have setup the lib in index.html <!-- google play games service api --> <script src=""></script> And in my MainMenu state, I'm doing the SignIn tests using this code: // google play sign in if (gapi) { console.log('GAPI is loaded'); gapi.client.setApiKey('<api_key>'); gapi.load('client:auth2', function () { gapi.auth2.init({ client_id: '<client_id>', cookie_policy: 'none', scope: '' }).then(function () { console.log('auth2 success'); }); }); } else { console.error('GAPI is not loaded'); } I would like to know if anyone knows about how to implement GPGS using Cordova?! I'd like to understand what I'm doing wrong! Any help will be great! Thank you!
  5. It would be more simple! Good tip too!
  6. Hi guys, So, I want that my sprite just collide with left and right sides of the world bounds, and the top and bottom doesn't collide. What I did: // setup ball this._ball.anchor.set(0.5); this._ball.body.bounce.set(1); this._ball.body.collideWorldBounds = true; this._ball.body.checkCollision.up = false; this._ball.body.checkCollision.down = false; But, even I disabling the up and down collision, it still colliding with up and down world bounds. What I have to do? Thanks!
  7. I don't know if it is a bug, but I fixed it using Signals. When the last platform reaches the final coordination, a signal is dispatched and my Trail object, that holds that platform, listen it and act restarting the all cycle again. Now, it works fine! Just for information!
  8. Hi guys! I'm really pissed about my code. I reviewed so many times and I can't find the problem that is causing this bug. So, as you can see in these screenshots below, after a while running the game, the platforms starts acting strange. In the interval of platform 2 and 3, when the movement is from left to right, these platforms overlaps and when the movement is from right to left, the distance between then increase. The first screenshot is about the game start, so the problem didn't occured, yet. In the second screenshot, shows the bug in action and it get worse after a while running the game. well... the objective of these platforms is to do a cyclic movement from left to right and vice-versa, in an infinite loop, where the player will jumps on it catching items and killing enemies. So, I start my code creating the platforms in the Trail class, that holds 4 platforms per row. // trail group of platforms this._trail =; // fill the group with platforms for (var i = 0; i < total; i++) { var platform = new MovablePlatform(, sprite, direction, speed); var initX; var finalX; switch (direction) { // move to left case 0: if (i === 0) { initX = + platform.width; finalX = - platform.width * total - PLATFORM_GAP; } else { var lastPlatform = this._trail.getAt(i - 1); initX = lastPlatform.initPos.x + lastPlatform.width + PLATFORM_GAP; finalX = lastPlatform.finalPos.x + lastPlatform.width + PLATFORM_GAP; } break; // move to right case 1: if (i === 0) { initX = - platform.width; finalX = + platform.width * total + PLATFORM_GAP; } else { var lastPlatform = this._trail.getAt(i - 1); initX = lastPlatform.initPos.x - lastPlatform.width - PLATFORM_GAP; finalX = lastPlatform.finalPos.x - lastPlatform.width - PLATFORM_GAP; } break; } platform.createPath(initX, posY, finalX, posY); this._trail.add(platform); } And in the class MovablePlatform I created the method "move", that starts the platform movement, applying the velocity in x-axis. The update method verify if the x position is equal or grater/lesser than the final position and reset the position, to start the movement again. MovablePlatform.prototype.update = function () { switch (this._direction) { // check negative bounds outside the screen case 0: if (this.x <= this.finalPos.x) { this.reset(); } break; // check positive bounds outside the screen case 1: if (this.x >= this.finalPos.x) { this.reset(); } break; } }; MovablePlatform.prototype.move = function () { switch (this._direction) { // move to left case 0: this.body.velocity.x = -this._speed; break; // move to right case 1: this.body.velocity.x = this._speed; break; } }; That is it! Does anybody know why it happen? And if anyone knows a better method to do cyclic movement, I would like to know and appreciate the sharing! Thanks!
  9. For those who don't found it yet, follow the code that I was forgetful: // box collision sizethis.body.setSize(width, height - 480, x, 480);Set the size of your TileSprite and it will collide! Sorry the double post!
  10. Agreed! Code completion works really great! I'm using WebStorm too!
  11. Guys, I fixed my code that was causing error, but, the collision between Sprite and TileSprite doesn't work yet. Here is the code: Game.prototype.update = function () {, this._ground);};Anyone know what is going on? Thank you all!
  12. I modified some things, following the RequireJS Template in official github of Phaser, but now the error persists on Cordova. After I modified some lines of code everything works well in browser, but not in Cordova when I try to run my application. The new error is: FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':mergeDebugAssets'.> java.lang.NullPointerException (no error message)* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.BUILD FAILEDTotal time: 4.06 secsC:\Users\Alexandre Ferreira\Projetos\HTML5\pizzamayhem\platforms\android\cordova\node_modules\q\q.js:126 throw e; ^Error code 1 for command: cmd with args: /s /c ""C:\Users\Alexandre Ferreira\Projetos\HTML5\pizzamayhem\platforms\android\gradlew" cdvBuildDebug -b "C:\Users\Alexandre Ferreira\Projetos\HTML5\pizzamayhem\platforms\android\build.gradle" -PcdvBuildArch=arm -Dorg.gradle.daemon=true"Btw, thanks for your patience! EDIT: I solved the cordova error doing remove and add the Android platform, now I will test the fullscreen mode and scale. EDIT: Everything works fine!
  13. So, I'm using RequireJS, it will be really weird and not work on jsFiddle. Follow my code bellow: index.html <html> <head> <meta charset="utf-8"> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width"> <title>Pizza Mayhem</title> <!-- CSS style --> <link rel="stylesheet" type="text/css" href="css/style.css"> <!-- require lib --> <script data-main="config" src="lib/require.js"></script> </head> <body> <div id="game"></div> <div id="orientation"></div> </body></html>config.js (requirejs) require.config({ baseUrl: 'js/', paths: { phaser: '../lib/phaser' }, shim: { 'phaser': { exports: 'Phaser' } }});requirejs(['Main']);Main.js define(['phaser', 'Boot'], function (Phaser, Boot) { 'use strict'; var game; game = new Phaser.Game(1024, 768, Phaser.AUTO, 'game'); game.state.add('Boot', Boot); game.state.start('Boot');});Boot.js define(['phaser'], function (Phaser) { 'use strict'; function Boot (game) { // code me! }; Boot.prototype.constructor = Boot; Boot.prototype.init = function () { this.scale.scaleMode = Phaser.ScaleManager.NO_SCALE; this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; }; Boot.prototype.preload = function () {'bg', 'assets/misc/bg.png'); }; Boot.prototype.create = function () { var style; style = { font: "bold 32px Verdana", fill: "#f00" };//, 0, 'Pizza Mayhem', style);, 0, 'bg'); }; return Boot;});Sorry for the wall of code. Thanks! EDIT: Its really weird, but, the cordova don't copy the files into the application. I don't know what happen but when I inspect my game WebView inside my Android phone, it shows this errors: