Bengalaa

Members
  • Content Count

    8
  • Joined

  • Last visited

About Bengalaa

  • Rank
    Newbie

Contact Methods

  • Twitter
    vengadoravg
  1. it would be awesome to have body physics enabled to the camera... So we would be able to rotate, put acceleration, velocity, and even tweens to it!!! also... camera zoom is confusing the arcade physics as shown here: http://www.html5gamedevs.com/topic/12097-world-scale-messing-arcade-collisions-up/ it'd be awesome to have a more stable camera zoom @.@ (lol, i am feeling like a child writing a letter to Santa Claus XD)
  2. you can/should report it to the phaser's github repo https://github.com/photonstorm/phaser btw, i am having the same problem is there any way to fix this?
  3. I can't add them as a children of 'A', because i need to apply one mask to 'A', and another different to the items... the item is not intended to be a dumb child of 'A' :S i already figured out how to make this conveyor belt i did it by adding it a velocity on the x axis whenever it is touching down the , i can't make it as platforms moving, because the conveyor belt is supposed to be static... but thanks for the fiddle! XD there: http://jsfiddle.net/6018w2an/ I added to it some conveyor belts to the platforms... I guess it is not a bug then... == EDIT == the link was not pointing to the modified version o.O sorry, just learning to use the fiddle...
  4. i am not really sure if it would work now... back on time, it didn't work... what I was trying to do, was a little conveyor belt, that caused one thing 'A' to move into one direction when standing in it. 'A' can have several items inside it, so I need those items to move towards the conveyor belt as well, even if they are "floating" inside the thing 'A', so I needed to check whether or not the 'A' thing was touching the conveyor belt or not, inside the update function of the items, and the collide function of the thing 'A' was inside 'A's update function... That's why I need the touching method, because, i have tried to achieve something like this with a collision callback before, but it didn't work, because the collision only worked when the two objects where strongly colliding, and not when the two objects were only touching each other. The 'wasTouching' function was really useful, as I said at the end of the post... and then, I replaced this behavior for a "copy the velocity of the 'A' thing i am contained into' in the update function of the items, but as I still felt that the touching method wasn't responding accurately, I posted here the problem... Maybe there is a scenario where the touching function of some thing might be called from the update function of another thing... as we don't know (do we?) in which order the update functions get executed, this behavior would be kind of weird... why are wasTouching and touching different? shouldn't they be fused? or probably it should be documented as "returns false until the collide function is executed. If The collision caused it to touch something, it then returns true"... but i am not really sure about this... i just found it very confusing
  5. Hi there. Not sure if this is an issue, but, just checked on the documentation, and it does not say anything about this behaviour... I have this code, a simple code that collides two sprites: var mainState = ( function () { var preload = function () { game.load.spritesheet('cota-cola', 'assets/cota-cola.png', 16, 33); game.load.spritesheet('carousel', 'assets/baggage-carousel.png', 50, 100); } var create = function () { var block; cotacola = game.add.sprite(150,0, 'cota-cola'); game.physics.arcade.enable(cotacola); carousel = game.add.group(); for (var i=0; i<5; i++) { block = game.add.sprite(100 + i*50, 100, 'carousel'); game.physics.arcade.enable(block); block.body.immovable = true; carousel.add(block); } cotacola.body.acceleration.y = 400; } var update = function () { console.log(cotacola.body.touching.down); game.physics.arcade.collide(cotacola, carousel); }; return { preload : preload, create : create, update : update };})();var game = new Phaser.Game(500, 300, Phaser.AUTO, 'game');game.state.add('main', mainState);game.state.start('main'); if i call any member of touching before the collide function, it will always be false... var update = function () { console.log(cotacola.body.touching.down); // will always print false game.physics.arcade.collide(cotacola, carousel); };but if I call it after the collide function, it will be accurate... var update = function () { game.physics.arcade.collide(cotacola, carousel); console.log(cotacola.body.touching.down); // this works fine };In the documentation http://phaser.io/docs/2.4.3/Phaser.Physics.Arcade.Body.html#touching it does not say anything about this behaviour. But I think that if this isn't an issue, a warning about this should be documented. Should I post this as a github issue? == EDIT == I just discovered that the behaviour I want, is actually the .wasTouching var update = function () { game.physics.arcade.collide(cotacola, carousel); console.log(cotacola.body.wasTouching.down); // this works fine};This works even if I put it before the collide var update = function () { console.log(cotacola.body.wasTouching.down); // this also works fine game.physics.arcade.collide(cotacola, carousel);};It is kind of confusing, though... because, in a bigger context, i might want to see whether a sprite 'a' is touching something or not, from the update of another sprite 'b'... and if the collide function is coded on the sprite 'a', and the check is realized from the sprite 'b', then this behavior would be very confusing if you don't know which update function gets executed first.
  6. Sorry, I can't manage to make a group respond like a sprite I've been exploring the Phaser examples, but I can't find how to change the velocity of all the sprites inside a group... am I missing something? (I'm very newbie at this n.n') var sun;var mainState = ( function () { var preload = function () { game.load.spritesheet('sun', 'img/sun.png', 50,50); game.load.spritesheet('glow', 'img/glow.png', 70,70); } var create = function () { game.physics.startSystem(Phaser.Physics.ARCADE); fireball = game.add.sprite(0,0, 'sun'); glow = game.add.sprite(0,0, 'glow'); fireball.anchor.setTo(0.5,0.5); glow.anchor.setTo(0.5,0.5); game.physics.enable(fireball, Phaser.Physics.ARCADE); game.physics.enable(glow, Phaser.Physics.ARCADE); sun = game.add.group(); sun.add(glow); sun.add(fireball); game.physics.enable(sun, Phaser.Physics.ARCADE); sun.body.velocity.x = 10; // body is not defined // glow.addChild(fireball); // glow.body.velocity.x = 10; } var update = function () { }; return { preload : preload, create : create, update : update };})();var game = new Phaser.Game(800, 600, Phaser.AUTO, 'game');game.state.add('main', mainState);game.state.start('main');
  7. Bengalaa

    Loading SVG file

    I read here: http://www.html5gamedevs.com/topic/5267-phaser-svg-files/ that there is no support for svg images on phaser, sorry anyway, you can draw sprites on inkscape, and export those pictures to gimp... that's what I do.
  8. Hi! I have been trying to learn how to use the Sprite.addChild... but I noticed something weird: When I have a sprite (child), and add it as a child of another sprite (parent), if both sprites (parent and child) have physics enabled, whenever i give the parent a velocity, the child will acquire a weird acceleration, anyway, when I print the child's acceleration on the console log, it will be 0. I find this weird, I expected the child to move with it's parent. Is removing the physics to the child the only way to avoid this funny behaviour? because I can think of several cases where I would want the child sprite to have physics enabled. Here is an example: var mainState = ( function () { var preload = function () { game.load.spritesheet('sun', 'img/sun.png', 50,50); game.load.spritesheet('glow', 'img/glow.png', 70,70); } var create = function () { game.physics.startSystem(Phaser.Physics.ARCADE); fireball = game.add.sprite(0,0, 'sun'); glow = game.add.sprite(100,100, 'glow'); fireball.anchor.setTo(0.5,0.5); glow.anchor.setTo(0.5,0.5); game.physics.enable(fireball, Phaser.Physics.ARCADE); // everything goes fine // if I remove this line game.physics.enable(glow, Phaser.Physics.ARCADE); glow.addChild(fireball); glow.body.velocity.x = 10; // fireball will acquire a huge acceleration } var update = function () { }; return { preload : preload, create : create, update : update };})();var game = new Phaser.Game(800, 600, Phaser.AUTO, 'game');game.state.add('main', mainState);game.state.start('main');