DudeshootMankill

Members
  • Content Count

    31
  • Joined

  • Last visited

About DudeshootMankill

  • Rank
    Advanced Member

Recent Profile Visitors

808 profile views
  1. I figured this out on my own. What i did was this: this.physics.arcade.overlap(this.bullets, this._collision_layer, function (bullet, _collision_layer) { bullet.kill(); }, function (particle, _collision_layer) { return _collision_layer.collides; }, this); Following this article https://github.com/hexus/phaser-arcade-slopes/issues/7
  2. Hey guys, i'm making a sidescroller with phaser and tiled. I've run into some problems with the gun function. I collide my bullet group like this. this.game.physics.arcade.collide(this.bullet, this._collision_layer, this._kill_bullet, null, this); and the function goes like this: _kill_bullet(bullet, _collision_layer) { bullet.kill(); } this._collision_layer is a tilemap. Now the bullets collide and destroy pretty well, when fired at a low rate of fire. But when i ramp out the speed and rate of fire, the bullets start passing through the collision layer. Especially at angles. If i try to check for overlap instead, the bullet is destroyed instantly. I believe this is because the bounding box encapsulates all of the tilemaplayer. Does anyone have any insights they could share with me here? Some pointers possibly?
  3. Heya, i'm making a sidescroller with ladders. When the player is over a ladder, which is a seperate layer this runs: this._map.setTileIndexCallback([33, 43, 51, 61], this.player.setOnLadder, this.player, this._ladder_layer); I use this to call the ladderfunction, disabling gravity. It works just fine. My question is, can i resize the bounding box that calls the setTileIndexCallback? The tiles are 64x64, and i need the player to be in the middle of the sprite before setOnLadder is fired. Could i resize the bounding box so its something like x = 4 and y = 64? Or if you have some clever way of doing this, i'd like to hear it. Thank you for your time
  4. I've got this overlap callback working, so when my sprite overlaps with the ladder it returns the ladderMode fuction. Like such: this.map.setTileIndexCallback([33, 43, 51, 61], this.ladderMode, this, this.ladderLayer); Is it possible to make this a true or false callback? So that when i'm overlapping and this.ladderMode occurs it just returns for example ladderStatus = true; and then when there's no overlap ladderStatus reverts to false? i need it for this: update: function () { if(ladderStatus) { gravity = 0; } else { gravity = 130; } Thank you for your time.
  5. If a moderator could destroy this thread it'd be nice.
  6. Disregard this. this.map.setCollisionBetween(0, 10000, true, this.ladderLayer); this.map.setCollisionBetween(0, 10000, true, this.collisionLayer); I did this and it worked.
  7. Hey guys i've got a weird problem with tilemaps. In the create function i've got this: this.collisionLayer = this.map.createLayer('CollisionLayer'); this.ladderLayer = this.map.createLayer('LadderLayer'); this.collisionLayer.resizeWorld(); this.map.setCollisionByExclusion([0 ]); and in the update function: this.game.physics.arcade.collide(this.player, this.collisionLayer); this works just fine, and the player collides with the collisionLayer and so on. However if i do this: this.game.physics.arcade.collide(this.player, this.ladderLayer); Nothing happens. I can collide perfectly fine with the ground in my small level. But the exact same code doesnt work for the ladderLayer. I've attached the file beneath if anyone would be so kind as to take a gander. Thanks for your time. firstMap.js
  8. Disregard this please, it was a brain fart on my end.
  9. Sorry for raising a dead horse from the grave here, but i'm having major troubles with this solution when using a gamestates. function yourClickFunction(sprite, pointer) { sprite.alpha = 0.5; } i would have to use this. here (this.sprite, this.pointer) . But that throws up an error. Thank you for your time.
  10. Thank you friend. All of this worked out perfectly.
  11. And another question, if you have the time In your second example how would i combine this.animationPass(); and setInterval? I've got this snip here introMap.prototype = { create: function () { myInterval = setInterval(this.animationPass, 1000); }, update: function () {}, animationPass: function () { this.introText = this.add.text(320, 240, 'Write some text'); this.introText.addColor("#E0AF33", 0); this.timer++; console.log(timer); } } When i do this introText = cannot read text of undefined When i just go create: function () { animationPass(); } introText is added just fine.
  12. A whole bunch of thanks to you. This worked perfectly . Is there some reading you would recommend that elaborates on this?
  13. Hay guys, trying to learn states and i've run into a problem. I've got this function. And when it is called, i need it to create some text. States and breaking my phaser game into several files is a first for me and i cant for the life of me figure this out. I need to create some text from the animationPass function, but i get this error: Uncaught TypeError: Cannot read property 'text' of undefined -- of line 7, and thats where the create introText line is. in my intro.js i've got function animationPass() { introText = this.add.text(320, 240, 'Write some text'); //i've tried this.introText - but that didnt work either. } var introMap = function (game) { var introText; } introMap.prototype = { create: function () { animationPass(); }, update: function () { } } And this has worked fine so far. Infact i've used this structure in another file and it works just fine there. Here i get however Uncaught TypeError: Cannot read property 'text' of undefined -- of line 7, and thats where the create introText line is. My preload.js looks like this preload = function (game) { WebFontConfig = { google: { families: ['Press Start 2P'] } }; } preload.prototype = { preload: function () { this.load.spritesheet('intro', 'img/introAnim.png', 172, 124, 25); }, create: function () { this.game.state.start("introMap"); } } I humbly ask for your assistance. And i'm sorry if the answer is obvious. I would not ask if i hadn't spend a great deal of time trying to figure out the answer myself.
  14. Well, i've hit another snag. I've given my player sprite a child, this is the gun and it tracks the mouse. Now if i turn left, and use scale.x -1 to flip the sprite the gun gets inverted aswell. I've got this so far if (cursorPos > 140) { arrow.rotation = game.physics.arcade.angleToPointer(player) - Math.PI; }; The gun is aimed to the left side but the rotation is inverted of the mouse position. Hope anyone could point me in the right way again?