• Content Count

  • Joined

  • Last visited

About hoskope

  • Rank
  • Birthday September 9

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location

Recent Profile Visitors

1,017 profile views
  1. hoskope

    Math.random vs game.rnd

    Yeah, this is great. I created my own random and find out later that it's inside framework
  2. hoskope

    Interphase 2 announced

    Can't wait
  3. hoskope

    Collision with sprite and tilemap

    Hey thanks, good catch. Even i've studied 'this' a lot, still makes my head go around..
  4. hoskope

    Collision with sprite and tilemap

    Hey, Can somebody tell me what i'm doing wrong?. I want that my potion collides with the wooden box. Below Game.js FallingDown.Game = function (game) {} FallingDown.Game.prototype = { init: function () { this.scale.pageAlignHorizontally = true; this.physics.startSystem(Phaser.Physics.ARCADE); this.physics.arcade.gravity.y = 300; }, preload: function () { }, create: function () { this.map = this.add.tilemap('levelMap') this.map.addTilesetImage('spritesheet', 'spritesheet') this.level = this.map.createLayer('Level') this.level.resizeWorld() // Sets 1 and 3 tiles for collision! this.map.setCollision([1, 3]) player = this.add.sprite(32, this.world.height - 150, 'character-walking') player.animations.add('right', Phaser.Animation.generateFrameNames('character-walking', 1, 4)) player.animations.add('left', Phaser.Animation.generateFrameNames('character-walking', 5, 8)) this.physics.arcade.enable(player) player.body.collideWorldBounds = true player.body.gravity.y = 800 cursors = this.input.keyboard.createCursorKeys() this.createEnergyPotion() }, update: function () { this.physics.arcade.collide(player, this.level) player.body.velocity.x = 0 this.physics.arcade.collide(this.energyPotion, this.level) this.physics.arcade.overlap(player, this.energyPotion, this.collectEnergyPotion, null, this) this.movePlayer() }, movePlayer: function () { // Moving player to the left if (cursors.left.isDown) { player.body.velocity.x = -150 player.animations.play('left') } // Moving player to the right else if (cursors.right.isDown) { player.body.velocity.x = 150 player.animations.play('right') } // Jumping the player else if (cursors.up.isDown && player.body.blocked.down) { player.body.velocity.y = -350 } else { player.animations.stop() } }, createEnergyPotion: function() { var energyPotion = this.add.sprite(258, 509, 'energy-potion') this.physics.arcade.enable(energyPotion) energyPotion.body.enable = true energyPotion.body.bounce.y = 0.7 + Math.random() * 0.2 energyPotion.body.collideWorldBounds = true }, collectEnergyPotion: function(player, energyPotion) { energyPotion.add.tween(energy-potion).to( { alpha: 0 }, 1000, Phaser.Easing.Linear.None, true, 1, 1000, true); energyPotion.destroy() }, render: function () { } } EDIT: Now that i'm looking the code, do i need to create boxes at new layer in tiled and then make them as group, and that way use it in collide? Question 2: What are the best pratices implementing collectable items for platformer like this? So many ways, include them in the tilemap objects layers, or seperate spritesheet and so on..
  5. hoskope

    Tilemap collision area best practises

    Yeah, i've seen examples using setCollision in this way, but on my case if use : this.map.setCollision([0,1]);My player only collides with the floor, not the boxes. EDIT: Ah, i used wrong numbers, this will make it work properly, yei!: this.map.setCollision([1, 3])
  6. Hello, Beginner user here learning the basics. My guestion is about what is good way to use tilemaps for collision areas. Image from my training project: I've created this level with Tiled using one layer, and then defining it like this in game.js: this.map.setCollision([0, 0, 0, 0,.. 1]) // removed lot's of data to save spaceWell, that works, but somehow i feel there has to be better way? I also saw somebody doing it very wisely with p2 physics, and drawing collision areas with one tile and then in the code using tile's id to set collision areas. I liked this approach, but i never got it working, and i'm using arcade physics for now. Like i mentioned this is just practice, but i like to know some best pratices before i start doing my first game
  7. Can somebody explain difference between all three?
  8. hoskope

    How do you organise your projects?

    I don't have experience on the subject, but here's handbook for Browserify : https://github.com/substack/browserify-handbook
  9. hoskope

    Building your Phaser Projects with Browserify

    Tutorial link is dead.
  10. I'm interested in when and why this happens and how to get rid of it?
  11. hoskope

    Official Phaser 2.0 Book - Looking for feedback

    I loved that chapter on Interphase 1 where writer went through how new Loader works. I wish there was book, which would cover 'everything' like that.
  12. hoskope

    problem with sprite animation

    Thanks for this, i was going crazy about uncaught error and the reason was i was not defining max frames.
  13. hoskope

    Cheatsheets for Phaser v2.4.4

    Beautiful work
  14. hoskope

    Collision with player and object

    Hey, Thanks a lot, it worked. Never came to mind
  15. hoskope

    Collision with player and object

    Hey, Currently player moving through the wooden box, so nothing happens. Your tip makes it collide with the box, that's great!. But i need 'platforms' there as well, because of my floor. If i have these three there: game.physics.arcade.collide(player, platforms, smallWoodenBox)I got error: Uncaught TypeError: c.call is not a functionCheers, P