lenlac

Members
  • Content Count

    29
  • Joined

  • Last visited

About lenlac

  • Rank
    Member

Contact Methods

  • Twitter
    alenjramos
  1. I would like to autohide the address bar. I can get it to hide in Safari but not in Chrome Mobile Broswer. <meta name="viewport" content="initial-scale=1 maximum-scale=1 user-scalable=0 minimal-ui" />I had to modify the line above to the following because the game would not scale properly. <meta name="viewport" content=" minimal-ui" />I have the following lines enable in the index.html <meta name="apple-mobile-web-app-capable" content="yes" /><meta name="mobile-web-app-capable" content="yes">Then boot has the template code: init: function () { this.input.maxPointers = 2; this.stage.disableVisibilityChange = true; if (this.game.device.desktop) { this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.scale.setMinMax(480, 260, 1024, 768); this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; } else { this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.scale.setMinMax(480, 260, 1024, 768); this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; this.scale.forceOrientation(true, false); this.scale.setResizeCallback(this.gameResized, this); this.scale.enterIncorrectOrientation.add(this.enterIncorrectOrientation, this); this.scale.leaveIncorrectOrientation.add(this.leaveIncorrectOrientation, this); } },Thanks in Advance
  2. Sleep helps with silly mistakes. The reason is that there was nothing to resize i was just creating a background and rendering the touch points. Doh I added a background and it renders all properly.
  3. So i have been playing around with the template for full screen provided in the repository. I can get to load and get to the main menu state. In the main menu state it seem not resize to the right property. the screen is only shows from like x 0 to x 300 and y 0 to y 300. Seems like the camera is smaller, i am but sure why is taking place. Any hints would be welcomed. I tried exact fit and that didnt work either. I am previewing on a iphone 6. BasicGame = { /* Here we've just got some global level vars that persist regardless of State swaps */ score: 0, /* If the music in your game needs to play through-out a few State swaps, then you could reference it here */ music: null, /* Your game can check BasicGame.orientated in internal loops to know if it should pause or not */ orientated: false};BasicGame.Boot = function (game) {};BasicGame.Boot.prototype = { init: function () { this.input.maxPointers = 1; this.stage.disableVisibilityChange = true; if (this.game.device.desktop) { this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.scale.setMinMax(480, 260, 1024, 768); this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; } else { this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.scale.setMinMax(480, 260, 1024, 768); this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; this.scale.forceOrientation(true, false); this.scale.setResizeCallback(this.gameResized, this); this.scale.enterIncorrectOrientation.add(this.enterIncorrectOrientation, this); this.scale.leaveIncorrectOrientation.add(this.leaveIncorrectOrientation, this); } }, preload: function () { // Here we load the assets required for our preloader (in this case a background and a loading bar) this.load.image('preloaderBackground', 'images/preloader_background.png'); this.load.image('preloaderBar', 'images/preload.png'); }, create: function () { this.state.start('Preloader'); }, gameResized: function (width, height) { // This could be handy if you need to do any extra processing if the game resizes. // A resize could happen if for example swapping orientation on a device or resizing the browser window. // Note that this callback is only really useful if you use a ScaleMode of RESIZE and place it inside your main game state. }, enterIncorrectOrientation: function () { BasicGame.orientated = false; document.getElementById('orientation').style.display = 'block'; }, leaveIncorrectOrientation: function () { BasicGame.orientated = true; document.getElementById('orientation').style.display = 'none'; }};
  4. http://games.sugarmonkeys.com/Ika/index.html So no experience coding. Just using examples and educating myself over the the last two months. Here is where I am.
  5. lenlac

    FPS Read

    See this example: http://jsfiddle.net/lewster32/3Sx5h/ The key is game.time.advancedTiming without which the game.time.fps value will not be set. oh after reading i noticed that i just had to set the value of advancedTiming to True. Doh AR PS 100 FPS !
  6. lenlac

    FPS Read

    Hello I am trying to check my fps. I have the game state in a seperate file: and in that file i have the function: the bodyInfo shows up find but the fps does not update it just shows -- Ty in advance. render: function() { // game.debug.body(player); this.game.debug.bodyInfo(this.player, 32, 200); this.game.debug.text(this.game.time.fps || '--', 2, 14, "#00ff00");},
  7. map = this.add.tilemap('world1'); map.addTilesetImage('maze', 'tiles'); layer = map.createLayer('layer1'); safezone = map.createLayer('layer2'); map.setCollisionBetween(6, 9, true, layer); map.setCollisionBetween(11, 14, true, layer); map.setCollisionBetween(16, 19, true, layer); map.setCollision(3, true, layer); map.setCollision(10, true, safezone); //layer.debug = true; safezone.debug = true; //this.physics.arcade.enable(layer2, Phaser.Physics.ARCADE, true); layer.resizeWorld(); safezone.resizeWorld();well i was more specific in my layers and that fixed the issue,
  8. Hello I have the following Code map = this.add.tilemap('world1'); map.addTilesetImage('maze', 'tiles'); layer = map.createLayer('layer1'); layer2 = map.createLayer('layer2'); layer2.enableBody = true; map.setCollisionBetween(6, 9); map.setCollisionBetween(11, 14); map.setCollisionBetween(16, 19); map.setCollision(3); map.setCollision(19, true, layer2); //layer.debug = true; //layer2.debug = true; this.physics.arcade.enable(layer2, Phaser.Physics.ARCADE, true); layer.resizeWorld(); layer2.resizeWorld();That is in the create function and in the update function this.physics.arcade.collide(this.evilcoin, layer); this.physics.arcade.collide(this.evilcoin, layer2);The Evil coins collide with layer 1 just fine, but they do not collide with the layer2 at all. I want to basicly create some save havens for my character inside the map. any advice would be great. The layer is drawn correct btw and the block is number 19.
  9. this.physics.arcade.collide(this.player, this.evilcoin, this.collideEnemyPlain);To the Following:this.physics.arcade.collide(this.player, this.evilcoin, this.collideEnemyPlain, null, this);I got it to work! was syntax got it to work by changing those properties on the collide function.
  10. Could someone give me some advice on how to do this best? I have tried a few options but i have not been able to get the function to update the variable correctly: collideEnemyPlain: function(player, dark){ if(dark.body.touching.up) { player.body.velocity.y = -200; dark.kill(); } else { player.body.x = player.body.x - 50; player.body.y = player.body.y - 50; } }I have the function above and i tried to: collideEnemyPlain: function(player, dark){ if(dark.body.touching.up) { player.body.velocity.y = -200; dark.kill(); } else if (this.lives === 0) { player.body.x = player.body.x - 50; player.body.y = player.body.y - 50; player.kill(); } else { player.body.x = player.body.x - 100; player.body.y = player.body.y - 100; this.lives -= 1; }}I can trigger only the If Statement or the Else statement. I fail to trigger the Else If Statement. The variable "lives" is initialized in the function: create area with a initial value of 3. I am dont get errors, but i am pretty sure i dont understand how to get the variable "lives" linked properly from the function to the variable's value. Ty in Advance for any help or examples i can hunt down and study.
  11. So i did the phaser tutorial and expanded on to add a few platformer qualities. So i learned a lot in the process (basicly that i dont know much). Now that i am trying to understand how to run the game from a .js file vs the html file. I am taking the javascript class at code academy to understand it better. The mainly thing i noticed from running in JS is that you create a game container in the index.html Then i would load phaser into it and then load the "first level' or state. However i noticed that i get the an error just about every line that unexpected "game" not defined and so on with the other variables. I looked at a few examples and came to the undetstand "this." is used. The syntax seems to be different running from a js file. Could someone point me in the right direction to learn about this? I would believe its better to run the game from the js file correct? Thanks in Advance.
  12. I have a question, I am trying to learn about states with the Template provided inside the repository. There are no files provided for the images, i was wondering what images I can use in their place? Is there any advice on this? I mainly want to learn about states and not running my game from the index.html file.
  13. (groupname).fixedToCamera = true;well it was that simple, a lot of searching but found it.
  14. Hello, would anyone be able to help me with UI elements that are fixed with the camera movement around the map? So I am able to add the UI element to the World Location of 16, 16 with out issue. I can get it to update the score, the one thing I would like it to do is scroll with the camera. ty AR