Jump to content

Conflux

Members
  • Posts

    7
  • Joined

  • Last visited

Recent Profile Visitors

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

Conflux's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Yeah, this solution has some weird behavior, it was working almost perfectly, then i changed one sprite image(no code) and now it doesn't work anymore. I think I'll drop that project, i hate mobile games anyways, was doing that just as a test.
  2. Nice, this shall work, thank you, I'll post the result after i test(can't do it now).
  3. How do i conciliate tapping and buttons, then?
  4. Clicking a button is activating onTap event after the button and doubleTap activates single tap... Why is that happening? How can i fix it? statemanager.play = function(game) { }; var map; var player; var layer; var jbut; function onTap(pointer, doubleTap) { if(doubleTap) { } else { if(player.body.velocity.x == 0) player.body.velocity.x = 100; else player.body.velocity.x = player.body.velocity.x * -1; } } function jump() { player.body.velocity.x = player.body.velocity.x * -1; //gambiarra!!! player.body.velocity.y = -350; } statemanager.play.prototype = { preload: function() { this.load.tilemap('ht', 'maps/happytown.json', null, Phaser.Tilemap.TILED_JSON); this.load.image('chao', 'assets/happy town/ground.png'); this.load.image('plataforma', 'assets/happy town/plat1.png'); this.load.image('bg', 'assets/happy town/bg.png'); this.load.image('jumpbut', 'assets/jump.png'); this.load.atlasJSONArray('dog', 'assets/dogsheet.png', 'assets/dogsheet.json'); }, create: function() { this.physics.startSystem(Phaser.Physics.ARCADE); this.stage.backgroundColor = '#000000'; bg = this.add.tileSprite(0, 0, 1600, 700, 'bg'); bg.fixedToCamera = true; map = this.add.tilemap('ht'); map.addTilesetImage('chao'); map.addTilesetImage('plataforma'); map.setCollisionByExclusion([]); layer = map.createLayer('camada1'); layer.resizeWorld(); this.physics.arcade.gravity.y = 500; player = this.add.sprite(10, 120, 'dog'); player.animations.add('idle', Phaser.Animation.generateFrameNames('Idle (', 1, 10, ').png'), 5, true); player.animations.play('idle'); this.physics.enable(player, Phaser.Physics.ARCADE); player.body.collideWorldBounds = true; player.body.setSize(54, 47, 0, -10); this.camera.follow(player); this.input.onTap.add(onTap, this); jbut = this.add.button(750, 550, 'jumpbut', jump, this); jbut.fixedToCamera = true; }, update: function() { this.physics.arcade.collide(player, layer); } };
  5. Mobile platforms have a severe input limitation, this is obvious, but how do you work around that problem? I don't play mobile games, played just a few long time ago, but i want to develop it because it's where the "easy" money is... Even the simplest mechanics seems like a puzzle, I want to create a game with 2 simple commands: change direction and jump. Then i thought: one tap for change direction and double for jump, but whenever i double tap, the player changes direction before jumping... Is input design for mobile games really a nightmare or I lost something?
  6. Is it called once, after preload, or on each frame like the update function? Is it a good idea to put a game state switch on it?
×
×
  • Create New...