• Content count

  • Joined

  • Last visited

  1. Random Generate along X Axis

    So would you rename the addRowOfHouses function to createHouse ?
  2. Random Generate along X Axis

    Hey All, I recently started playing with Phaser to make a small christmas game. I'm completely new to this and my game comprises of multiple snippets taken from here and there. It's basically a side scroller where santa drops presents in to chimneys. I have the houses starting from the right to left they are created on a timer, addRowOfHouses, this); The addRowOfHouses function is below ( this code was taken from a flappy bird clone ) function addOneHouse(x,y) { var house = houses.getFirstDead(); house.reset(x, y); house.body.velocity.x = -200; house.checkWorldBounds = true; house.outOfBoundsKill = true;} function addRowOfHouses() { var houseSpacing = Math.floor(Math.random() * 5) + 1; for (var i = 0; i < 1; i++) if (i != houseSpacing && i != houseSpacing + 1) addOneHouse(790, i * 1 + 400); }The code makes a house every 1.5 seconds, so it is continuous. I wanted to change this to have it randomly create them between every 0.8 - 1.5 seconds. I thought I could do this using Math.random in the timer but that didn't work. I actually think the method I'm using to generate the houses is probably wrong ( having two functions - addOneHouse and addRowOfHouses ) or at least not the best way to do it, perhaps there's a simpler way to do it. If anyone has a suggestion or any help that would be much appreciated.
  3. How to capture a touch event on mobile device

    Yeah I noticed that if you tap the screen in a certain manner that the player just stops, which in my game can result in death could be quite frustrating for the player or maybe thats the fun of it. I gave hammer.js a go, I keep getting an error "cannot call method 'addEventListener' of undefined"
  4. How to capture a touch event on mobile device

    you cracked it rumdumdum! thanks so much!
  5. How to capture a touch event on mobile device

    Hey Xnamex, I gave that a go but for some reason the tap function only makes him move a very small bit. You have to tap like a mad man to try get the sprite to move across the screen! Maybe there is something I'm doing wrong? Also the walk cycle continuously plays regardless if I have tapped or not. Maybe this is due to it being in the update section?
  6. How to capture a touch event on mobile device

    Is it possible to use this method for moving a character left and right? I have it working with the keyboard using cursors.left.isDown but can this be changed to game.input.activePointer.isDown so the touch functionality will work on mobile? I know I need to split the screen so if they touch the left hand side it moves left and if they touch the right hand side it moves right. But im not quite sure how to split the screen for this, any help would be greatly appreciated!
  7. I'm using this method for scaling up, but for some reason sprites are off screen? Anyone know why this might be happening?
  8. grid game

    Thanks very much fatalfluff
  9. grid game

    Hey, I'm also interested in creating a grid based game, I cant seem to find the Bombevo game, can anyone point me in the right direction? Also, I was flicking through the Phaser folder and stumbled across this image Is it possible to make a game based on this style of grid? Any help is greatly appreciated, thanks!