GaryS

Members
  • Content count

    49
  • Joined

  • Last visited

About GaryS

  • Rank
    Advanced Member

Contact Methods

  • Website URL
    http://www.simianenterprises.co.uk
  • Twitter
    simiane

Recent Profile Visitors

1,340 profile views
  1. GaryS

    Winter Sprinter - endless dodger

    Yup, that's how I play... I think I got to 786 though, so....
  2. GaryS

    Winter Sprinter - endless dodger

    Funny you should say that - there was a bit of internal debate on that one. Originally we were hoping to have it work across mobile devices, in which case the mechanic would be 'tap to change direction', so endless running makes more sense there. We ran out of time for that, but you may notice that you can use the spacebar instead of the cursors. Glad you like the game!
  3. Hi all! Winter Sprinter is a simple Christmas themed casual endless dodging game - made with Phaser, as a Christmas promotion for Amplicon.com. Dodge icicles, collect PC parts, don't die. My top score is about 800... have at it. https://amplicon.itch.io/winter-sprinter
  4. GaryS

    onInputDown passing incorrect sprite

    ...Actually, on further testing it seems the issue only occurrs when I use the scale tween... if I remove that and leave the alpha tween, I can no longer replicate the problem. Perhaps something about scaling the child sprite down to zero is changing the way the parent's input handler is working?
  5. GaryS

    onInputDown passing incorrect sprite

    Yes, the tween is added to this.game - Sorry, I've updated the code to reflect this. It's definitely the parent sprite (thisTile) that is getting input enabled. If I log the parent, I get what looks to be an instance of the game world (name: __world). I've tried moving the var thisSprite declaration, to no avail. I'm not sure about child sprites and the like, but it certainly seems like this issue only occurrs when I'm using tweens... if I remove the tween, I can no longer replicate the issue. I don't understand a great deal about how tweens work - perhaps I'm doing something wrong in that regard?
  6. GaryS

    onInputDown passing incorrect sprite

    Juuuuust gonna bump this a bit, as I'm still stuck and not sure where to start debugging.
  7. Hi all, I'm having a problem with input events on my sprites. I have a grid of tiles, with an added child sprite. I've added an onInputDown event handler onto each tile. All works well, mostly... but then after a few clicks it seems that the sprite passed to my handler doesn't change - it remains the last sprite clicked. Here's some code: var pos = { x: 0, y: 0 }; var cols = 10; var rows = 10; var numberOfTiles = cols * rows; var tileWidth = 65; var tileHeight = 65; // Place tiles for (var i = 1; i <= numberOfTiles; i++) { var thisTile = this.game.add.sprite(pos.x, pos.y, 'tile', 1); var thisSprite = thisTile.addChild(this.game.make.sprite(0,0, 'tile', 4)); thisTile.inputEnabled = true; thisTile.events.onInputDown.add(this.onDown, this); pos.x += tileWidth; // New column if (i % cols === 0) { pos.y += tileHeight; pos.x = 0; } } This sets out the tiles with no problems. Frame 1 for my background and frame 4 for the foreground. In my onDown function I tween the child sprite down to scale: 0 and alpha: 0. I also do a bit of calculation to work out which tile is clicked. onDown: function(sprite) { var thisRow = (sprite.position.y / tileHeight); var thisCol = (sprite.position.x / tileWidth); var thisTile = ((thisRow * rows) + thisCol) + 1; this.game.add.tween(sprite.children[0].scale).to({ x: 0, y: 0}, 500, Phaser.Easing.Linear.None, true); this.game.add.tween(sprite.children[0]).to({alpha: 0}, 500, Phaser.Easing.Linear.None, true); } It seems this works a few times, but then seemingly at random the sprite being passed to the onDown function remains stuck regardless of which sprite I click. I can't be 100% sure, but I think this problem only occurs when I have a child sprite - does that sound right? I've no clue what's going on. Can anyone help?
  8. GaryS

    Detect sectors of a circle

    Brilliant, that's just what I was after (and seems simple now it's laid out for me...) Thanks once again!
  9. GaryS

    Detect sectors of a circle

    So, circles are confounding me today... About twenty years ago I did GCSE maths and remember wondering when or why I would ever need to know any of this stuff about circles and angles and the like. Now. Now is when I need to know all that stuff. So I've been all over the interwebz and have learned lots about circles, but while there are myriad explainations of how to work out the length of an arc, the angle and area of a sector... and use both radians and degrees to calculate same; I can find nothing that will tell me which sector a given value (theta, radian, degree, whatever) is in. If I've divided my circle into 12 segments, can I pass a value and know that it belongs in sector 3, for instance?
  10. Thanks lumoludo, I managed to get that working! If anyone is interested, I've updated the code here: http://phaser.io/sandbox/edit/qqVRPNYU
  11. Hi all, I'm having difficulty achieving what I'm sure should be a pretty simple input technique. I want to drag a sprite around a circular path, with the mouse or touch (and eventually, keyboard & gamepad, but we'll get to that later) but only when the pointer is over the path itself. So, I found an earlier forum post asking how to force the sprite to move around the circular path using sin and cos: The various techniques listed in the post are working well, but I'm struggling with detecting that a pointer is within the path when pressed. I've seen some examples that use pointerOver, and indeed I've had this working on a sprite - however that only seems to work with the mouse, not a touch pointer. In any case, I found another post where Rich said pointerOver was an internal function and shouldn't be used... Is there anything I can use in conjuction with a mouseMoveCallback, that will detect whether a pointer (mouse/touch) is over a graphics object? Here's what I've got so far: http://phaser.io/sandbox/edit/WQVEpEOG Any help, much apprecaited.
  12. GaryS

    Phaser project generators

    Hi all, I'm starting a new Phaser project and I thought I'd take a look at the options for project generators out there. I'm overwhelmed by the amount of options and while I'm sure most of it is down to personal preference, I'd love to hear some opinions on the best way to go. I've worked on a couple of projects in the past that have used Codevinsky's generator, which was great and got me into using prefabs and the like, but that hasn't been updated in over 2 years. These days everyone's talking about ES6. I ran into some problems in the past with inheritance and thought being able to use 'super' would be a good thing, so I thought I'd give that a try, but there loads of different ES6 generators and they all have different features and methodologies. I was thinking of maintaining a list of all the generators I can find with some information about the technology and features, but I wondered before I put too much time into that, if one already exists somewhere? Does anyone have any opinions as to the best way to go, or is it really just a case of trying them all out and going with whatever feels right?
  13. GaryS

    WIP Money Land

    I really like this! The gameplay is fun, difficult and addictive - but the thing I like most is the artwork. I'm loving that pixel style, chunky and low-res, it really works.
  14. Thanks Matt! Also, thanks for noticing that I've got local storage working on that! As it happens, local storage was really easy. No more difficult than writing a cookie... and if I'm honest, I already had the code to do it laying about. I've been playing with Phaser for a while, using a basic game as a testbed for techniques and ideas. One of the things I always like to do is write code that can be reusable, and thus I wrote a 'GameData' prefab that handles keeping, updating and displaying stats... scores and the like. I'd hoped that my prefabs could be dropped into any game I create, and so far that seems to be working well! As for the blocks, you should be able to slide up and down them... I've had a bit of difficulty there with arcade physics. As best I can tell, the issue is that the blocks the player collides with are constantly moving, and the collide function aims to move the player back outside of the collision range - this seems to override the velocity that the player happens to have and causes it to stop dead. Someone suggested I make the collision boundry per row instead of per block, which might work - but will be fiddly to implement. I've also had a bit of a problem with the movement of the ship... I was trying to be clever with my ship prefab - it has multiple ways of moving - and the best way I could find to allow switching between rotation style movement and basic 8-way movement was to use velocityFromAngle to propel it forward and backwards. All seemed to work well in testing, but I've found when playing the game that for some reason when rotated to face backwards and moving 'forwards' (relatively, so, backwards), the ship can sometimes move much slower than I think it should. No idea why that could be!!
  15. Shiftah is not only my first LD entry, but also my first ever game! I've been messing about with Phaser for a few months now, loving every minute of it... so thought I'd enter Ludum Dare for the first time. The theme was 'ShapeShift', which just basically screams 'Altered Beast' to me... however with my limited graphical acumen, what I've ended up with is an endless runner style game where you navigate your ship through an onslaught of blocks and shapes, trying not to get stuck. The physics are a bit shonky, it has to be said - (I could do with a bit of help on that), but as it stands the game is playable. All in, this was about 30 hours work and includes my first attempts at MOD tracker music too! You can play the game directly or view my LD submission page.