Search the Community
Showing results for tags 'hitboxes'.
-
Hello. I was able to create a hitbox on non-isometric as so: hitboxes = game.add.group(); hitboxes.enableBody = true; var new_dude = game.add.sprite(250,150,"walking_dude"); new_dude.scale.x = 2; new_dude.scale.y = 2; new_dude.addChild(hitboxes); hitbox1 = hitboxes.create(0,0,null); hitbox1.body.setSize(65,70,77,5); // basically a no-image sprite with physics body fixed to a character I can't translate this using isometric plugin because the cube doesn't get fixed to the character as it should. It falls to the ground. What is the actual difference between the two codes? Why does the first gets fixed to character and the second doesn't? I am on this mistery for hours hitboxes = game.add.group(); new_dude = game.add.isoSprite(30, 30, 0, 'walking_dude',0); new_dude.scale.x = 2; new_dude.scale.y = 2; new_dude.addChild(hitboxes); hitbox1 = game.add.isoSprite(30,30,0,null,0,hitboxes); game.physics.isoArcade.enable(hitboxes); hitbox1.body.setSize(300,300,300); The isometric plugins http://udof.org/phaser/iso/doc/Phaser.Plugin.Isometric.html
-
I am new to phaser and I am trying to set up a class named "Player". I want to create a group inside the class that contains different sprites that will serve as sensors for collision (hitboxes). Obviously I want the player phyisics to be enabled which I am not beeing able to get it done. I was previously able to enable physics for other sprites that were added the "normal way". Is it because I am using the isometric plugin and this changes somehow? Also I am have previously tried to set the size of a sprite body but couldn't change its size (at least vissualy when debugging it I saw no difference on the grid) http://udof.org/phaser/iso/doc/Phaser.Plugin.Isometric.Body.html#setSize I am using "setSize(...)" I can change the the last 3 parameters and I see the difference. Not for the first 3 however. Player = function (game, x, y) { Phaser.Sprite.call(this, game, x, y, 'player'); this.scale.x = 1; // this is working this.scale.y = 1; // this is too game.physics.isoArcade.enable(this); // NOT WORKING this.body.collideWorldBounds = true; }; Player.prototype = Object.create(Phaser.Sprite.prototype); Player.prototype.constructor = Player; //INSIDE CREATE FUNCTION // new_player = new Player(game,size_x/2 + 150,size_y/2 -100); game.add.existing(new_player); Any ideas? Thank you
-
We are building a multiplayer top-down shooter deathmatch app. My team's idea is to upload all hits at a given time as x,y coordinates to an array (which is then passed to the server) and then check on each update loop to see if any enemy players were at those same coordinates. We were considering doing it the traditional way (with collisions) but this is a 2-week project and we're concerned it will take too long/introduce issues to use Phaser's native hitbox functionality.